Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NumPy and SciPy. Static vs Dynamic loading

TLDR: Can I use static ATLAS/LAPACK libraries with NumPy & SciPy?

Background:

After building ATLAS with LAPACK with the following:

wget http://sourceforge.net/projects/math-atlas/files/Stable/3.10.1/atlas3.10.1.tar.bz2/download
wget http://www.netlib.org/lapack/lapack-3.4.2.tgz
tar -jxvf atlas3.10.1.tar.bz2
mkdir BUILD
cd BUILD
../ATLAS/configure -b 64 -Fa alg -fPIC \
    --with-netlib-lapack-tarfile=../lapack-3.4.2.tgz \
    --prefix=<ATLAS_INSTALL_PATH>
make
cd lib
make shared
make ptshared
cd ..
make install

I got the following files under BUILD/lib:

Make.inc@  
Makefile   

.a files:

libatlas.a       
libcblas.a       
libf77blas.a     
libptf77blas.a  
libtstatlas.a
liblapack.a     
libf77refblas.a  
libptlapack.a
libptcblas.a    

.so files:

libsatlas.so*
libtatlas.so*

My first question is, why don't I have .so (shared dynamic library) files for lapack and cblas?

My second question is, which of the following two files does NumPy use?

libsatlas.so*
libtatlas.so*

Finally, if I define:

BLAS=/path_to_BUILD/lib/libcblas.a
LAPACK=/path_to_BUILD/lib/liblapack.a
ATLAS=/path_to_BUILD/lib/libatlas.a

and add /path_to_BUILD/lib to LD_LIBRARY_PATH and to the library_dirs variable within the site.cfg file in NumPy. Would NumPy and SciPy use my libraries? (even though they are static?).

like image 850
Amelio Vazquez-Reina Avatar asked Apr 18 '13 22:04

Amelio Vazquez-Reina


1 Answers

You should be able to. Add

[DEFAULT]
search_static_first = true

to your site.cfg file and you should be good to go.

like image 67
MattDMo Avatar answered Sep 22 '22 11:09

MattDMo