Hi, I'm trying to compile numpy for python 3.4 with Intel MKL on Mac OS X. In this process I have solved many problems myself, but I'm stuck on this one:
icc -m64 -O3 -g -fPIC -fp-model strict -fomit-frame-pointer -openmp -xhost -dynamiclib -L/opt/intel/lib/intel64 -L/opt/intel/lib -L/usr/local/Cellar/python3/3.4.1/Frameworks/Python.framework/Versions/3.4/lib -lpython3.4 build/temp.macosx-10.9-x86_64-3.4/numpy/linalg/lapack_litemodule.o build/temp.macosx-10.9-x86_64-3.4/numpy/linalg/lapack_lite/python_xerbla.o -L/opt/intel/mkl/lib -Lbuild/temp.macosx-10.9-x86_64-3.4 -lmkl_lapack -lmkl_rt -lpthread -o build/lib.macosx-10.9-x86_64-3.4/numpy/linalg/lapack_lite.so
ld: library not found for -lmkl_lapack
ld: library not found for -lmkl_lapack
So the question is, what directory do I need to add for the above to work. This is what I have in my mkl/lib directory:
pwd # /opt/intel/composer_xe_2013_sp1.1.103/mkl/lib
ls #
libmkl_avx.dylib libmkl_intel_ilp64.dylib libmkl_mc.dylib libmkl_vml_avx2.dylib
libmkl_avx2.dylib libmkl_intel_lp64.a libmkl_mc3.dylib libmkl_vml_mc.dylib
libmkl_blas95.a libmkl_intel_lp64.dylib libmkl_p4m.dylib libmkl_vml_mc2.dylib
libmkl_blas95_ilp64.a libmkl_intel_sp2dp.a libmkl_p4m3.dylib libmkl_vml_mc3.dylib
libmkl_blas95_lp64.a libmkl_intel_sp2dp.dylib libmkl_p4p.dylib libmkl_vml_p4m.dylib
libmkl_core.a libmkl_intel_thread.a libmkl_pgi_thread.a libmkl_vml_p4m2.dylib
libmkl_core.dylib libmkl_intel_thread.dylib libmkl_rt.dylib libmkl_vml_p4m3.dylib
libmkl_intel.a libmkl_lapack95.a libmkl_sequential.a libmkl_vml_p4p.dylib
libmkl_intel.dylib libmkl_lapack95_ilp64.a libmkl_sequential.dylib locale
libmkl_intel_ilp64.a libmkl_lapack95_lp64.a libmkl_vml_avx.dylib
The above comes from installation of Intel Composer XE 2013 SP 1.1.103
Please note that I can't use the -mkl flag since that does too much.
I can consistently reproduce this by execution this script:
wget https://pypi.python.org/packages/source/n/numpy/numpy-1.8.1.tar.gz#md5=be95babe263bfa3428363d6db5b64678
tar -xf numpy-1.8.1.tar.gz
cd numpy-1.8.1
cat > site.cfg <<EOF
[mkl]
library_dirs = /opt/intel/lib/intel64:/opt/intel/lib:/opt/intel/mkl/lib
include_dirs = /opt/intel/include:/opt/intel/include/intel64:/opt/intel/mkl/include
mkl_libs = mkl_rt
lapack_libs = mkl_lapack
EOF
export PYLINK="import sys; import os; print('-L' + os.path.abspath(os.__file__ + '/../..') + ' -lpython3.' + str(sys.version_info[1]))"
patch numpy/distutils/intelccompiler.py <<EOF
--- intelccompiler_old.py 2014-07-04 19:27:02.000000000 +0200
+++ intelccompiler.py 2014-07-04 19:27:46.000000000 +0200
@@ -36,10 +36,10 @@
cc_args = "-fPIC"
def __init__ (self, verbose=0, dry_run=0, force=0):
UnixCCompiler.__init__ (self, verbose, dry_run, force)
- self.cc_exe = 'icc -m64 -fPIC'
+ self.cc_exe = 'icc -m64 -O3 -g -fPIC -fp-model strict -fomit-frame-pointer -openmp -xhost'
compiler = self.cc_exe
self.set_executables(compiler=compiler,
compiler_so=compiler,
compiler_cxx=compiler,
linker_exe=compiler,
- linker_so=compiler + ' -shared')
+ linker_so=compiler + ' -dynamiclib $(python3 -c $PYLINK)')
EOF
python3 setup.py config --compiler=intelem
python3 setup.py build --compiler=intelem
python3 setup.py install