Sonntag, 31. Januar 2010

Compiling atlas for GNU Octave on openSUSE 11.2

Having a full featured GNU Octave on openSUSE is not the most trivial thing at all. During the last years I always preferred to compile it myself. Unfortunately this means that I also need to compile a variety of libraries needed by Octave.

If you are a newbie to Octave you should not necessarily follow my description. There is some evidence that you don't need it. If your requirement is to have a GNU Octave with full capabilities, but do not need to care to much about the performance it will be better if you use the octave 3.2.0 package from the OBS (openSUSE build service) from version 11.1 by ars3niy (1 click install). It is fully compatible with openSUSE 11.2.

There is also a description how to build your own octave 3.2.3 rpm available at Sebastian Schöps blog.

Here comes my description what I did to have atlas (automatically tuned linear algebra software) available.

First of all I removed the atlas from OBS (it lead to segfaults for me on my machine) as well as the lapack package with zypper.

The whole process is based on a combination from the following pages
http://www.scipy.org/Installing_SciPy/Linux
http://skuld.bmsc.washington.edu/~tlsmd/install.html
slightly adapted to my needs.

Download the latest stable atlas from SourceForge (this was 3.8.3). Before installing it I built my own lapack library following the advice for lapack in Building Atlas by Hand.
This gives me a static library lapack_LINUX.a which I renamed to liblapack.a and copied to /usr/local/lib64, I also need a dynamic library which I created by the following steps

In the directory where lapack was built
mkdir tmp
cp liblapack.a tmp/
cd tmp/
ar -x liblapack.a
gcc -fPIC -lgfortran -shared *.o -Wl,-soname,liblapack.so.3 -o liblapack.so.3

sudo cp liblapack.so.3 /usr/local/lib64/
cd /usr/local/lib64
sudo cp -s liblapack.so.3 liblapack.so

and then followed the rest of the "Building Atlas by Hand" article.

The default install of the atlas library puts them into /usr/local/lib/atlas/ which is not appropriate for me since I have a 64 bit machine. I decided to solve this with symbolic links because then I have not to think about it if I recompile it sometime later.

cd /usr/local/lib64
sudo cp -s ../lib/atlas/* .

Running configure for GNU Octave 3.2.3 properly detects the atlas and the corresponding lapack library (but it chooses the sequential versions).

To make Octave use the threaded versions so that I have benefit from the multicore machine I needed to tweak the file Makeconf (created by ./configure).

search for the line
BLAS_LIBS = -llapack -lcblas -lf77blas -latlas
and substitute -lcblas by -lptcblas and -lf77blas by -lptf77blas

After
make -j 4
and waiting some time
make check
sudo make install
my Octave runs now properly with the multithreaded libraries.

Keine Kommentare:

Kommentar veröffentlichen