Pages

Wednesday, May 7, 2014

Building Numpy and Scipy with icc, ifort and Intel MKL

My rig .
OS : Ubuntu 12.04 64 bit
Numpy : 1.8.1
Scipy: 0.14
gcc: 4.6.3
icc/ifort: 14.0.2
Intel MKL: 11.1 update 2

Modified from https://software.intel.com/en-us/articles/numpyscipy-with-intel-mkl to get passed all test in Numpy and Scipy, using https://github.com/scipy/scipy/issues/1205

Edit intel.py from numpy/distutils/fcompiler/ to change optimization to O1
# snippet from numpy 1.8.1
class IntelEM64TFCompiler(IntelFCompiler):
compiler_type = 'intelem'
compiler_aliases = ()
description = 'Intel Fortran Compiler for 64-bit apps'
version_match = intel_version_match('EM64T-based|Intel\\(R\\) 64|64|IA-64|64-bit')
possible_executables = ['ifort', 'efort', 'efc']
executables = {
'version_cmd' : None,
'compiler_f77' : [None, "-FI"],
'compiler_fix' : [None, "-FI"],
'compiler_f90' : [None],
'linker_so' : ['<F90>', "-shared"],
'archiver' : ["ar", "-cr"],
'ranlib' : ["ranlib"]
}
def get_flags(self):
return ['-fPIC']
def get_flags_opt(self):
#return ['-i8 -xhost -openmp -fp-model strict']
return ['-xhost -O1 -openmp -fp-model strict -fPIC']
def get_flags_arch(self):
return []
view raw intel.py hosted with ❤ by GitHub
Compile and install Numpy using gcc:
python setup.py config build_clib build_ext -lstdc++ install

Compile and install Scipy using icc and ifort:
python setup.py config --compiler=intelem --fcompiler=intelem build_clib --compiler=intelem --fcompiler=intelem build_ext --compiler=intelem --fcompiler=intelem -lstdc++ install