为了获得对ATLAS/LAPACK例程的支持,我试图编译numpy v1.12。
问题
我用于编译的设置似乎无法将ATLAS/LAPACK库引入numpy。
安装程序
在我正在处理的主机(计算集群)上,我没有管理权限。
但是,节点通过GNU模块提供对gcc 4.7.2和5.3.0、glibc 2.17和2.22以及ATLAS/LAPACK库和头v3.10.2的访问。
出于兼容性原因,我正在使用一个包含Python2.7.16的虚拟环境。同样,出于同样的原因,我正在安装一个旧版本的numpy。如果一切顺利,我可能会探索更新版本的numpy,但此时,这正是我正在使用的。
我的numpy源目录有一个名为site.cfg的配置文件,其中包括以下指令:
[ALL]
library_dirs = /usr/local/lib:/net/module/sw/glibc/2.22/lib64:/net/module/sw/atlas-lapack/3.10.2/lib
include_dirs = /usr/local/include:/net/module/sw/glibc/2.22/include:/net/module/sw/atlas-lapack/3.10.2/include
[atlas]
libraries = lapack,f77blas,cblas,atlas
library_dirs = /net/module/sw/atlas-lapack/3.10.2/lib
include_dirs = /net/module/sw/atlas-lapack/3.10.2/include我正在通过以下命令编译numpy:
$ CFLAGS="${CFLAGS} -std=c99 -fPIC" LDFLAGS="-L/home/areynolds/.conda/envs/genotyping_environment/lib -Wl,-rpath=/home/areynolds/.conda/envs/genotyping_environment/lib -Wl,--no-as-needed -Wl,--sysroot=/,-L/net/module/sw/glibc/2.22/lib64" python setup.py build --fcompiler=gnu95我使用--fcompiler=gnu95作为用GNU编译的ATLAS/LAPACK库。我正在重写CFLAGS和LDFLAGS变量,以便GCC工具包能够正确编译和链接。
问题
编译后,我对numpy库进行测试,以查看通过一种方法安装了什么:
$ python
...
>>> import numpy.distutils.system_info as sysinfo
>>> sysinfo.get_info('atlas')
ATLAS version 3.10.2 built by root on Wed Jun 1 15:39:08 PDT 2016:
UNAME : Linux module0.altiusinstitute.org 3.10.0-327.10.1.el7.x86_64 #1 SMP Tue Feb 16 17:03:50 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
INSTFLG : -1 0 -a 1 -l 1
ARCHDEFS : -DATL_OS_Linux -DATL_ARCH_UNKNOWNx86 -DATL_CPUMHZ=2876 -DATL_AVXMAC -DATL_AVX -DATL_SSE3 -DATL_SSE2 -DATL_SSE1 -DATL_USE64BITS -DATL_GAS_x8664
F2CDEFS : -DAdd_ -DF77_INTEGER=int -DStringSunStyle
CACHEEDGE: 229376
F77 : /net/module/sw/gcc/5.3.0/bin/gfortran, version GNU Fortran (GCC) 5.3.0
F77FLAGS : -O -mavx2 -mfma -m64 -fPIC
SMC : /usr/bin/x86_64-redhat-linux-gcc, version x86_64-redhat-linux-gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-4)
SMCFLAGS : -O -fomit-frame-pointer -mavx2 -mfma -m64 -fPIC
SKC : /usr/bin/x86_64-redhat-linux-gcc, version x86_64-redhat-linux-gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-4)
SKCFLAGS : -O -fomit-frame-pointer -mavx2 -mfma -m64 -fPIC
{'libraries': ['lapack', 'f77blas', 'cblas', 'atlas', 'f77blas', 'cblas'], 'library_dirs': ['/net/module/sw/atlas-lapack/3.10.2/lib'], 'define_macros': [('ATLAS_INFO', '"\\"3.10.2\\""')], 'language': 'f77', 'include_dirs': ['/net/module/sw/atlas-lapack/3.10.2/include']}看上去还好吧?
但是当我通过另一种方法检查时,我得到了一个不同的答案:
>>> np.show_config()
lapack_opt_info:
libraries = ['openblas', 'openblas']
library_dirs = ['/usr/local/lib']
define_macros = [('HAVE_CBLAS', None)]
language = c
blas_opt_info:
libraries = ['openblas', 'openblas']
library_dirs = ['/usr/local/lib']
define_macros = [('HAVE_CBLAS', None)]
language = c
openblas_info:
libraries = ['openblas', 'openblas']
library_dirs = ['/usr/local/lib']
define_macros = [('HAVE_CBLAS', None)]
language = c
blis_info:
NOT AVAILABLE
openblas_lapack_info:
libraries = ['openblas', 'openblas']
library_dirs = ['/usr/local/lib']
define_macros = [('HAVE_CBLAS', None)]
language = c
lapack_mkl_info:
NOT AVAILABLE
blas_mkl_info:
NOT AVAILABLE尽管在site.cfg中描述了手动设置,但没有提到ATLAS,LAPACK显然也没有指向正确的模块目录(/net/module/sw/atlas-lapack/3.10.2)。
我如何正确地将对ATLAS/LAPACK的支持编译成numpy,或者真正地测试我是否有一个集成到numpy中的工作ATLAS/LAPACK设置,这给了我一个一致(且可靠)的答案?
发布于 2019-11-18 18:11:06
我是用numpy 1.11.1 (这意味着我的回答在你的情况下可能不是100%的准确)做的,下面的收件如下:
export ATLAS=<folder with the atlas/lapack libraries>
export LAPACK=$ATLAS
cat > site.cfg <<EOF
[atlas]
atlas_libs = lapack, f77blas, cblas, atlas
EOF
python setup.py bdist_wheelhttps://stackoverflow.com/questions/57169862
复制相似问题