[Numpy-discussion] building numpy with atlas on ubuntu edgy

David Cournapeau david@ar.media.kyoto-u.ac...
Wed Apr 18 22:03:44 CDT 2007

Charles R Harris wrote:
> On 4/18/07, *Keith Goodman* <kwgoodman@gmail.com 
> <mailto:kwgoodman@gmail.com>> wrote:
>     On 4/18/07, Charles R Harris <charlesr.harris@gmail.com
>     <mailto:charlesr.harris@gmail.com>> wrote:
>     > On 4/18/07, Keith Goodman <kwgoodman@gmail.com
>     <mailto:kwgoodman@gmail.com>> wrote:
>     > > I'd like to compile atlas so that I can take full advantage of
>     my core
>     > > 2 duo. Numpy dynamically links to the debian binary of
>     atlas-sse that
>     > > I installed. But the atlas website says that they recommend
>     static
>     > > linking.
>     > >
>     > > Which do you recommend, static or dynamic? Are there good
>     directions for
>     > either?
>     >
>     > I don't know which is best, although I suspect the statically
>     linked version
>     > will be larger. It might seem that just pulling in the gemm routines
>     > wouldn't add much, but they pull in lots of supporting routines.
>     To get
>     > numpy to link statically you will also probably need to have a
>     directory
>     > that contains only the *.a versions because the linker will
>     default to the
>     > *.so if they are present; i don't think there is a way to
>     specify the
>     > -static flag to the gcc compiler. Maybe someone else knows how
>     to do that.
>     > For ATLAS, I believe the latest versions are also recommended
>     because the
>     > stable version is so old.
>     At the moment best is equal to easiest since I have never compiled
>     atlas. Does anyone know of a howto on compiling atlas (dynamically
>     linked)?
> The instructions that come with ATLAS are useable, and with the 3.7.30 
> version the process is pretty easy. Just make sure you read the part 
> concerning relocatable libraries first, as you will need to add some 
> flags to the ./configure command line, -fPIC  and a couple of others. 
> After compiling and install, IIRC, the libraries will be in 
> /usr/local/lib/ATLAS, which should be OK for debian. Then you need to 
> add a file in /etc/ld.conf.d with the name of the directory and run 
> ldconfig in order to let the system know where the libraries are and 
> what they contain. Or you could save the old /usr/lib/atlas directory 
> and put the new libraries there and then run ldconfig. I also found it 
> necessary to delete the old numpy site-package before reinstalling numpy.
Here is what I do to compile atlas with full lapack, dynamically, on 
debian systems (ubuntu is the same for that matter):

    - sudo apt-get install g77 lapack3-pic lapack3-test refblas3-test
    - untar atlas, go into ATLAS directory
    - mkdir MyObj, cd MyObj (this is where the lib will be built)
    - configure the build: ../configure -Si archdef 1 -Fa alg -fPIC -C 
if g77 -Ss flapack /usr/lib/liblapack_pic.a
    - build the lib: make
    - time and test the library: make time; make test
    - build the shared library: cd lib; make shared.

    - lapack3-test will be handy to test the compiled atlas, and 
lapack3-pic gives you a lapack library which can be used to build a full 
shared LAPACK library using atlas.
    - archdef 1 means uses arch default, much faster - up to 10 times - 
to compile the library
    - -Fa alg -fPIC says to add -fPIC to build all objects files (needed 
for shared lib)
    - -C if g77 says to use g77 and not gfortran as the fortran 
compiler. On debian, g77 is still the default, and gfortran has a 
different ABI, meaning all kind of problems if you use gfortran for now 
on debian if you do not know what you are doing.

I strongly advise you to use the officiel lapack and blas testers 
afterwards. On debian, as they are dynamically linked to blas/lapack, 
you can choose which library to test thanks to the LD_LIBRARY_PATH trick.



More information about the Numpy-discussion mailing list