Tag Archives: Fortran

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.


Installing Fortran Compiler for Visual Studio 2017

Fortran has come a long way than we had studied in high-school in 19xx. Its now fully supported within Microsoft visual studio. To install Fortran with VS IDE support, ensure the followings:

Modify/Install the installation file of VS 2017 Community edition (its free!) and install support for Desktop development with C++ .  This step will ensure that the Fortran compiler is available from within the VS2017. (Ref: https://software.intel.com/en-us/articles/installing-microsoft-visual-studio-2017-for-use-with-intel-compilers).

  1. During installation/modification under the Workloads view (shown below), select the checkbox to install the Desktop development with C++ component.
  2. To build applications to run on Windows XP*, check the Windows XP support for C++ component in Summary window
  3. Continue with the installation

Download Fortran compiler- Intel® Parallel Studio XE (its free too!) from https://software.intel.com/en-us/qualify-for-free-software/student. You need to register with academic email address. Install it after downloading.

For offline installation you can download licence file from your profile page after logging in. (Ref: https://software.intel.com/en-us/articles/resend-license-file)


  • Click on any active serial number to go to the corresponding Manage License page.
  • There are two icons on the License File header ‘Download license file’ and ‘Resend license file to my email’.