Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
7113 Discussions

Finding different versions of MKL when using CMake on Windows

AndrewC
New Contributor III
1,185 Views

After installing MKL, CMake files are installed in 

C:\Program Files (x86)\Intel\oneAPI\mkl\latest\lib\cmake\mkl\

Also as part of the installation process some change is made so CMake will always  look in the above location "first".

Does anyone know where this is recorded? The Windows registry? Somewhere in the CMake installation?

I need to be able to change where CMake finds MKL ( to use older/different versions) and this behavior seems impossible to ovveride.

 

0 Kudos
2 Replies
Gennady_F_Intel
Moderator
1,097 Views

You can use MKL_ROOT cmake variable to specify the oneMKL libs and headers location.

e.g. build for oneMKL examples from C:/Users/user/local_onemkl,

 

cmake .. -DTARGET_FUNCTIONS="blas/cblas_dgemmx"

...

-- Found C:/Users/user/local_onemkl/lib/mkl_core_dll.lib

-- Found DLL: C:/Users/user/local_onemkl/bin/mkl_core.2.dll

...

 

And you can change the location with MKL_ROOT

 

cmake .. -DMKL_ROOT="C:\Program Files (x86)\Intel\oneAPI\mkl\2024.0" -DTARGET_FUNCTIONS="blas/cblas_dgemmx"

...

-- Found C:/Program Files (x86)/Intel/oneAPI/mkl/2024.0/lib/mkl_core_dll.lib

-- Found DLL: C:/Program Files (x86)/Intel/oneAPI/mkl/2024.0/bin/mkl_core.2.dll

...

 

Please note, MKLConfig.cmake could be not always compatible with the older oneMKL packages because of library versions, missed dependencies or package structure.


0 Kudos
AndrewC
New Contributor III
1,080 Views

HI Gennady,

I just worked this out. The intel setvars.bat sets the variable CMAKE_PREFIX_PATH which is used to find MKL/IPP etc.

 

Thanks

Andrew

0 Kudos
Reply