Intel® Math Kernel Library (Intel® MKL) offers highly optimized, extensively threaded math routines for scientific, engineering, and financial applications that require maximum performance.
Intel MKL is available with the Intel® C++ and Fortran Compilers and Intel Cluster Toolkit / Studio, and as a standalone product. It includes BLAS, LAPACK, FFTs, Scalapack and related libraries.
To initialize this library in a Linux environment run the command:
module load mkl
For the Intel Composer compiler package, compiler version 12 or later, MKL is included as part of the package, and will be automatically loaded with the compilers, ex:
module load intel
To compile using this library in a Linux environment run the command:
ifort -O3 -mkl source_code.f
When compiling with the MKL libraries it is generally best to use the Intel compilers, and the appropriate linking flags must be used. For the Intel Composer compiler package version 2013 or later the single flag -mkl enables most of the MKL features. By default using the single flag -mkl will use multi-threaded MKL algorithms. To use single threaded sequential MKL algorithms use the compiling command:
ifort -O3 -mkl=sequential source_code.f
It is sometimes necessary to use explicit MKL library linking flags, and the versions of Intel/MKL previous to 2013 require this. An example of a common compiling command using explicit MKL library linking flags is given below. This command is to be entered all on one line.
ifort -O3 source_code.f -lmkl_intel_lp64 -lmkl_sequential -lmkl_core
Sometimes it is necessary to specify the path to the MKL libraries in the compiling command using the -L flag as shown below. The path specified will depend on the version of MKL being used. The example command below is for MKL version 126.96.36.199 which is part of the Intel 2013/upgrade5 compiler package. The command is to be entered all on one line.
ifort -O3 source_code.f -L/soft/intel/x86_64/12.1/8.273/composer_xe_2011_sp1.8.273/mkl/lib/intel64 -lmkl_intel_lp64 -lmkl_sequential -lmkl_core
Please note different versions of MKL are available on the lab and the high performance systems. On different systems the default MKL may link to different versions of MKL. To see the available MKL modules use the command:
module avail mkl
Other Intel modules include the MKL libraries, for example, the Intel compiler version 12 or later modules include the associated MKL libraries, and so MKL will be automatically loaded when loading these more recent compiler modules. The following table indicates which MKL version is associated with each recent Intel compiler version, and the table syntax is the same as the module names on MSI systems.
|Intel Compiler Version||Included MKL Version|
Intel provides an MKL linking advisor tool, which provides advice regarding the appropriate MKL linking commands for a given configuration. The tool is available at: http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor
The MKL advisor tool does not provide advice for all possible options, for example it does not include information about using OpenMPI with MKL.
The most accurate and thorough Intel documentation is provided by Intel, and is available at:
Further information about the Intel MKL libraries can be found at: