Configuring Intel® Fortran in Microsoft* Visual Studio* to build Intel® MKL Applications

You can use Intel® Visual Fortran Compiler within Microsoft* Visual Studio* Integrated Development Environment (IDE) to develop Fortran applications. The following provides the information for linking your program with Intel® MKL from the Microsoft* Visual Studio* 2012 and Intel® Fortran Compiler.

This article was mainly for the user who transfered from Compaq Visual Fortran to Intel Visual Fortran Compiler.  Some related articles are :

How to build an Intel® MKL application with Intel® Visual FORTRAN Compiler
Compiling and Linking MKL with Microsoft* Visual C/C++*

First, please install Intel® Fortran Compiler for Windows. By default, it will be integrated within one version of Microsoft* Visual Studio* IDE on your machine. Take Microsoft Visual Studio* 2012 and Intel® Visual Fortran Compiler for windows*  as example.

In Microsoft* Visual Studio* environment, compiling and linking Intel® MKL with Intel® Fortan Compiler can be completed quickly by the below steps:

  • Create an Intel FORTRAN Project based on Intel® Math Kernel Library (Intel® MKL).   
    Note: If you open one existing fortran project or original "Compaq Visual Fortran project" in the Visual Studio IDE environment, it can be converted to Intel Fortran project automatically by a prompted window. 

          Here is a Fortran sample project based on Intel® MKL FFT :Download DFT_RtoCCS.zip

  • From the Visual Studio* IDE main toolbar, select View » Solution Explorer, and make sure this window is active.
  • Select the Project in the Solution Explorer window, and then right-click the mouse and select Properties from the menu.
  • In Properties Pages Windows, select Configuration Properties » Fortran » Libraries , In Use Intel Math Kernal Library item to choose Parallel (/Qmkl:parallel) or Sequential (/Qmkl:sequentail) or Cluster (/Qmkl:cluster).
     

    Then click OK and build the project. In most of case, the setting should be enough for building a Fortran application based on Intel® MKL.

The below steps are optional, which are doing above configuration manually. You should switch off the quick option /Qmkl:xxx if go with the below steps.

  • In Configuration Properties, select Fortran » General, and then in the Additional Include Directories item, add the Intel® MKL header files path as shown in the figure

  • In Configuration Properties, select Linker » General, and then in the Additional Library Directories item, add the Intel® MKL Library path as shown below
  •  
  • Select Linker » Input, and then in Additional Dependencies add the Intel® MKL libraries as shown below(e.g. mkl_intel_c.lib mkl_intel_thread.lib mkl_core.lib libiomp5md.lib). Please refer to section Linking Your Application with Intel MKL to find which Intel® MKL libraries are needed in your application.

Note: For Intel® Fortran compiler default setting, the mkl_intel_c[_dll].lib is appropriate library to link. For  Compaq Visual Fortran compiler, mkl_intel_s[_dll].lib is right library to link.

Please read more details from Intel MKL User Guide  =>Using the cdecl and stdcall Interfaces

mkl_intel_s[_dll].lib

Call a routine with the following statement:

extern __stdcall name( <prototype variable1>, <prototype variable2>, .. );

where stdcall is actually the CVF compiler default compilation, which differs from the regular stdcall compilation in the way how strings are passed to the routine. Because the default CVF format is not identical with stdcall, you must specially handle strings in the calling sequence. See how to do it in sections on interfaces in the CVF documentation. 

 
Pour de plus amples informations sur les optimisations de compilation, consultez notre Avertissement concernant les optimisations.