本文介绍了如何在Ubuntu中使NumPy使用OpenBlas?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我同时安装了BLAS和OpenBLAS:

I have both BLAS and OpenBLAS installed:

$ dpkg -l \*blas\* | grep ^i
ii  libblas-dev                                           1.2.20110419-7                                      amd64        Basic Linear Algebra Subroutines 3, static library
ii  libblas3                                              1.2.20110419-7                                      amd64        Basic Linear Algebra Reference implementations, shared library
ii  libopenblas-base                                      0.2.8-6ubuntu1                                      amd64        Optimized BLAS (linear algebra) library based on GotoBLAS2
ii  libopenblas-dev                                       0.2.8-6ubuntu1                                      amd64        Optimized BLAS (linear algebra) library based on GotoBLAS2

但是,NumPy仍然说OpenBLAS不可用:

However, NumPy still says that OpenBLAS is not available:

>> np.__config__.show()
blas_info:
    libraries = ['blas']
    library_dirs = ['/usr/lib']
    language = f77
lapack_info:
    libraries = ['lapack']
    library_dirs = ['/usr/lib']
    language = f77
atlas_threads_info:
  NOT AVAILABLE
blas_opt_info:
    libraries = ['blas']
    library_dirs = ['/usr/lib']
    language = f77
    define_macros = [('NO_ATLAS_INFO', 1)]
atlas_blas_threads_info:
  NOT AVAILABLE
openblas_info:
  NOT AVAILABLE
lapack_opt_info:
    libraries = ['lapack', 'blas']
    library_dirs = ['/usr/lib']
    language = f77
    define_macros = [('NO_ATLAS_INFO', 1)]
atlas_info:
  NOT AVAILABLE
lapack_mkl_info:
  NOT AVAILABLE
blas_mkl_info:
  NOT AVAILABLE
atlas_blas_info:
  NOT AVAILABLE
mkl_info:
  NOT AVAILABLE

我该如何解决?

我不认为我可以卸载libblas3,因为很多东西都依赖于它,包括libblas-dev,甚至连libopenblas-dev都依赖于它.

I don't think I can just uninstall libblas3, beacuse many things depend on it, including libblas-dev, on which even libopenblas-dev depends.

我尝试了

$ sudo apt-get install --reinstall python-numpy

但这没有帮助.

这尤其令人惊讶,因为numpy中的所有*.so文件都链接到OpenBLAS:

This is especially surprising, because all of the *.so files in numpy link to OpenBLAS:

$ ldd `find /usr/lib/python2.7/dist-packages/numpy -name \*\.so` | grep libblas
        libblas.so.3 => /usr/lib/libblas.so.3 (0x00007fba2ac96000)
        libblas.so.3 => /usr/lib/libblas.so.3 (0x00007f04f7f54000)
        libblas.so.3 => /usr/lib/libblas.so.3 (0x00007f9a941a9000)

$ ls -l /usr/lib/libblas.so.3 /etc/alternatives/libblas.so.3
lrwxrwxrwx 1 root root 35 Oct 22  2014 /etc/alternatives/libblas.so.3 -> /usr/lib/openblas-base/libblas.so.3
lrwxrwxrwx 1 root root 30 Oct  6  2014 /usr/lib/libblas.so.3 -> /etc/alternatives/libblas.so.3

推荐答案

基于ldd输出,NumPy必须已经与OpenBLAS链接.它只是不知道,因为它是通过/usr/lib/libblas*链接的,它被视为通用BLAS.

Based on the ldd output, NumPy must already be linked with OpenBLAS. It just doesn't know it, because it's linked via /usr/lib/libblas*, which it sees as generic BLAS.

这篇关于如何在Ubuntu中使NumPy使用OpenBlas?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 06:10