python - 不确定我的 Python/numpy 版本是否使用优化的 BLAS/LAPACK 库?

标签 python numpy anaconda lapack blas

我读到here “确保 numpy 在您的系统上使用 BLAS/LAPACK 库的优化版本”非常重要。

当我输入:

import numpy as np
np.__config__.show()

我得到以下结果:

blas_mkl_info:
  NOT AVAILABLE
blis_info:
  NOT AVAILABLE
openblas_info:
    libraries = ['openblas', 'openblas']
    library_dirs = ['/home/anaconda3/lib']
    language = c
    define_macros = [('HAVE_CBLAS', None)]
blas_opt_info:
    libraries = ['openblas', 'openblas']
    library_dirs = ['/home/anaconda3/lib']
    language = c
    define_macros = [('HAVE_CBLAS', None)]
lapack_mkl_info:
  NOT AVAILABLE
openblas_lapack_info:
    libraries = ['openblas', 'openblas']
    library_dirs = ['/home/anaconda3/lib']
    language = c
    define_macros = [('HAVE_CBLAS', None)]
lapack_opt_info:
    libraries = ['openblas', 'openblas']
    library_dirs = ['/home/anaconda3/lib']
    language = c
    define_macros = [('HAVE_CBLAS', None)]

这是否意味着我的 numpy 版本正在使用优化的 BLAS/LAPACK 库,如果不是,我如何设置 numpy 以便它使用优化版本?

最佳答案

有点。 OpenBLAS 还不错。我刚刚获取了第一个链接,我可以在 google 上找到该链接,寻找“OpenBLAS、ATLAS、MKL 比较”。

http://markus-beuckelmann.de/blog/boosting-numpy-blas.html

现在,这还不是故事的全部。根据您需要的算法,差异可能不会/略有/很大不同。除了运行针对不同实现链接的您自己的代码之外,实际上没有什么可做的。

平均而言,我最喜欢的各种线性代数问题、SVD、Eigs、实数和伪反转、因式分解...不同操作系统上的单核/多核:

MacOS:加速框架(随操作系统一起提供) Linux/Windows:

  1. MKL
  2. 距离很远,但仍然安静:ATLAS 和 OpenBLAS 不相上下
  3. 即使在 AMD 处理器上,ACML 也始终令我失望

TLDR:您的设置很好。但如果你想榨干你的 CPU/RAM/主板组合的最后一滴血,你需要 MKL。当然,它的价格相当高,但如果你能得到一半价格的硬件作为返回,也许是值得的。如果您编写开源包,则可以免费使用 MKL 进行开发。

关于python - 不确定我的 Python/numpy 版本是否使用优化的 BLAS/LAPACK 库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55161366/

相关文章:

python - 有时在新的 oAuth 握手后从 intuit anywhere api 获取 "API requires authorization"

Python - 有什么方法可以在子函数中组织一组 yield 以在 main 函数之外产生?

python - 从 CSV 导入 Numpy 并将列转换为 float

python - 为什么 pandas 使用 numpy 中的 "NaN",而不是自己的 null 值?

windows - 在 Anaconda Powershell 中只获取 IP 地址

python - 无法使用 Anaconda Python Stack 在 Windows 上导入 MySQLdb

Python 相当于 Matlab addpath

Python - 如何使用 fnmatch 匹配目录

python - 使用 2D 滤波器卷积 3D 图像

python - PyCharm 中的 WSL Conda 环境