Difference between revisions of "Lapack compilation"

From CUC3
Jump to navigation Jump to search
import>Jss43
 
import>Jss43
m
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
The atlas modules aren't suitable for all machines (e.g. 64-bit P4s). I compiled my own lapack routines (available from [http://www.netlib.org]. I'll note that their documentation is wrong in certain places, but it's kind of obvious what paths they refer to. As Catherine [http://www-theor.ch.cam.ac.uk/IT/software/atlas.html notes], it's not worth doing much tuning, so I just used the bog-standard f77 configuration. I installed it in ~/src/lib/lapack-3.1.1:
+
I had some problems using the atlas modules, which seem to be not applicable to all machines (e.g. 64-bit P4s). I compiled my own lapack routines (available from [http://www.netlib.org]. Their documentation is wrong in certain places, but it's kind of obvious what paths they refer to. As Catherine [http://www-theor.ch.cam.ac.uk/IT/software/atlas.html notes], it's not worth doing much tuning, so I just used the bog-standard f77 configuration. I installed it in ~/src/lib/lapack-3.1.1:
   
 
<pre>
 
<pre>
Line 8: Line 8:
 
[reams of output]
 
[reams of output]
 
g77: ../../blas_LINUX.a: No such file or directory # FIBBERS!
 
g77: ../../blas_LINUX.a: No such file or directory # FIBBERS!
jss43@keiko:~/src/lib/lapack-3.1.1> cd BLAS/SRC && make && cd ../../ # Fine, we'll make BLAS ourselves...
+
jss43@keiko:~/src/lib/lapack-3.1.1> cd BLAS/SRC && make && cd - # Fine, we'll make BLAS ourselves...
 
jss43@keiko:~/src/lib/lapack-3.1.1> make # ...and finish the job.
 
jss43@keiko:~/src/lib/lapack-3.1.1> make # ...and finish the job.
 
</pre>
 
</pre>
   
 
The last make command takes a while to run, so it's worth having a [http://www.nicecupofteaandasitdown.com/ cup of tea] as you wait.
 
The last make command takes a while to run, so it's worth having a [http://www.nicecupofteaandasitdown.com/ cup of tea] as you wait.
  +
(You can avoid the error in the middle by editing the Makefile.)
   
 
The makefile also runs tests which passed. The libraries are blas_LINUX.a and lapack_LINUX.a, so we can link to them to give them more standard names:
 
The makefile also runs tests which passed. The libraries are blas_LINUX.a and lapack_LINUX.a, so we can link to them to give them more standard names:
Line 23: Line 24:
 
in the link line. This is somewhat platform dependent though, so we can make it even easier to use by using [[enviroment modules]] to reduce the link line to:
 
in the link line. This is somewhat platform dependent though, so we can make it even easier to use by using [[enviroment modules]] to reduce the link line to:
 
-llapack -lblas
 
-llapack -lblas
  +
  +
ADDENDUM:
  +
Actually, not so straightfoward. I found using zdotc caused a segmentation fault. Some google-fu implied this might be due to how g77 and gfortran [http://developer.apple.com/hardwaredrivers/ve/errata.html return values from routines], and causes problems with 4 routines. Catherine, Greg: did you have this issue?
  +
  +
Anyway, I re-compiled using the INSTALL/make.inc.gfortran as the make.inc. I had to do ''make cleanall'', which is different from ''make clean''. zdotc no longer caused any issues.
  +
  +
[[User:cen1001|Catherine]] 09:49, 7 July 2008 (BST) I haven't encountered that, but we gave up supporting ATLAS other than by providing the precompiled binaries about the time gfortran succeeded g77 and I haven't tried building it since, so I expect I'd get the same thing.

Latest revision as of 19:52, 25 July 2008

I had some problems using the atlas modules, which seem to be not applicable to all machines (e.g. 64-bit P4s). I compiled my own lapack routines (available from [1]. Their documentation is wrong in certain places, but it's kind of obvious what paths they refer to. As Catherine notes, it's not worth doing much tuning, so I just used the bog-standard f77 configuration. I installed it in ~/src/lib/lapack-3.1.1:

jss43@keiko:~/src/lib> wget -O - http://www.netlib.org/lapack/lapack.tgz | tar xvzf -  # Download and extract to lapack-3.1.1
jss43@keiko:~/src/lib> cd lapack-3.1.1
jss43@keiko:~/src/lib/lapack-3.1.1> cp make.inc.example make.inc        # Use g77 configuration.  Other examples exist in the INSTALL directory.
jss43@keiko:~/src/lib/lapack-3.1.1> make                                # A (cursory) glance at the docs implies this makes everything (including BLAS).
[reams of output]
g77: ../../blas_LINUX.a: No such file or directory                      # FIBBERS!
jss43@keiko:~/src/lib/lapack-3.1.1> cd BLAS/SRC && make && cd -         # Fine, we'll make BLAS ourselves...
jss43@keiko:~/src/lib/lapack-3.1.1> make                                # ...and finish the job.

The last make command takes a while to run, so it's worth having a cup of tea as you wait. (You can avoid the error in the middle by editing the Makefile.)

The makefile also runs tests which passed. The libraries are blas_LINUX.a and lapack_LINUX.a, so we can link to them to give them more standard names:

jss43@keiko:~/src/lib/lapack-3.1.1> ln -s lapack_LINUX.a liblapack.a
jss43@keiko:~/src/lib/lapack-3.1.1> ln -s blas_LINUX.a libblas.a

These can now be used in compilation by using:

 -L ~/src/lib/lapack-3.1.1 -llapack -lblas 

in the link line. This is somewhat platform dependent though, so we can make it even easier to use by using enviroment modules to reduce the link line to:

-llapack -lblas

ADDENDUM: Actually, not so straightfoward. I found using zdotc caused a segmentation fault. Some google-fu implied this might be due to how g77 and gfortran return values from routines, and causes problems with 4 routines. Catherine, Greg: did you have this issue?

Anyway, I re-compiled using the INSTALL/make.inc.gfortran as the make.inc. I had to do make cleanall, which is different from make clean. zdotc no longer caused any issues.

Catherine 09:49, 7 July 2008 (BST) I haven't encountered that, but we gave up supporting ATLAS other than by providing the precompiled binaries about the time gfortran succeeded g77 and I haven't tried building it since, so I expect I'd get the same thing.