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

£可爱£侵袭症+ 提交于 2019-12-08 05:51:10

问题


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.


回答1:


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.




回答2:


As armadillo exists in Debian / Ubuntu, you could simply install all the known build-dependencies to ensure you have all the -dev packages you need:

edd@max:~$ sudo apt-get build-dep armadillo
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
edd@max:~$ 

Appears that my system in complete in that regard.



来源:https://stackoverflow.com/questions/9862251/armadillo-c-matrix-library-how-to-enable-use-of-atlas-or-lapack

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!