Personal tools
You are here: Home / Installing Biskit / Troubleshooting / Numeric / Lapack+Atlas

Numeric / Lapack+Atlas

This section describes how to compile the Numeric python module against external (hardware-optimized) Lapack and Atlas libraries.

Lapack is broken in some recent versions of Numerical Python. This will affect some Biskit modules (e.g clustering and entropy calculations) as well as some BioPython modules.

To test if your Lapack is broken type this in your python interpreter:

from Numeric import *
from LinearAlgebra import eigenvalues
x = array([[1,2],[3,4]])
eigenvalues(x)

If it hangs you will have to find a version of Numeric without this bug (23.8.2 is recommended) or find find a way to compile Numeric not resulting in this bug. One way to do this is to install ALTAL and LAPACK localy and then compile Numeric using this. This may also give you substantial speed advantages. More instructions here: https://cirl.berkeley.edu/view/Grants/BuildLapack

ATLAS (http://math-atlas.sourceforge.net) in ATLAS:

make
make install arch=<arch> (takes a very long time)

On an AMD64 system you probably have to edit the Make.<arch>:

F77FLAGS = -fomit-frame-pointer -O -m64 -fPIC
CCFLAG0 = -fomit-frame-pointer -O -mfpmath=387 -m64 -fPIC
MMFLAGS = -fomit-frame-pointer -O -mfpmath=387 -m64 -fPIC
XCCFLAGS = $(CDEFS) -fomit-frame-pointer -O -mfpmath=387 -m64 -fPIC

Lapack (http://www.netlib.org/lapack/) in LAPACK:

cp INSTALL/make.inc.LINUX make.inc
make lapacklib
make clean

On an AMD64 system you probably have to edit the Lapack make.inc file as follows:

OPTS     = -funroll-all-loops -O3 -m64 -fno-second-underscore -fPIC
NOOPT    = -m64 -fno-second-underscore -fPIC

Complementing ATLAS with LAPACK:

cd ~/ATLAS/lib/<arch>
cp liblapack.a liblapack_orig.a # make a backup
mkdir tmp; cd tmp
ar x ../liblapack.a
cp ~/LAPACK/lapack_LINUX.a ../liblapack.a
ar r ../liblapack.a *.o
cd ..; rm -rf tmp

Install (use lib64 if appropriate):

mkdir /usr/local/lib/atlas (if not there)
cp ~/ATLAS/lib/<arch>/*.a  /usr/local/lib/atlas/.

mkdir /usr/local/include/atlas (if not there)
cp ~/ATLAS/include/cblas.h /usr/local/include/atlas/.
cp ~/ATLAS/include/clapack.h /usr/local/include/atlas/.

Then in Numeric-24.0b2 edit customize.py:

use_system_lapack = 1
lapack_library_dirs = ['/usr/local/lib/atlas']
lapack_libraries = ['lapack', 'cblas', 'f77blas', 'atlas', 'g2c']
lapack_extra_link_args = []

Now install Numeric and things should work.:

python setup.py build
python setup.py install