Tag Archives: math kernel library

Using Math Kernal Library (MKL) in visual studio with Fortran

First install MKL from intel website

To use intel MKL library inside visual studio do the followings:
1. Right click the project>Properties
2. In Property page>Fortran>Libraries set (a) Runtime library : Multithreaded and (b) Use Intel MKL: Sequential

Once this setting is done, you can compile the file in DEBUG mode. Repeat the same process (1-2) for RELEASE mode too once more.(Note exe of DEBUG mode is far slower than exe of RELEASE mode. The settings to set are listed below.

To do the same thing MANUALLY (which gives more insight to the code) do the following in each DEBUG and RELEASE mode.
1. Property page>Fortran>General>Additional Include Directories: C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.4.245\windows\mkl\include
2. Property page>Fortran>Preprocessor>Preprocess source file: Yes
3. Property page>Linker>General>Additional Library Directories:C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.4.245\windows\mkl\lib\ia32_win
4. Property page>Linker>Input>Additional Dependencies: mkl_intel_c.lib mkl_intel_thread.lib mkl_core.lib libiomp5md.lib

The manual setting is described in the video as well:

For method to install Fortran in visual studio see this post.