Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

mkl fails to load

Omer_K_
Beginner
8,157 Views

I installed mkl 2018 on a server running Ubuntu 16.04.

Whenever I try to use it via python2.7 I get an error saying: "Intel MKL FATAL ERROR: Cannot load libmkl_avx.so or libmkl_def.so."

I tried to run it with LD_DEBUG="files libs" and found the following error in the log:
/opt/intel/mkl/lib/intel64/libmkl_avx.so: error: symbol lookup error: undefined symbol: mkl_sparse_optimize_bsr_trsm_i8 (fatal)

(there is also a similar error for libmkl_def.so.

I installed it on another server (running Ubuntu 14.04) in exactly the same way and it worked fine.

I searched online but couldn't find any solution or explanation of what causes the problem.

Does anyone know how I can resolve it?

Thanks

0 Kudos
4 Replies
Zhen_Z_Intel
Employee
8,155 Views

Hi Omer,

In order to track the root cause of your problem, could you please provide more info:

1. How did you install the MKL? you installed the standalone pkg or installed through IDP (Intel distribution for Python)?
2. How did you get the error message? If you are running program used Numpy or Scipy or any other library which optimized with MKL? And how you build those python libraries with MKL? 

Best regards,
Fiona

0 Kudos
Omer_K_
Beginner
8,156 Views

1. I downloaded the standalone installer from intel's website and installed it as sudo (via install.sh). I chose not to install the fortran libraries and left all other options as default.

2. I'm using a python library called DyNet (for neural networks). DyNet uses Numpy and (if I'm not mistaken) Scipy. I built DyNet using the makefiles provided by the developers, according to their instructions (available here: http://dynet.readthedocs.io/en/latest/python.html#Manual-Installation) and without changing any settings/defaults other than enabling compilation with MKL (by adding "-DMKL=true" and "-DMKL_ROOT=/opt/intel/mkl" to the cmake command).

0 Kudos
Zhen_Z_Intel
Employee
8,156 Views

Hi Omer,

This problem should be caused by static MKL linkage, here's some advice may helpful to you.

1. Have you ever tried to set environmental variable for pre-load libs, 

export LD_PRELOAD=/opt/intel/mkl/lib/intel64/libmkl_def.so:/opt/intel/mkl/lib/intel64/libmkl_avx2.so:/opt/intel/mkl/lib/intel64/libmkl_core.so:/opt/intel/mkl/lib/intel64/libmkl_intel_lp64.so:/opt/intel/mkl/lib/intel64/libmkl_intel_thread.so:/opt/intel/lib/intel64_lin/libiomp5.so

2. If above suggestion no help, please try to modify the 'CMakeList.txt' file, change line 44 ~ 47 to single-dynamic linkage and re-cmake to install:

if(MSVC)
      set(LIBS ${LIBS} mkl_rt ${MKL_COMPILER_LIB_FILE} PARENT_SCOPE)
    else()
      set(LIBS ${LIBS} mkl_rt ${MKL_COMPILER_LIB_FILE} PARENT_SCOPE)

Please inform me if the problem still cannot be solved.

Best regards,
Fiona

0 Kudos
Omer_K_
Beginner
8,157 Views

Thanks Fiona.

Both options seem to have fixed it.

0 Kudos
Reply