mxnet build with intel mkl always throw error "Intel MKL FATAL ERROR: Cannot load mkl_intel_thread.dll."

  • os : windows 10 64bits
  • compiler : vc2015 64bits update 3
  • mxnet : 1.3.1

Building mxnet 1.3.1(mxnet1.4.0 has bugs, can't build it under windows,please check14203 for more details).

I can build the mxnet with cpp-package, but when I call the forward function o the Executor, it keep throwing

Intel MKL FATAL ERROR: Cannot load mkl_intel_thread.dll.

Following are my steps to build the mxnet

  1. git clone --recursive mxnet
  2. cd mxnet
  3. Download intel mkl(w_mkl_2019.2.190.exe)
  4. install it
  5. open cmake3.11.0
  6. enter image description here
  7. enter image description here
  • I disable cpp_package,opencv,cuda,USE_MKLML_MKL(else mshadow will use openBLAS).
  • I disable USE_TENSORRT and USE_VTUNE too
  1. press configure,disable BUILD_TESTING
  2. press configure again, all green
  3. press generate,all green
  4. open ALL_BUILD.vcxproj
  5. Select Release build
  6. All build
  7. All green, except install project fail

>file cannot create directory: C:/Program Files/mxnet/lib. Maybe need 1> administrative privileges.

Already open vc as admin, still the same error

  1. Add Anaconda3 into PATH
  2. Add libmxnet.dll and C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.2.190\windows\redist\intel64_win\mkl\mkl_rt.dll into a folder which could be found by the os
  3. select build with cpp_package from cmake gui
  4. configure->generate
  5. reopen ALL_BUILD.vcxproj
  6. Select ALL_BUILD->build
  7. Because install do not work,I copy the files lib to build_cpu/install

enter image description here

  1. Because lrs and wds of op.h do not declare type,I need to add mx_float for them
  2. write a simple program, can compile
  3. When I call forward of the Executor,the program throw Intel MKL FATAL ERROR: Cannot load mkl_intel_thread.dll.
  4. Add C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.2.190\windows\redist\intel64_win\mkl的mkl_intel_thread.dll into the folder could be found by the os

26.Run again,still the same error Intel MKL FATAL ERROR: Cannot load mkl_intel_thread.dll.

My Anaconda3 install mxnet,it got mkl_intel_thread.dll and mkl_rt.dll too,I wonder there are confliction,problem is I did not add the bin path of Anaconda3 into the PATH.

I tried to copy different mkl_intel_thread.dll and mkl_rt.dll into the folder where the exe at, but every combination of them give me same error.

Those dll come from following path

  • C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.2.190\windows\redist\intel64_win\mkl
  • C:\Users\yyyy\Anaconda3\envs\gluon\Library\bin
  • C:\Users\yyyy\Anaconda3\Library\bin
  • C:\Users\yyyy\Anaconda3\pkgs\mkl-2019.1-144\Library\bin

Do anyone know how to solve this issue?Thanks


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,

Here is Linux

export LD_PRELOAD=/opt/intel/mkl/lib/intel64/

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

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

Posted on by srilekha palepu - Intel