Weblog Archive
 
Personal tools

Blog

Nov 19, 2009

ATLAS and GSL

by Dale Lukas Peterson — last modified Nov 19, 2009 10:05 PM

My installation notes for compiling ATLAS and GSL from source

ATLAS (Automatically Tuned Linear Algebra Software) is a Fortran/C library that provides BLAS (Basic Linear Algebra Subprograms) 1,2, and 3 level support and some routines from LAPACK.  BLAS level 1,2, and 3 are nothing more than routines for vector - vector, matrix - vector, and matrix - vector operations, respectively.  All of Matlab's matrix functionality is based on ATLAS and LAPACK.  They are thoroughly tested, have a large user community, and are open source using BSD style licenses.

GSL is the GNU Scientific Library.  It provides a ton of functionality, and it makes use of ATLAS if you have it installed on your machine.  My main interest was in being able to use it to do numerical integration of differential equations and for solving systems on nonlinear equations.  I want something that is well tested and runs at compiled speeds, and is open source.  For Python, SciPy offers some of this, but the numerical integrator is more limited than the GSL numerical integrator.  GSL is licensed under GPLv3.

Here is what I did in order to download, compile, and install ATLAS, LAPACK, and GSL, all from source.  I used ATLAS 3.9.17, LAPACK 3.2.1, and GSL 1.13.  These were the most recent versions as of November 23rd, 2009.  I am running Kubuntu 9.10, on a 64-bit machine (Core 2 duo).

I configured each library to install to the usr folder in my home folder so that my system libraries would be unaffected (this is the --prefix=$HOME/usr in all the configure commands).  Additionally, to date I haven't been able to get the most recent version of ATLAS to build all the shared libraries successfully (some build, some don't, I'm awaiting responses from the developers), but the static libraries build just fine on my machine.

  • As root, disable CPU Throttling (either su before these commands or prefix them by 'sudo '):
cpufreq-set -c 0 -g performance
cpufreq-set -c 1 -g performance
  • In your terminal, go to your home folder, and create a folder called usr in your home folder (if it already exists, skip to the next step):
cd
mkdir usr
  • Go to a temporary folder and download the tarballs:
cd /tmp
wget http://downloads.sourceforge.net/project/math-atlas/Developer%20%28unstable%29/3.9.17/atlas3.9.17.tar.bz2?use_mirror=softlayer
wget http://www.netlib.org/lapack/lapack.tgz
wget ftp://ftp.gnu.org/gnu/gsl/gsl-1.13.tar.gz
  • Untar the tarballs (creates an ATLAS folder and a gsl-1.13 folder with the contents of the tarball in it):
tar xvf atlas3.9.17.tar.bz2
tar xvf gsl-1.13.tar
  • Note that there is an install pdf (ATLAS/doc/atlas_install.pdf) that is worth reading if you want to understand how ATLAS works.
  • cd to the ATLAS folder, create a build directory, and run the configure scrip.  The following was what I did for my laptop, which is a 64-bit machine (-b 64), running at 2.0GhZ (-DPentiumCPS=2000), and install them in the usr folder in my home directory (--prefix=$HOME/usr), and link them against the netlib lapack file (--with-netlib-lapack-tarfile=../../lapack.tgz).  You should change 64 to 32 if you are running a 32 bit machine, and 2000 to the appropriate speed (or leave that part out altogether):
cd ATLAS
mkdir build
cd build
../configure -b 64 -D -c -DPentiumCPS=2000 --prefix=$HOME/usr --with-netlib-lapack-tarfile=/tmp/lapack.tgz
  • Now run make to compile and link everything (the first step takes about 10-15 minutes on my machine), and run the checks and timings:
make
make check
make ptcheck
make time
  •  Install the ATLAS include files and library files:
make install
  • Almost done.  Configure, build, and install GSL:
cd /tmp/gsl-1.13
./configure --prefix=$HOME/usr
make
make install
  • Now, add the include directories and library directories to your C_INCLUDE_PATH and LIBRARY_PATH environment variables.   You can do this by adding the following to your .bashrc:
export C_INCLUDE_PATH=$C_INCLUDE_PATH:$HOME/usr/include
export LIBRARY_PATH=$LIBRARY_PATH:$HOME/usr/lib

Finally, test everything out.  Here is a .c file for the Van der Pol oscillator, along with a make file.  Put the two files in the same folder, type make at the terminal, and if all went well, it will compile to vanderpol.out, which  you can then run to integrate the equations of motion.

vanderpol.c

Makefile

Document Actions