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

python mkl error

dog__shaw
Beginner
1,767 Views

Multiplying numpy arrays using the dot method, when array elements are float, is producing Intel MKL FATAL ERROR: Cannot load mkl_intel_thread.dll.

Here is the simplest code I can think of to create this problem. 

import numpy as np

A = np.array([[1,2],[2,1.1]])
x = np.array([3,4])

b = A.dot(x)

print(b)

Output: 

Intel MKL FATAL ERROR: Cannot load mkl_intel_thread.dll.

"The procedure entry point mkl_aa_fw_get_workdivision could not be located in the dynamic link library C:\Users\..\Anaconda\Library\bin\mkl_intel_thead.dll"

Note with integers it works fine (change above matrix to integer value)

import numpy as np

A = np.array([[1,2],[2,1]])
x = np.array([3,4])

b = A.dot(x)

print(b)

Output = [11 10]

0 Kudos
2 Replies
Gennady_F_Intel
Moderator
1,767 Views

thanks for the example. I am not sure about which version are you using, but quick check the problem with the latest Intel Distribute Python doesn't reveal some problem:

 

mkl_Forums\u749056>python test_u749056.py

[11 10]

\mkl_Forums\u749056>python test_u749056.py
[ 11.   10.4]

\mkl_Forums\u749056>python --version
Python 3.6.3 :: Intel Corporation

0 Kudos
Ying_H_Intel
Employee
1,767 Views

​It seems the same problem in https://software.intel.com/en-us/forums/intel-math-kernel-library/topic/748309 . and https://software.intel.com/en-us/forums/intel-math-kernel-library/topic/733207 .  which link 3 separate libraries instead of one library mkl_rt.dll

we had asked Python numpy committee to fix the problem, could you please try Intel distribute python?

or other way, like try set environment or do preload dll etc.  

Here is Linux

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

In windows, setting env by mkl/bin/mklvars.bat intel64, then run your python in same environment

or in python to add the library manually sys.path.append(" your path to the library")  or https://stackoverflow.com/questions/35478526/pyintaller-numpy-intel-mkl-fatal-error-cannot-load-mkl-intel-thread-dll

Best Regards,

Ying

0 Kudos
Reply