armadillo C++ matrix library -- how to enable use of ATLAS or LAPACK?

Andre Zege picture Andre Zege · Mar 25, 2012 · Viewed 7.5k times · Source

When i compile example2.cpp with armadillo makefile and run it i am getting an error message

error: det(): use of ATLAS or LAPACK needs to be enabled

How do i fix that? I have similar errors when i try to use solve. Details of my setup are:

  • Ubuntu Lucid Lynx 10.04
  • Armadillo version: 2.4.2 (Loco Lounge Lizard)
  • ATLAS 3.9.51
  • BOOST 1.48.0
  • g++ (Ubuntu 4.4.3-4ubuntu5.1) 4.4.3

Atlas was installed before armadillo was, armadillo installation was configured with Cmake. I am far from an expert in cmake, but i thought that it was supposed to find ATLAS when i generated makefiles with it. Armadillo documentation seem to say that if i install with cmake i don't need to do any manual enabling of ATLAS. I tried to manually hack example2.cpp by inserting

#define ARMA_USE_ATLAS

before the headers, but it just generates a bunch of errors regarding missing stuff on Cblas. Maybe there is a step missing to allow cmake to find ATLAS. It feels i am missing something simple but key. Any help would be greatly appreciated.

Additional Detail:

Edit: for whatever reason i cannot add comment anymore, so i am posting a reply to @Appleman1234 answer below here.

I compiled armadillo and ATLAS from source. I thought that ATLAS has LAPACK and BLAS bundled in and optimized. When i compiled it, i passed a location to lapack tar like

./configure --shared --with-netlib-lapack-tarfile=/<path>/lapack-3.3.1.tgz

I also see in atlas lib directory the following files:

libatlas.a, libcblas.a, libf77blas.a, liblapack.a, libptcblas.a, libptf77blas.a libsatlas.so, libtatlas.so

which seem to indicate that blas, cblas, and lapack are installed on the system. However, CMakeCache.txt in armadillo seem to indicate that cmake didn't find BLAS, CBLAS, CLAPACK as follows

BLAS_LIBRARY:FILEPATH=BLAS_LIBRARY-NOTFOUND

There is no notion of ATLAS in CMakeCache.txt, so i assume that it wasn't found either. Maybe i am mistaken, but it seems that i somehow need to point cmake to ATLAS, i just don't know how. I could also be at error assuming that ATLAS has BLAS, LAPACK and CBLAS. I thought i compiled them as a part of ATLAS, but i could be wrong. Would appreciate your comments.

Solution to the problem:

What Dirk suggested almost worked. The problem as i mentioned in one of the replies to his post was cmake was balking. I misdiagnosed that as a problem with cmake not finding clapack. In fact, after looking more carefully at cmake output i realised it had problems with not finding good compiler or rather dragging its feet when it decided to use as compiler /usr/bin/c++. So i did CXX=g++ and then cmake again which worked fine. After that armadillo compiled fine.

Answer

Appleman1234 picture Appleman1234 · Mar 25, 2012

Did you install armadillo from source ?

What did cmake output when running cmake . or ./configure ?

The latter just calls cmake ..

Did it output the values below ?

-- CLAPACK_FOUND  = YES
-- CBLAS_FOUND    = YES

If they are not YES, then according to CMakeLists.txt, ARMA_USE_ATLAS is set to false and ATLAS isn't used.

In order to use det or solve, install CLAPACK and CBLAS if you want to use ATLAS or just install LAPACK.