Tuesday, 20 January 2009

ATLAS, LAPACK installation (unfinished)

ATLAS

Check http://math-atlas.sourceforge.net/atlas_install/
Read section 8 in particular. This document was taken from section 8, and modified (as little as possible) for beans.

Download from http://downloads.sourceforge.net/math-atlas/atlas3.8.2.tar.bz2?modtime=1212787160&big_mirror=0

unpack:
$ tar xvf atlas3.8.2.tar.bz2

This is suse10.3 64 using gcc4.2.1 which is ok, according to section 8
Like section 8, I'll build dynamic libraries (position independent sounds good to me).

$ cat /proc/cpuinfo

tells me 2.00GHz. I'll try (sect 8)

-D c -DXeonCPS=2000

I'll install the libraries to /home/m.starnes/local/atlas (like sect 8 did)
so pass

-prefix=/home/me/local/atlas

64 bit installation and full LAPACK library so pass

-b 64

and

--with-netlib-lapack=

The something will be known once LAPACK is installed.

Section 8.2

$ cd ~/
$ mkdir numerics
$ cd numerics
$ bunzip2 -c ~/downloads/ATLAS/atlas3.8.2.tar.bz2 | tar xfm -
$ mv ATLAS ATLAS3.8.2
$ gunzip -c ~/downloads/python/lapack-3.1.1.tgz | tar xfm -
$ ls
ATLAS3.8.2/ lapack-3.1.1/

Set the LAPACK Make.inc appropriately.
$ cd lapack-3.1.1/
$ cp INSTALL/make.inc.LINUX make.inc

Change to the ATLAS source directory, and produce a dry-run BLDdir in order to get information for the make.inc file:

$ cd ../ATLAS3.8.2/
$ mkdir bogus
$ cd bogus
$ ../configure -b 64 -D c -DXeonCPS=2000 -Fa alg -fPIC
.....
.....
$ fgrep "F77 =" Make.inc
F77 = gfortran
$ fgrep "F77FLAGS =" Make.inc
F77FLAGS = -fomit-frame-pointer -mfpmath=387 -O2 -falign-loops=4 -fPIC -m64

OK. Delete the bogus dire, and fill in make.inc

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

Set the following:
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

and install LAPACK:
$ make lib

lots of output.
$ ls
BLAS html lapack_LINUX.a make.inc manpages SRC tmglib_LINUX.a
COPYING INSTALL Makefile make.inc.example README TESTING

That's a succesfull LAPACK library. Now install ATLAS.



8.3. Creating BLDdir and installing ATLAS

$ cd ../ATLAS3.8.2
$ mkdir beans64 (not animal64)
$ cd beans64
$ mkdir ~/local/atlas (my extra, this, as the directory wasn't there)
$ ../configure -b 64 -D c -DXeonCPS=2000 -Fa alg -fPIC --prefix=/home/me/local/atlas --with-netlib-lapack=/home/me/numerics/lapack-3.1.1/lapack_LINUX.a
$ make

lots of output, including some timing stuff....

$ make check

Says 0 fails. Same for $ make ptcheck (parallel)

Test performance.

$ make time

Beans shows a table with only 4 columns but it hows the clock rate to be 1995MHz, which is correct.

Clock rate=1995Mhz
single precision double precision
********************* ********************
real complex real complex
Benchmark % Clock % Clock % Clock % Clock
========= ========= ========= ========= =========
kSelMM 606.4 556.8 317.0 303.2
kGenMM 99.6 99.6 99.6 99.6
kMM_NT 99.6 98.2 98.2 96.9
kMM_TN 99.6 98.2 98.2 96.2
BIG_MM 593.4 588.3 310.1 310.8
kMV_N 58.1 98.6 52.6 72.6
kMV_T 83.3 90.9 52.7 64.0
kGER 95.4 97.4 46.7 66.1


I'll rewind beans, and put the correct time in, see if it makes any difference to this result:

$ cd ~/numerics/ATLAS3.8.2
$ mkdir bogus
$ cd bogus

$ ../configure -b 64 -D c -DXeonCPS=2000 -Fa alg -fPIC
$ fgrep "F77 =" Make.inc
F77 = gfortran
$ fgrep "F77FLAGS =" Make.inc
F77FLAGS = -fomit-frame-pointer -mfpmath=387 -O2 -falign-loops=4 -fPIC -m64
(no change)
$ cd ..
$ rm -rf bogus/
$ cd ../lapack-3.1.1/
$ vi make.inc (this time, I set NOOPTS to include -fPIC, to fix the make shared problem below)
(no changes)
$ make clean (essential on the second pass, otherwise make lib doesnt do tests)
$ make lib (takes ages)

$ cd ../ATLAS3.8.2
$ mkdir beans64 (not animal64. remove all files if this is 2nd try.)
$ cd beans64
$ mkdir ~/local/atlas (my extra, this, as the directory wasn't there. removal all files if already there.)
$ rm Make.inc (my extra, as the first try complained. Same error 2nd time, too.)
$ ../configure -b 64 -D c -DXeonCPS=2000 -Fa alg -fPIC --prefix=/home/m.starnes/local/atlas --with-netlib-lapack=/home/m.starnes/numerics/lapack-3.1.1/lapack_LINUX.a
$ make (lots of output including timing.)
$ make time

Clock rate=1995Mhz
single precision double precision
********************* ********************
real complex real complex
Benchmark % Clock % Clock % Clock % Clock
========= ========= ========= ========= =========
kSelMM 606.4 556.8 317.0 303.2
kGenMM 99.6 99.6 99.6 99.6
kMM_NT 99.6 98.2 98.2 96.9
kMM_TN 99.6 98.2 98.2 96.2
BIG_MM 586.6 584.1 311.1 310.8
kMV_N 58.1 98.6 52.6 72.6
kMV_T 83.3 90.9 52.7 64.0
kGER 95.4 97.4 46.7 66.1

Same as before. Balls. Continue.

$ make install

$ cd ~/local/atlas
$ ls
include lib
$ ls include
atlas cblas.h clapack.h
$ ls include/atlas
atlas_buildinfo.h atlas_ctrsmXover.h atlas_smv.h atlas_zdNKB.h cXover.h
atlas_cacheedge.h atlas_dmv.h atlas_smvN.h atlas_zmv.h dmm.h
atlas_cmv.h atlas_dmvN.h atlas_smvS.h atlas_zmvN.h dXover.h
atlas_cmvN.h atlas_dmvS.h atlas_smvT.h atlas_zmvS.h smm.h
atlas_cmvS.h atlas_dmvT.h atlas_sNCmm.h atlas_zmvT.h sXover.h
atlas_cmvT.h atlas_dNCmm.h atlas_sr1.h atlas_zNCmm.h zmm.h
atlas_cNCmm.h atlas_dr1.h atlas_ssysinfo.h atlas_zr1.h zXover.h
atlas_cr1.h atlas_dsysinfo.h atlas_strsmXover.h atlas_zsysinfo.h
atlas_csNKB.h atlas_dtrsmXover.h atlas_trsmNB.h atlas_ztrsmXover.h
atlas_csysinfo.h atlas_pthreads.h atlas_type.h cmm.h
$ ls lib
libatlas.a libcblas.a libf77blas.a liblapack.a libptcblas.a libptf77blas.a

lib has only, '.a' files = static libraries. Dynamic libs are not automated by ATLAS. Build the shared objects:

$ cd ~/numerics/ATLAS3.8.2/beans64/lib
$ make shared

rm -f libatlas.so liblapack.so
make libatlas.so liblapack.so libf77blas.so libcblas.so liblapack.so
make[1]: Entering directory `/home/me/numerics/ATLAS3.8.2/beans64/lib'
ld -melf_x86_64 -shared -soname libatlas.so -o libatlas.so \
--whole-archive libatlas.a --no-whole-archive -lc -lpthread -lm
ld -melf_x86_64 -shared -soname liblapack.so -o liblapack.so --whole-archive \
liblapack.a --no-whole-archive -L/usr/lib64/gcc/x86_64-suse-linux/4.2.1 -l gfortran
ld: liblapack.a(slaruv.o): relocation R_X86_64_32S against `a local symbol' can not be used when making a shared object; recompile with -fPIC
liblapack.a(slaruv.o): could not read symbols: Bad value
make[1]: *** [liblapack.so] Error 1
make[1]: Leaving directory `/home/me/numerics/ATLAS3.8.2/beans64/lib'
make: *** [shared] Error 2

Same problem with quad.

Second time, set NOOPTS to include -fPIC.

No comments:

Post a Comment