From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111c93,b3b20d0591081951 X-Google-Attributes: gid111c93,public From: "Adam C. Powell, IV" Subject: Re: Optimized BLAS (No. 2) Date: 1998/11/12 Message-ID: <364B3F7C.B8EC01BC@nist.gov>#1/1 X-Deja-AN: 411193782 References: <36433B28.1A85B9D7@theo1.physik.uni-stuttgart.de> To: chrisi@theo1.physik.uni-stuttgart.de X-Accept-Language: en-US,en-GB Content-Type: multipart/mixed; boundary="------------B1431D6436417A2A44846529" Organization: National Institute of Standards and Technology Mime-Version: 1.0 Newsgroups: comp.os.linux.alpha This is a multi-part message in MIME format. --------------B1431D6436417A2A44846529 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit "C.Simmendinger" wrote: > Hi there ;-) > > Time for an update. > > I added a few optimized routines to the alpha-blas, > (complex ones) bugfixed a few others and > made sure LAPACK runs atop of it. > > On large matrices egcs/BLAS now beats DEC's f90/DXML. AWESOME! Thank you vey much for putting these together in a single place. The BLAS I had were old, and not written to use gemm (or gemv), so this is a HUGE help! > The whole thing is based on the gemm_based blas from > netlib, Goto's gemm and a couple of routines > from Dayde. > The BLAS is available under > http://129.69.45.26/~chrisi/blastree.tar.gz > Just unpack, use the makelib shellscript and pray ;-) > > Uhm, if g77 doesn't happen to be at /usr/local/bin/g77 > you'll need to set a link. A couple of questions: 1. Why the separate dcmplx directories? To test the effect of -fno-emulate-complex on non-complex sources, I tried compiling dtrmm.f with and without it, and diff showed the objects were identical. (Or does this slow down the single-precision complex routines?) 2. Why not use a makefile (instead of makelib script)? Advantages: no need to specify where g77 is; it dies if a file fails to compile, whereas the makelib script keeps going and gives an incomplete library; if you change one file you don't end up re-compiling everything; you get to watch it compile each file and feel like it's doing something. :-) I've attached a makefile for the main directory that seems to work. Small and simple. 3. How about generating a shared library? The attached makefile does this. It doesn't seem to save a whole lot of space in progarm binaries, but when a new BLAS library is available, you don't have to re-compile other programs that depend on it. 4. Generating this shared library turned up a problem in the source code (for some reason, g77 -shared is stricter than ar). csgpm, dsgpm, ssgpm and zsgpm all start with PROGRAM, not SUBROUTINE, and all have in their file the LOGICAL FUNCTION LNCMP- all identical. Changing the first line in each and removing all LNCMPs but the one in csgpm.f solved this problem. 5. Could we get an additional speed increase by replacing dgemv with a call to Goto's gemm with n=1? (Also ldb=incx, ldc=incy.) This could be done just by writing a "gemv.c" in the dgemm directory (which should probably be called "gemm" since it has both dgemm and sgemm) similar to "gemm.c", which calls gemm_nn or gemm_tn depending on TRANS. It is sort of an abstraction violation, as level 3 BLAS are supposed to depend on level 2 and not vice versa, but I don't think this is a real problem- as long as it works and goes fast. 6. Have you played with the block size settings? I got a 10% speed increase in LAPACK dgetrf (LU decomposition) by editing ilaenv.f to change the block size from 64 to 32. Possible reasons: Goto's gemm loads something like 122x32 and 122x122 blocks of the matrices into L2 cache, changing these both to 64x64 might help a tiny bit; but more likely it's because dgetf2 (unblocked, no gemm) is called with larger submatrices... It's all so complicated. :-) Just wondering if you've tried. Okay, so I've done everything except gemv.c. I'll work on this later. Thank you again! -Adam `Cold Fusion' Powell, IV http://www.ctcms.nist.gov/~powell/ ____ USDoC, National Institute of Standards & Technology (NIST) |\ ||< | Center for Theoretical and Computational Materials Science | \||_> | --------------B1431D6436417A2A44846529 Content-Type: text/plain; charset=us-ascii; name="Makefile" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="Makefile" # Adam Powell's makefile for Christian Simmendinger's Alpha 21164A BLAS package # including Kazushige Goto's amazing dgemm routine FFLAGS = -O3 -fomit-frame-pointer -funroll-loops -fno-schedule-insns \ -fschedule-insns2 -fno-emulate-complex SRCS := $(wildcard *.f) OBJS = $(SRCS:.f=.o) all: $(OBJS) make -C BLAS_RISC lib && make -C dgemm || exit ln -sf BLAS_RISC/*.o dgemm/*.o . rm -f libblas.a ar qv libblas.a *.o rm -f libblas.so g77 -shared -Wl,-soname -Wl,libblas.so -o libblas.so *.o chmod +x libblas.so clean: make -C BLAS_RISC clean && make -C dgemm clean || exit rm -f *.a *.so *.o *~ core --------------B1431D6436417A2A44846529--