Archive for the ‘Computation’ category

MTL 4 Installation

January 6th, 2010

The installation of MTL 4 is extremely easy. Actually, we only need to download 2 packages (boost and mtl4) and extract them locally if we don’t want to run the tests and example programs. The complete installation guide please you could always refer to the official site: http://www.osl.iu.edu/research/mtl/mtl4/doc/install.php3.

  • The first step is to download and extract boost which is used by MTL 4. Go to boost’s homepage http://www.boost.org/, and download the newest version of boost. Suppose you save it on your local path as /home/me/programs/. Extract it as boost_x_xx_xx, such as boost_1_41_0. So your boost folder is /home/me/programs/boost_x_xx_xx, now.
  • The second and the final step is to download and extract mtl4. Go to http://www.osl.iu.edu/research/mtl/mtl4/download.php3, choose the latest version and download it to, for example, /home/me/programs. Extract it. Now your mtl folder would be /home/me/programs/mtl4.

Now it’s time to use the mtl library. You can include whatever you want like this:

#include <boost/numeric/mtl/mtl.hpp>

And compile your program like this (suppose you are using the GNU C++ compiler):

g++ -I/home/me/programs/mtl4 -I/home/me/programs/boost_x_xx_xx -O2 vector1.cpp -o vector1

Please refer to http://www.osl.iu.edu/research/mtl/mtl4/doc/vector_def.html to see a detail Hello World program.

If you don’t like to include the boost path every time you compile your program, then you can install it as a binary library on your machine. You can always check the offical Boost Get Started. And here is a instruction about installing boost on Gentoo and Debian/Ubuntu: Installing C++ Boost on Gentoo and Debian/Ubuntu.

ATLAS installation memo

January 5th, 2010

Tried to install ATLAS 3.9.20 according to the instruction: doc/atlas_install.pdf.

As said, the simplest way is:

bunzip2 -c atlas3.9.x.tar.bz2 | tar xfm -    # create SRCdir
mv ATLAS ATLAS3.9.x                            # get unique dir name
cd ATLAS3.9.x                                       # enter SRCdir
mkdir Linux_C2D64SSE3                         # create BLDdir
cd Linux_C2D64SSE3                              # enter BLDdir
../configure -b 64 -D c -DPentiumCPS=2400 # configure command
–prefix=/home/whaley/lib/atlas          # install dir
–with-netlib-lapack-tarfile=/home/whaley/dload/lapack.tgz
make build                                     # tune & build lib
make check                                    # sanity check correct answer
make time                                      # check if lib is fast
make install                                   # copy libs to install dir

There are some things to be noticed:

  • remember to change the options for configure. For example, your CPU info can be found out by $cat /proc/cpuinfo;
  • make sure fort77 is installed;
  • make sure gfortran is installed otherwise an error “gcc: error trying to exec ‘f951′: execvp: No such file or directorygcc” would be reported.