本文介绍了犰狳C ++矩阵库-如何启用ATLAS或LAPACK?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用armadillo makefile编译example2.cpp并运行它时,我收到一条错误消息

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版本: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是在armadillo之前安装的,而armadillo的安装是使用Cmake配置的.我距离cmake专家还很远,但是我认为当我用它生成makefile时,它应该可以找到ATLAS. Armadillo文档似乎说,如果我使用cmake进行安装,则无需手动启用ATLAS.我试图通过插入来手动破解example2.cpp

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

在头文件之前,但是它只会产生一系列有关Cblas上缺少内容的错误.也许缺少允许cmake查找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.

无论出于何种原因,我都无法添加评论,因此我在此处发布了对@ Appleman1234答案的回复.

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

我从源头上汇编了犰狳和ATLAS.我以为ATLAS将LAPACK和BLAS捆绑在一起并进行了优化.当我编译它时,我将一个位置传递给了

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

我还在atlas lib目录中看到以下文件:

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

似乎表明blas,cblas和lapack已安装在系统上.但是,犰狳中的CMakeCache.txt似乎表明cmake找不到如下的BLAS,CBLAS,CLAPACK

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

在CMakeCache.txt中没有ATLAS的概念,所以我认为也没有找到ATLAS的概念.也许我弄错了,但似乎我需要以某种方式将cmake指向ATLAS,我只是不知道该怎么做.假设ATLAS具有BLAS,LAPACK和CBLAS,我也可能会出错.我以为我将它们编译为ATLAS的一部分,但我可能是错的.感谢您的评论.

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.

德克的建议几乎奏效了.正如我在对他职位的答复之一中提到的那样,问题是cmake陷入困境.我误诊为cmake找不到clapack的问题.实际上,在更仔细地查看cmake输出后,我意识到在决定用作/usr/bin/c ++编译器时,它没有找到好的编译器,或者拖了它的脚而遇到了问题.所以我做了CXX = g ++,然后再次做cmake,效果很好.之后,犰狳编译良好.

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.

推荐答案

您是否从源代码安装了犰狳?

Did you install armadillo from source ?

运行cmake ../configure时cmake输出什么?

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

后者只是调用cmake ..

它是否输出以下值?

-- CLAPACK_FOUND  = YES
-- CBLAS_FOUND    = YES

如果不是,则根据CMakeLists.txt,ARMA_USE_ATLAS设置为false,并且不使用ATLAS.

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

为了使用detsolve,如果要使用ATLAS或仅安装LAPACK,请安装CLAPACK和CBLAS.

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

这篇关于犰狳C ++矩阵库-如何启用ATLAS或LAPACK?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-22 04:01