Creating source directories and building LAPACK

Now that I know what ATLAS configure flags I want to throw, I am ready to begin installing LAPACK. The first step is to create the numerics directory that will hold the libraries, and untar them:
animal>cd ~/
animal>mkdir numerics
animal>cd numerics/
animal>bunzip2 -c ~/atlas3.8.0.tar.bz2 | tar xfm -
animal>mv ATLAS ATLAS3.8.0
animal>gunzip -c ~/dload/lapack-3.1.1.tgz | tar xfm -
animal>ls
ATLAS3.7.38/  lapack-3.1.1/

Now, we are needing to set the LAPACK Make.inc appropriately. First, I go into the LAPACK directory, and copy the platform-specific make.inc to make.inc. In my case this is:

animal>cd lapack-3.1.1/
animal>cp INSTALL/make.inc.LINUX make.inc

I now edit the created make.inc (vi make.inc), and here are the make macros that I change:

FORTRAN  = <want to set to ATLAS's F77 macro>
OPTS     = <want to set to ATLAS F77FLAGS macro>
DRVOPTS  = $(OPTS)
NOOPT    = <F77FLAGS w/o optimization>
LOADER   = $(FORTRAN)
LOADOPTS = $(OPTS)
TIMER    = <need to know what compiler I'm using to set>

So far, I have only been able to fill in DRVOPTS, LOADER and LOADOPTS, which are defined in terms of the macros I've yet to fill in! The reason is that I want to use the same compiler and flags as ATLAS, so that I'm sure my LAPACK library can interoperate with my ATLAS-tuned library. I will set the FORTRAN macro to the compiler indicated by ATLAS's F77 macro, and OPTS will be the same as F77FLAGS.

So, I change to the ATLAS source directory, and produce a dry-run BLDdir in order to get this information by:

animal>cd ../ATLAS3.7.38/
animal>mkdir bogus
animal>cd bogus/
animal>../configure -b 64 -D c -DPentiumCPS=2200 -Fa alg -fPIC
...................................................
............<A WHOLE LOT OF OUTPUT>................
...................................................
animal>fgrep "F77 =" Make.inc
   F77 = gfortran
animal>fgrep "F77FLAGS =" Make.inc
   F77FLAGS = -fomit-frame-pointer -mfpmath=387 -O2 -falign-loops=4 -fPIC -m64

With this info in hand, I am ready to delete this bogus directory, and go back and edit the LAPACK make.inc:

animal>cd ..
animal>rm -rf bogus/
animal>cd ../lapack-3.1.1/
animal>vi make.inc

I now fill in my make.inc macros as:

FORTRAN  = gfortran
OPTS     = -fomit-frame-pointer -mfpmath=387 -O2 -falign-loops=4 -fPIC -m64
DRVOPTS  = $(OPTS)
NOOPT    = -fomit-frame-pointer -mfpmath=387 -m64
LOADER   = $(FORTRAN)
LOADOPTS = $(OPTS)
TIMER    = INT_ETIME

I chose the setting of TIMER based on the fact that the example file's comments said it is the correct setting when the compiler is gfortran.

Now I perform the LAPACK install:

animal>make lib
  ./testdlamch; ./testsecond; ./testdsecnd; ./testversion )
make[1]: Entering directory `/home/whaley/numerics/lapack-3.1.1/INSTALL'
gfortran -fomit-frame-pointer -mfpmath=387 -O2 -falign-loops=4 -m64 -c lsame.f -o lsame.o
........................................................
.............<WHOLE LOT OF COMPILATION>.................
........................................................
ar cr ../../tmglib_LINUX.a slatms.o slatme.o slatmr.o slagge.o slagsy.o
slakf2.o slarge.o slaror.o slarot.o slatm2.o slatm3.o slatm5.o slatm6.o
clatms.o clatme.o clatmr.o clagge.o claghe.o clagsy.o clakf2.o clarge.o
claror.o clarot.o clatm1.o clarnd.o clatm2.o clatm3.o clatm5.o clatm6.o
slatm1.o slaran.o slarnd.o dlatms.o dlatme.o dlatmr.o dlagge.o dlagsy.o
dlakf2.o dlarge.o dlaror.o dlarot.o dlatm2.o dlatm3.o dlatm5.o dlatm6.o
zlatms.o zlatme.o zlatmr.o zlagge.o zlaghe.o zlagsy.o zlakf2.o zlarge.o
zlaror.o zlarot.o zlatm1.o zlarnd.o zlatm2.o zlatm3.o zlatm5.o zlatm6.o
dlatm1.o dlaran.o dlarnd.o
ranlib ../../tmglib_LINUX.a
make[1]: Leaving directory `/home/whaley/numerics/lapack-3.1.1/TESTING/MATGEN'
227.482u 20.093s 4:09.81 99.1%  0+0k 0+0io 12pf+0w
animal>
animal>ls
BLAS/    INSTALL/        make.inc          README    tmglib_LINUX.a
COPYING  lapack_LINUX.a  make.inc.example  SRC/
html/    Makefile        manpages/         TESTING/

So, we have succesfully created the LAPACK library, and now we need to install ATLAS and a complete LAPACK using it.

R. Clint Whaley 2016-07-28