Linking MKL within Python-C++-C-Fortran 2003 program

Linking MKL within Python-C++-C-Fortran 2003 program

Ritratto di lacek

[repost from:

I am trying to link a program which nature is pretty complicated:

  • developed and run under Linux Fedora
  • main code written in fortran 2003 is heavily relies on Intel's MKL library and small pieces of ANSI C code
  • it has C++ interface (use iso_c_binding)
  • the c++ interface is accessed from python via boost.python

During the runtime I get the following text

MKL FATAL ERROR:Cannot load neither nor

after which program stops.

I have checked that bothlibmkl_avx.soandlibmkl_def.soare in $LD_LIBRARY_PATH

The final linking is done via:

g++-g3-shared-Wl,-soname, interfejs.o t83.o gen_random2.o-L/opt/intel/composerxe/mkl/lib/intel64-lpython2.7-lifport-lifcore-lboost_python-Wl,--start-group-lmkl_sequential-lmkl_intel_lp64-lmkl_core-Wl,--end-group-o

libFrrBoost is the module that is linked, then

runningpython particular linker does not complain when preparing the binary file) which imports the module libFrrBoost causes the error.

Tried to google. All the info I found was connected with "usual programs" written in C/Fortran and simply including Intel's MKL. I am able to run this sort of programs with no problem. I think the MKL part of the linking line in the Makefile is equivalent in both cases, but there must be somewhere a hidden mystery. The problem was usually bad linking - which I do not see applicable (the libraries are exactly as in Intel's manual - Interface, Threading and computational libraries are pretty standard)

Used compilers:

ifort 12.1.0, icpc 12.1.0, python Python 2.7.1, icc 12.1.0 (the small C snippet also calls MKL, but)

ADDITION (due to a comment of HirstoIliev@Stackoverflow)

I have run the strace in this way:strace python; The result is (after grepping libmkl):

open("/opt/intel/composer_xe_2011_sp1.7.256/mkl/lib/intel64/", O_RDONLY)=3

open("/usr/bin/", O_RDONLY)=-1 ENOENT(No such file or directory) open("/opt/slurm-2.2.5/lib/", O_RDONLY)=-1 ENOENT(No such file or directory)

open("/opt/intel/composer_xe_2011_sp1.7.256/compiler/lib/intel64/", O_RDONLY)=-1 ENOENT(No such file or directory)

open("/opt/intel/composer_xe_2011_sp1.7.256/debugger/lib/intel64/", O_RDONLY)=-1 ENOENT(No such file or directory)

open("/opt/intel/composer_xe_2011_sp1.7.256/mkl/lib/intel64/", O_RDONLY)=3

I understand that the specification for open is as in here an, in particular, as 3,4 are positive and indicate that open has found a file and assigned it file discriptors. I have verified that the file does exist in that place.

also this is "good" Intel compiler directory as:

czeslaw@stefan:~/prog/FoCpy3 $ which ifort/opt/intel/composer_xe_2011_sp1.7.256/bin/intel64/ifort

So the version is the same - aparently it is not a version issue.

Everything is the same

DISCLAIMER: Although I may sound confident in what I write I am not. Every sentence should begin with "If I am not mistaken".

3 post / 0 new
Ultimo contenuto
Per informazioni complete sulle ottimizzazioni del compilatore, consultare l'Avviso sull'ottimizzazione
Ritratto di lacek

It seems the solution is to link with -lmkl_rt instead of -lmkl_sequential -lmkl_intel_lp64 -lmkl_core. I do not see why one should give advantageous over te other. I am confused but that works (so far).

Ritratto di Victor Pasko (Intel)


In case of creating your which depends explicitly from mkl_intel_lp64 + mkl_sequential + mkl_core MKL dynamic libraries please try to locate libFrrBoost_rt together with all MKL dynamic libraires (required on run-time) in the same directory.

Thanks, -- Victor

Accedere per lasciare un commento.