Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
168 Views

python mkl error

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
Highlighted
Moderator
168 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
Highlighted
Employee
168 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-...

Best Regards,

Ying

0 Kudos