安装BLAS-3.7.0软件包

时间:2017-03-15 06:14:19

标签: fortran gfortran undefined-reference blas

我是Linux新手,因此我尝试在Oracle VirtualBox上设置虚拟机以使用Ubuntu 14.04 -32bit版本。我从http://www.netlib.org/blas/下载了BLAS-3.7.0软件包并通过首先使用gfortran编译所有.f文件来安装它:

    gfortran -c *.f

然后创建一个包含所有已编译文件的共享库:

    sudo gfortran -shared -fPIC  -o libblas.so *.o 

当我用

检查共享库时
    nm -u libblas.so

它返回了一个未定义的引用列表,如:

     U cabsf@@GLIBC_2.1
     U cabs@@GLIBC_2.1
     w __cxa_finalize
     U _gfortran_stop_string@@GFORTRAN_1.0
     U _gfortran_string_len_trim@@GFORTRAN_1.0
     U _gfortran_st_write_done@@GFORTRAN_1.0
     U _gfortran_st_write@@GFORTRAN_1.0
     U _gfortran_transfer_character_write@@GFORTRAN_1.4
     U _gfortran_transfer_integer_write@@GFORTRAN_1.4
     w __gmon_start__
     w _ITM_deregisterTMCloneTable
     w _ITM_registerTMCloneTable
     w _Jv_RegisterClasses
     U sqrtf@@GLIBC_2.0
     U sqrt@@GLIBC_2.0

然后我尝试添加glibc和gfortran库的数学库,就像-​​lm和-lgfortran的一些建议一样:

    sudo gfortran -L/usr/lib/i386-linux-gnu -L/usr/lib/gcc/i686-linux-gnu/4.8 -shared -fPIC  -o libblas.so *.o -lm -lgfortran

但同样的错误会返回。

如果有人可以帮助我指出我的共享库的问题,我将非常感激。我需要BLAS和LAPACK包来安装GPAW仿真库(https://wiki.fysik.dtu.dk/gpaw/),但是由于未链接的引用,GPAW总是发送回错误消息,同时链接BLAS和LAPACK共享库。

编辑:********* 对于GPAW-1.2.0,我通过修改setup.py文件中的extra_link_args使用BLAS-3.7.0,lapack-3.7.0和libxc-3.0.0的静态库安装它:

    extra_link_args ['/usr/local/lib/xc/lib/libxc.a', '/usr/local/lib/BLAS-3.7.0/libblas.a', '/usr/local/lib/lapack-3.7.0/liblapack.a']

安装GPAW后我的configuration.log文件如下所示:

    libraries []
    library_dirs []
    include_dirs ['/usr/local/lib/xc/include', '/usr/lib/python2.7/dist-packages/numpy/core/include']
    define_macros [('NPY_NO_DEPRECATED_API', 7)]
    extra_link_args ['/usr/local/lib/xc/lib/libxc.a', '/usr/local/lib/BLAS- 3.7.0/libblas.a', '/usr/local/lib/lapack-3.7.0/liblapack.a']
    extra_compile_args ['-Wall', '-std=c99']
    runtime_library_dirs []
    extra_objects []

我还添加了库路径并将路径包含到LIBRARY_PATH和C_INCLUDE_PATH中:

    echo $C_INCLUDE_PATH 
    /usr/local/lib/xc/include/
    echo $LIBRARY_PATH 
    /usr/local/lib/BLAS-3.7.0:/usr/local/lib/lapack-3.7.0:/usr/local/lib/xc/lib
然后我用:

安装它
    sudo python setup.py install >&log.txt

当我尝试在gpaw / test文件夹中运行测试脚本时,或者只是输入" gpaw info"在终端窗口中,它返回了这个:

    OpenBLAS : Your OS does not support AVX instructions. OpenBLAS is     using Nehalem kernels as a fallback, which may give poorer performance.
    Traceback (most recent call last):
    File "/usr/local/bin/gpaw", line 2, in <module>
    from gpaw.cli.main import main
    File "/usr/local/lib/python2.7/dist-packages/gpaw/__init__.py", line 239, in <module>
    from gpaw.calculator import GPAW
    File "/usr/local/lib/python2.7/dist-packages/gpaw/calculator.py", line 11, in <module>
    import gpaw.mpi as mpi
    File "/usr/local/lib/python2.7/dist-packages/gpaw/mpi/__init__.py", line 16, in <module>
    from gpaw.utilities import is_contiguous
    File "/usr/local/lib/python2.7/dist-packages/gpaw/utilities/__init__.py", line 13, in <module>
    import _gpaw
   ImportError: /usr/local/lib/python2.7/dist-packages/_gpaw.so: undefined symbol: dnrm2_

我想openblas警告来自于我通过

在我的机器上安装numpy的事实
    sudo apt-get install python-numpy

但我没有在安装配置中选择openblas。

0 个答案:

没有答案