🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.super
Article #41

Re: Inner product / AXPY performance

#41
From: Hugh LaMaster
Date: Tue, 04 Aug 1992 00:32
55 lines
2852 bytes
In article <1992Aug3.171551.27311@wisper.com>, dowd@wisper.com (Kevin Dowd) writes:
|> eijkhout@cupid.cs.utk.edu (Victor Eijkhout) writes:
|> : Yo hardcore number crunchers!
|> : 
|> : I would like to get an idea of the difference in performance
|> : between inner products

|> : and axpy operations
|> : 
|> :        do i=1,n   x(i) = x(i) + a*b(i)


|> : My guess would be that the difference between these two operations
|> : can nowadays be conveniently neglected, but I might be wrong.


You might be able to ignore it on some machines, but only because the
compiler is smart enough to recognize what you are doing and emit some
substitute code for you, or call a library routine for you.

|> : 
|> : Victor.
|> 
|> You're right, inner products aren't directly vectorizable, but there 
|> are some good reasons why you would want to organize


There is an art to doing such calculations efficiently.  Start by 
reading the publications of Jack Dongarra, et al., on BLAS{1,2,3},
Linpack, and LAPACK, if you are interested.

In the meantime, if you want to do matrix multiplies fast, get the
BLAS3 routine SGEMM.  The default version is pretty good, but the
real payoff is that some machines (Cray, Convex, IBM RS/6000) have
hand coded SGEMM routines which are optimized for their particular
architectures, so that *you* don't have to worry about it.

For example, the Cray has high memory bandwidth, and doesn't have cache.
So, with an appropriate routine, you can stream operands through at full
speed on the entire matrix.  The IBM RS/6000, on the other hand, has
a limited mapped area of memory and a limited cache.  So, you want a 
block oriented version of SGEMM for the IBM, which would have some
unnecessary loop/vector startup on the Cray.  The easiest way you can
avoid having to delve into the subtleties of a particular system is
to use the BLAS3 and LAPACK codes you need to avoid having to duplicate
the clever hand-coding effort that the vendors have already accomplished.




-- 
  Hugh LaMaster, M/S 233-9,     UUCP:      ames!lamaster
  NASA Ames Research Center     Internet:  lamaster@ames.arc.nasa.gov
  Moffett Field, CA 94035-1000  Or:        lamaster@george.arc.nasa.gov 
  Phone:  415/604-1056                     #include <usenet/std_disclaimer.h> 
Technical Details
Message-ID: <1992Aug4.003230.12404@riacs.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!haven.umd.edu!darwin.sura.net!mips!sdd.hp.com!uakari.primate.wisc.edu!ames!riacs!pioneer.arc.nasa.gov!lamaster
References: <l7gi3fINNmsd@utkcs2.cs.utk.edu> <1992Aug3.171551.27311@wisper.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!haven.umd.edu!darwin.sura.net!mips!sdd.hp.com!uakari.primate.wisc.edu!ames!riacs!pioneer.arc.nasa.gov!lamaster
From: lamaster@pioneer.arc.nasa.gov (Hugh LaMaster)
Newsgroups: comp.sys.super,comp.lang.fortran
Subject: Re: Inner product / AXPY performance
Message-ID: <1992Aug4.003230.12404@riacs.edu>
Date: 4 Aug 92 00:32:30 GMT
References: <l7gi3fINNmsd@utkcs2.cs.utk.edu> <1992Aug3.171551.27311@wisper.com>
Sender: news@riacs.edu
Organization: RIACS, NASA Ames Research Center
Lines: 55