为numpy构建指向ATLAS/BLAS/LAPACK库的正确方法?

时间:2021-11-06 22:44:52

I'm building numpy from source on CentOS 6.5 with no root access (python -V=2.7.6). I have the latest numpy source from git. I cannot for the life of me get numpy to acknowledge atlas libs. I have:

我在CentOS 6.5上构建numpy,没有根访问(python -V=2.7.6)。我有来自git的最新的numpy源代码。我无法让我的生活变得麻木,承认阿特拉斯·利布斯。我有:

ls -1 /usr/lib64/atlas

libatlas.so.3
libatlas.so.3.0
libcblas.so.3
libcblas.so.3.0
libclapack.so.3
libclapack.so.3.0
libf77blas.so.3
libf77blas.so.3.0
liblapack.so.3
liblapack.so.3.0
libptcblas.so.3
libptcblas.so.3.0
libptf77blas.so.3
libptf77blas.so.3.0

I don't know anything about how these libs came about, but I can only assume that the atlas builds would be faster than any standard BLAS/LAPACK builds I could make.

我不知道这些libs是如何产生的,但是我只能假设atlas构建的速度会比任何标准的BLAS/LAPACK构建更快。

What is the correct way to point numpy to these libraries? Do I export ATLAS, BLAS, LAPACK=... setting each to its corresponding path? or do I edit a site.cfg file to contain something like:

将numpy指向这些库的正确方法是什么?我出口ATLAS, BLAS, LAPACK=…将它们设置为对应的路径?或者我编辑一个网站。cfg文件包含如下内容:

[default]
library_dirs = /usr/lib64/atlas

[atlas]
library_dirs = /usr/lib64/atlas
atlas_libs = lapack, cblas, f77blas, atlas

I've tried just about every variation of the above, and each time I run python setup.py config it tells me each library cannot be found in the paths I specify as well as a bunch of other default search paths. I've pasted the results of running python setup.py config with the site.cfg as above and no environment variables set here: http://pastebin.com/EL9CfaR7. Any help is appreciated.

我已经尝试了上面的每一个变体,并且每次运行python设置。py配置告诉我,在我指定的路径中不能找到每个库,以及其他一些默认的搜索路径。我已经粘贴了运行python设置的结果。py配置与站点。如上所述,没有环境变量:http://pastebin.com/EL9CfaR7。任何帮助都是感激。

1 个解决方案

#1


7  

Ok this was pretty simple and essentially follows the install guidelines exactly. I suppose this is more of a question on the numberings after shared libs than about numpy or atlas. Anyway, I just had to create some symlinks:

这很简单,基本上遵循了安装指南。我想这更多的是关于共享的libs之后的数字,而不是numpy或atlas。不管怎样,我只需要创建一些符号链接:

ln -s /usr/lib64/atlas/___.so.3.0 $HOME/local/lib/___.so

Then removed all configs in the site.cfg and updated my .bashrc:

然后删除站点中的所有configs。cfg并更新了我的。bashrc:

export ATLAS=$HOME/local/lib/libatlas.so
export BLAS=$HOME/local/lib/libptf77blas.so
export LAPACK=$HOME/local/lib/liblapack.so

After running python setup.py install, I'm good:

在运行python设置。py安装,我好:

>>> import numpy.distutils.system_info as si
>>> si.get_info('atlas')
    ATLAS version 3.8.4 built by mockbuild on Wed Mar 21 01:43:44 GMT 2012:
   UNAME    : Linux c6b6.bsys.dev.centos.org 2.6.32-44.2.el6.x86_64 #1 SMP Wed Jul 21 12:48:32 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
   INSTFLG  : -1 0 -a 1
   ARCHDEFS : -DATL_OS_Linux -DATL_ARCH_PII -DATL_CPUMHZ=2261 -DATL_SSE2 -DATL_SSE1 -DATL_USE64BITS -DATL_GAS_x8664
   F2CDEFS  : -DAdd_ -DF77_INTEGER=int -DStringSunStyle
   CACHEEDGE: 163840
   F77      : gfortran, version GNU Fortran (GCC) 4.4.6 20110731 (Red Hat 4.4.6-3)
   F77FLAGS : -fomit-frame-pointer -mfpmath=387 -O2 -falign-loops=4 -g -Wa,--noexecstack -fPIC -m64
   SMC      : gcc, version gcc (GCC) 4.4.6 20110731 (Red Hat 4.4.6-3)
   SMCFLAGS : -fomit-frame-pointer -mfpmath=387 -O2 -falign-loops=4 -g -Wa,--noexecstack -fPIC -m64
   SKC      : gcc, version gcc (GCC) 4.4.6 20110731 (Red Hat 4.4.6-3)
   SKCFLAGS : -fomit-frame-pointer -mfpmath=387 -O2 -falign-loops=4 -g -Wa,--noexecstack -fPIC -m64
{'libraries': ['lapack', 'f77blas', 'cblas', 'atlas'], 'library_dirs': ['~/local/lib'], 'define_macros': [('ATLAS_INFO', '"\\"3.8.4\\""')], 'language': 'f77'}

#1


7  

Ok this was pretty simple and essentially follows the install guidelines exactly. I suppose this is more of a question on the numberings after shared libs than about numpy or atlas. Anyway, I just had to create some symlinks:

这很简单,基本上遵循了安装指南。我想这更多的是关于共享的libs之后的数字,而不是numpy或atlas。不管怎样,我只需要创建一些符号链接:

ln -s /usr/lib64/atlas/___.so.3.0 $HOME/local/lib/___.so

Then removed all configs in the site.cfg and updated my .bashrc:

然后删除站点中的所有configs。cfg并更新了我的。bashrc:

export ATLAS=$HOME/local/lib/libatlas.so
export BLAS=$HOME/local/lib/libptf77blas.so
export LAPACK=$HOME/local/lib/liblapack.so

After running python setup.py install, I'm good:

在运行python设置。py安装,我好:

>>> import numpy.distutils.system_info as si
>>> si.get_info('atlas')
    ATLAS version 3.8.4 built by mockbuild on Wed Mar 21 01:43:44 GMT 2012:
   UNAME    : Linux c6b6.bsys.dev.centos.org 2.6.32-44.2.el6.x86_64 #1 SMP Wed Jul 21 12:48:32 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
   INSTFLG  : -1 0 -a 1
   ARCHDEFS : -DATL_OS_Linux -DATL_ARCH_PII -DATL_CPUMHZ=2261 -DATL_SSE2 -DATL_SSE1 -DATL_USE64BITS -DATL_GAS_x8664
   F2CDEFS  : -DAdd_ -DF77_INTEGER=int -DStringSunStyle
   CACHEEDGE: 163840
   F77      : gfortran, version GNU Fortran (GCC) 4.4.6 20110731 (Red Hat 4.4.6-3)
   F77FLAGS : -fomit-frame-pointer -mfpmath=387 -O2 -falign-loops=4 -g -Wa,--noexecstack -fPIC -m64
   SMC      : gcc, version gcc (GCC) 4.4.6 20110731 (Red Hat 4.4.6-3)
   SMCFLAGS : -fomit-frame-pointer -mfpmath=387 -O2 -falign-loops=4 -g -Wa,--noexecstack -fPIC -m64
   SKC      : gcc, version gcc (GCC) 4.4.6 20110731 (Red Hat 4.4.6-3)
   SKCFLAGS : -fomit-frame-pointer -mfpmath=387 -O2 -falign-loops=4 -g -Wa,--noexecstack -fPIC -m64
{'libraries': ['lapack', 'f77blas', 'cblas', 'atlas'], 'library_dirs': ['~/local/lib'], 'define_macros': [('ATLAS_INFO', '"\\"3.8.4\\""')], 'language': 'f77'}