Python setup.py build - does not find installed MKL

Hi,

I downloaded & installed Intel’s MKL, but it is NOT FOUND while compiling PyTorch from source under Linux, i.e. via ‘python setup.py build’.

Even

export LD_LIBRARY_PATH="/opt/intel/compilers_and_libraries_2017.4.196/linux/mkl/lib/intel64:$LD_LIBRARY_PATH"

does not help.

How should one “let setup.py know” where to find the installed MKL library ?

P.S. except the failure of finding MKL, all other parts of the compilation (e.g. detecting installed CUDA & CUDNN) goes perfectly well !

I found some workaround myself: modified file torch/lib/TH/cmake/FindMKL.cmake

  1. corrected line 42 to become: SET(mklvers “intel64”)

  2. added following after line 66: SET(INTEL_COMPILER_DIR “/opt/intel”)

Still do not know how to properly pass variable ‘INTEL_COMPILER_DIR’ to script ‘FindMKL.cmake’, in order to avoid modification 2).

1 Like

Thanks for sharing that! I had the same problem. I didnt want to use anaconda to install. That solved it!

1 Like