StereoMatching
StereoMatching

Reputation: 5019

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

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 https://github.com/apache/incubator-mxnet 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
  8. press configure,disable BUILD_TESTING

  9. press configure again, all green
  10. press generate,all green
  11. open ALL_BUILD.vcxproj
  12. Select Release build
  13. All build
  14. 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

Do anyone know how to solve this issue?Thanks

Upvotes: 0

Views: 456

Answers (1)

srilekha palepu - Intel
srilekha palepu - Intel

Reputation: 2253

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/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 Pyinstaller numpy "Intel MKL FATAL ERROR: Cannot load mkl_intel_thread.dll"...

  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:

    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)
    

Upvotes: 1

Related Questions