Question

I have been trying to install numpy-1.7.1 with MKL-10.3 on python-2.7.5 using gcc-4.7.2 on a linux-2.6.18-308.24.1.el5 system for a few days now. I have not long ago successfully compiled R-3.0.1 with MKL using the same compiler.

I modified the site.cfg file in numpy-1.7.1 as follows:

[mkl]
library_dirs = /sb/software/libraries/MKL/10.3/lib/intel64
include_dirs = /sb/software/libraries/MKL/10.3/include
mkl_libs = mkl_rt
lapack_libs =

When I call python setup.py install, it finds the MKL libraries for BLAS and LAPACK. Up until this point, there is no complaint or warning. It breaks down once I try to do something with numpy.

 $ python
 Python 2.7.5 (default, Jul 31 2013, 16:54:43)
 [GCC 4.7.2] on linux2
 Type "help", "copyright", "credits" or "license" for more information.
 >>> import numpy
 >>> numpy.test('full')
 Running unit tests for numpy
 NumPy version 1.7.1
 NumPy is installed in /sb/project/mjd-574/ndejay/modules/python-2.7.5/lib/python2.7/site-packages/numpy
 Python version 2.7.5 (default, Jul 31 2013, 16:54:43) [GCC 4.7.2]
 nose version 1.3.0
 .................python: symbol lookup error: /sb/software/libraries/MKL/10.3/lib/intel64/libmkl_intel_thread.so: undefined symbol: omp_get_num_procs

This appears to be a known issue (link to source) whereby libiomp5 is not loaded by libmkl_rt. When I add the path to libiomp5 to the library_dirs variable in site.cfg, numpy fails to detect all MKL libraries.

I have even tried the following to force gcc to use its own openMP libraries/headers, but to no avail.

CFLAGS='-fopenmp -lgomp' python setup.py install

I would be grateful for any sort of help or advice on this matter. Do not hesitate to let me know I have omitted critical information in this thread.

EDIT: I am running on a x86_64 platform.

Was it helpful?

Solution

Adding the path to libiomp5 to the LD_MODULES_PATH environment. The servers I am currently using use the modules library to manage server-wide applications and libraries. I had previously only used the standalone MKL/10.3 module but substituting that for ifort_icc/13.0 (which also contains MKL) added icc-related paths to the LD_MODULES_PATH. Using the same site.cfg as described above seems to work and numpy runs the test suite.

I don't know if this is the most elegant solution but it will do the trick for now.

OTHER TIPS

You need to add the path to libomp5: composer_xe_install_path/compiler/lib/intel64 to your LD_LIBRARY_PATH. For me the path looks like: /opt/apps/intel/16.1/compilers_and_libraries_2016.1.150/linux/compiler/lib/intel64

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top