The Intel Math Kernel Library (MKL) contains highly optimized and extensively threaded routines for engineering and scientific applications.

It includes linear algebra routines (BLAS, LAPACK, ScaLAPACK, and sparse solvers), FFTs, a vector math library, vector random number generators, and LINPACK benchmark routines.

Choosing which libraries to link to

For help in determining which libraries to link, to see the MKL Library Link Advisor provided by Intel.

Threaded MKL routines

Note that threaded MKL routines are based on OpenMP. Treat these routines as OpenMP parallel regions. Be sure that your thread count does not exceed the number of cores allocated to your job.

Usage on Bridges-2

The MKL library is included with the Intel compilers.  Loading the intel module will give access to MKL also. You can use

module spider intel

to see what versions are available, and

module load intel

to get the version that you want.

To use MKL with a different set of compilers, load both the compiler and MKL modules.  You can type

module spider compiler-type
module spider mkl

to see what versions are available, and then

module load compiler-type
module load mkl

Usage on Bridges

The MKL libraries are available as part of the Intel Parallel Studio by default.  To see which versions are available, type

module avail intel

For more specific information on any installed version, type

module help intel/nnnnn

where nnnnn is the specific intel module you are interested in.

To use a different version of the Parallel Studio than the default, unload the default version and load the one you want.

module unload intel module load intel/nnnnn

Create a job script which

  • Loads a non-default version of the Intel Parallel Studio, if you like
  • Includes a compilation command which calls the MKL libraries you need. If you need help to determine which libraries to link to, see the MKL Library Link Advisor.

To use the Intel compilers with MKL, the compilation command should be similiar to:

ifort source.f -o executable -mkl=[parallel | sequential]

To use the GNU compilers with MKL, you must explicitly list each library.

g++ -o executable -L${MKLROOT} -llibrary1 -llibrary2

Submit the script with the sbatch command.  See the Running Jobs section of the Bridges User Guide for more information on partitions, job scripts and the sbatch command.