Compiling and Linking MKL with Microsoft* Visual C/C++*

The following provides hints for linking your program with Intel® MKL from the Microsoft* Visual Stuido Environment: 
Inte®l MKL 10.3 or later versions with Microsoft* Visual Studo 2010
Intel® MKL 10.3 or later versions with Microsoft* Visual Studio 2008
Inte®l MKL 10.2.x with Microsoft* Visual Studio 2010
Inte®l MKL 10.2.x  with Microsoft* Visual Studio 2005/2008
Inte®l MKL 10.2.x with Microsoft* Visual Stuido 2003
Inte®l MKL 10.2.x with Microsoft* Visual C++* 6.0


Intel® MKL 10.3 or later versions with Microsoft* Visual Studio 2008
Start from 10.3 version,  MKL package contains IDE integration same as for Composer XE (now MKL, IPP, TBB  are considered as part of ComposerXE suite - User is able to upgrade MKL in suite with newer update of MKL). Therefore in case of installed MKL there will be following in Microsoft Visual Studio 2008 Environment:

MKL10.3_VS2008.jpg

After clicking on "Select Build Components" user will be able for choosing MKL integration on following dialog:

MKL10.3_VS20082.png


Intel® MKL 10.3 or later versions with Microsoft* Visual Studio 2010

The intergaration of MKL 10.3 and later versions into Microsoft* Visual Studio 2010 as below.

MKL10.3_VS2010.jpg

 

Intel® MKL 10.2.x with Microsoft* Visual Studio 2010

The Microsoft Visual Studio 2010 (MSVC 2010) is released recently. The Intel® MKL 10.2.x can be used in MSVC 2010 as usual as below. 

Step 1: Set environment, mainly set the path for MKL header files and libraries file in MSVC IDE 

  1. Open your project in MSVC 2010 IDE, select View » Solution Explorer (and make sure this window is active).
  2. Select Project » Properties,  Open the Propery Pages
  3. Select the C/C++ » General tab, In the Additional Include Directories line, add Intel MKL header files include path (e.g. default: C:\Program Files\Intel\MKL\10.2.X.X\include).
  4. Select the Link » General tab, In the Additional Library Directories line, add Intel MKL library files path(e.g. default: C:\Program Files\Intel\MKL\10.2.X.X\ia32\lib) 

mklmsvs2010.JPG

Step 2: Link required MKL library into your project

  1. Select the Link » Input tab, In the Additional Dependencies, add the required MKL libraries (e.g. common link: mkl_intel_c.lib mkl_intel_thread.lib mkl_core.lib libiomp5md.lib).  

 

Intel® MKL v10.2 with Microsoft* Visual Stuido 2008/2005

Starting with version 10.1, Intel® MKL provides integration of Microsoft Visual Studio* IDE projects with the library. The integration supports Microsoft Visual Studio* IDE versions 2005 or higher. During installation time, you can select intergate with Microsoft* Visual Studio 2005 or 2008, full installation.  Once install sucessfully, the integration enables you to automatically configure a C++ project in Microsoft Visual Studio* IDE with Intel® MKL.  

So for compile and link any MKL appliation, just open the application in MSVC Visual Studio IDE, click right key » Intel MKL Project Settings » click Add Intel MKL 10.x.x.x (as below figure 1). Then all thing should be done.
Figure 1
mklInMSVC2005.JPG

Note: The intergaration are using common library, for example, use dynamic library; mkl_solver.lib mk_intel_c_dll.lib mkl_intel_thread_dll.lib mkl_core_dll.lib libiomp5md.lib.
For any more mkl library link option, please refer to  Intel® Math Kernel Library Link Line Advisor  and Find more information on linking in the Intel® MKL User's Guide
Add some required library manually by the steps in Section MSVS 2010.

 


 

Intel® MKL v10.2 with Microsoft* Visual Studio 2003

  1. Select View » Solution Explorer (and make sure this window is active).
  2. Select Tools » Options » Projects » VC++ Directories.
  3. In the drop down menu titled Show directories for:, select Include Files, and then type in the directory for the Intel MKL include files (e.g., default: C:\Program Files\Intel\MKL\10.2.x.x\include).
  4. In the drop down menu titled Show directories for:, select Library Files, and then type in the directory for the Intel MKL library files (e.g., default: C:\Program Files\Intel\MKL\10.2.x.x\ia32\lib).
  5. In the drop down menu titled Show directories for:, select Executable Files, and then type in the directory for the Intel MKL executable files (e.g., default: C:\Program Files\Intel\MKL\10.2.x.x\ia32\bin).
  6. On the main toolbar select Project » Properties » Linker » Input and in the "Additional Dependencies" line, add the libraries you require (e.g., mkl_intel_c.lib mkl_intel_thread.lib mkl_core.lib libiomp5md.lib).

 


Intel® MKL v10.2 with Microsoft* Visual C++* (v6.0)

Step 1: Set environment variable, mainly PATH for MKL header files and libraries file in MSVC IDE

  1. Select Project » Settings (make sure your project are active in the MSVC IDE)
  2. Select the C/C++ tab, In the Category drop down menu, select Preprocessor and add Intel MKL include directory (e.g. default: C:\Program Files\Intel\MKL\10.2.X\include).
  3. Select the Link tab, In the Category drop-down menu, select Input and in the Additional library path section, add the location of the Intel MKL sub-libraries. For example, on an IA32 system, you would add C:\Program Files\intel\MKL\10.2.x.x\ia32\lib (for the default install location).

Step 2 : In Project Settings, add the location (path) of Intel MKL sub-library in the link properties

  1. Select Project » Settings » Link tab.
  2. In the Category drop-down menu, select Input.
  3. In the Object/library modules section add wanted mkl libraries. 
    For example, mkl_intel_c.lib mkl_intel_thread.lib mkl_core.lib libiomp5md.lib or mkl_intel_s.lib mkl_intel_thread.lib mkl_core.lib libiomp5md.lib for static CVF interface. The other libraries (LAPACK, BLAS, etc.) are identified as default libraries within the interface library and cause the linker to automatically link appropriately. The processor type is determined at runtime.

For more mkl library link option, please refer to  Intel® Math Kernel Library Link Line Advisor

Note 1:  In order to provide maximum support for our users's all kind request, we re-architected Intel® MKL since MKL 10.0. This new Intel® MKL architecture provides 4 layer libraries so that users can choose numerous linking combinations according to the wanted configurations. For users who still use MKL v9.0 and earier version, please refere to  For easily migrating from Intel® MKL 9.x to 10.x .

Note 2: for link MKL in Intel Fortran Or C++ Compiler for windows*, please refer to Using MKL in Intel® Compiler - mkl, Qmkl options

Note: Since from MKL 10.3 release, MKL is part of Intel Parallel Studio XE.  This provides an easy way to compile and link MKL in Parallel Studio XE environments. But the directory and integration has changed a bit compared to the previous releases (MKL 10.2 and earlier versions). Please see A new directory hierarchy in Intel MKL package .

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