在Linux上从源代码构建

您所在的位置:网站首页 numpy源代码是 在Linux上从源代码构建

在Linux上从源代码构建

2023-10-13 09:02| 来源: 网络整理| 查看: 265

英特尔MKL 11.0(2012年12月更新)¶

考虑到Linux上与英特尔®Composer XE SP1版本捆绑在一起的英特尔®MKL的默认安装路径,将以下行添加到顶级NumPy目录中的site.cfg,以使用用于英特尔®64(或更早的em64T)体系结构的英特尔®MKL:

[mkl] library_dirs = /opt/intel/composer_xe_2013/mkl/lib/intel64 include_dirs = /opt/intel/composer_xe_2013/mkl/include mkl_libs = mkl_intel_lp64,mkl_intel_thread,mkl_core

如果您正在构建32位的NumPy,请添加如下内容

[mkl] library_dirs = /opt/intel/composer_xe_2013/mkl/lib/ia32 include_dirs = /opt/intel/composer_xe_2013/mkl/include mkl_libs = mkl_intel,mkl_intel_thread,mkl_core

除了上述英特尔®MKL的分层链接方法,您还可以使用动态接口库mkl_rt.lib。因此,对于ia32和intel64体系结构,进行如下更改

mkl_libs = mkl_rt

将numpy/numpy/distutils/intelcpiler.py中的cc_exe修改为如下所示:

cc_exe = 'icc -O2 -g -openmp -avx'

这里,我们使用基于英特尔®沙桥架构(-AVX)的英特尔®至强E5或E3系列的默认优化(-O2)、OpenMP线程(-openmp)和英特尔®AVX优化。有关特定于处理器的选项的详细信息,请运行ICC--help。

使用英特尔编译器编译并安装NumPy(在64位平台上,将“intel”替换为“intelem”):

python setup.py config --compiler=intel build_clib --compiler=intel build_ext --compiler=intel install

使用英特尔编译器编译并安装SciPy(在64位平台上,将“intel”替换为“intelem”):

python setup.py config --compiler=intel --fcompiler=intel build_clib --compiler=intel --fcompiler=intel build_ext --compiler=intel --fcompiler=intel install

您必须将LD_LIBRARY_PATH设置为英特尔®MKL库(精确值取决于您的体系结构、编译器和库版本)和OpenMP库,NumPy才能工作。如果您为英特尔®64平台构建NumPy:

$export LD_LIBRARY_PATH=/opt/intel/composer_xe_2013/mkl/lib/intel64: /opt/intel/composer_xe_2013/compiler/lib/intel64:$LD_LIBRARY_PATH

如果为ia32位平台构建NumPy:

$export LD_LIBRARY_PATH=/opt/intel/composer_xe_2013/mkl/lib/ia32: /opt/intel/composer_xe_2013/compiler/lib/ia32:$LD_LIBRARY_PATH


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3