numpy+mkl。
时间: 2024-05-26 10:08:20 浏览: 174
NumPy是一个用Python实现的科学计算包,包括:
- 一个强大的N维数组对象 ndarray
- 广播功能函数
- 整合 C/C++/Fortran 代码的工具
- 线性代数、傅里叶变换、随机数生成等功能
MKL(英特尔® 数学核心库)是一种高度优化的数学库,用于执行数值密集型操作,包括线性代数、矩阵运算、傅里叶变换和随机数生成等。
NumPy可以与MKL进行集成,从而在进行数值计算时获得更快的速度。
要启用NumPy MKL,请按照以下步骤操作:
1.安装Intel Math Kernel Library软件包
2.安装NumPy
3.运行以下代码,检查NumPy是否使用了MKL:
```python
import numpy as np
print(np.__config__.show())
```
如果看到类似下面这样的输出,就说明NumPy已经与MKL集成成功了:
```shell
mkl_info:
libraries = ['mkl_rt', 'pthread']
library_dirs = ['/path/to/mkl_rt/lib']
define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
include_dirs = ['/path/to/mkl_rt/include']
blas_mkl_info:
libraries = ['mkl_rt', 'pthread']
library_dirs = ['/path/to/mkl_rt/lib']
define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
include_dirs = ['/path/to/mkl_rt/include']
blas_opt_info:
libraries = ['mkl_rt', 'pthread']
library_dirs = ['/path/to/mkl_rt/lib']
define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
include_dirs = ['/path/to/mkl_rt/include']
lapack_mkl_info:
libraries = ['mkl_rt', 'pthread']
library_dirs = ['/path/to/mkl_rt/lib']
define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
include_dirs = ['/path/to/mkl_rt/include']
lapack_opt_info:
libraries = ['mkl_rt', 'pthread']
library_dirs = ['/path/to/mkl_rt/lib']
define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
include_dirs = ['/path/to/mkl_rt/include']
```