Using Intel® MKL in Intel® Compiler - mkl, Qmkl options

Introduction
The Intel® Compiler option “-mkl”, “Qmkl” options provide users a quick and efficient way to link Intel® Math Kernel Library (Intel® MKL) in an application. With the option, users are free from complex link command, and just need to add simple options to link Intel MKL.

-mkl, Qmkl: 
It is a compiler option, tells the compiler to link to certain parts of Intel MKL.

Linux* and OS X*:
-mkl[=lib]
Windows*:
/Qmkl[:lib]

Argument
[lib]: Indicates which Intel MKL library files should be linked. Possible values are:

  • parallel
    Tells the compiler to link using the threaded libraries in Intel MKL. This is the default if the option is specified with no lib.
     
  • sequential
    Tells the compiler to link using the sequential libraries in the Intel MKL.
     
  • cluster
    Tells the compiler to link using the cluster-specific libraries and the sequential libraries in the Intel MKL. Cluster-specific libraries are not available for OS X*.

Default:
OFF  The compiler does not link to the Intel MKL.

The below example are using Intel Fortran Compiler for Linux*, 64bit as sample. You may find the other equivalents for Windows* and OS X* by Intel® Math Kernel Library Link Line Advisor

Command line example
-mkl  (same as -mkl:parallel) 

$ ifort -o test test.f90 -mkl  [-static-intel]  if static linking.

-mkl:sequential
$ifort -o test test.f90 -mkl:sequential  [-static-intel] if static linking.

-mkl:cluster
$ifort -o test test.f90 -mkl:cluster  [-static-intel] if static linking
 

Intel MKL package also contains IDE integration with Microsoft Visual Studio*, which is an easy to add Intel MKL into the applications. Check the article here to learn more information:
https://software.intel.com/en-us/articles/intel-math-kernel-library-intel-mkl-compiling-and-linking-with-microsoft-visual-cc

Note:  If you are using 64bit integer in 64bit application, the quick compiler option or one button haven't covered it yet. Please add the library manually according to Intel® Math Kernel Library Link Line Advisor

For more combination, please also refer to Intel® Math Kernel Library Link Line Advisor
 

For more complete information about compiler optimizations, see our Optimization Notice.
Tags: