performancecross-platformx86-64intel-mklamd-processor

When you have an AMD CPU, can you speed up code that uses the Intel-MKL?


I have an AMD cpu and I'm trying to run some code that uses Intel-MKL. The code is significantly slower than I expected.

When you have an AMD CPU, can you speed up code that uses the Intel-MKL? How?


Solution

  • UPDATE 2021-08-26: you can speed up older versions of MKL from before approximately 2020-08-31. Set the environment variable MKL_DEBUG_CPU_TYPE=5 then run your code.

    NOTE: I do not know the exact date or version when Intel removed the environment variable workaround.

    FYI this slow down affects anything that uses Intel-MKL library and runs on AMD CPU (i.e. affects all operating systems and affects all programming languages and all programs (older versions of Matlab, C, C++, Python, Anaconda-Python, Machine-Learning like Tensorflow and Pytorch , again anything that uses Intel-MKL library on AMD CPU)).

    FYI Setting and getting environment variables is out of scope for this question but here are some helpful links:




    p.s.

    regarding the question "why/how does setting an environment variable cause code to run significantly faster?"

    You are probably wondering "why would Intel have a software slow-down in their MKL library?