NERSCPowering Scientific Discovery Since 1974

Math Kernel Library (MKL)


The Intel Math Kernel Library (Intel MKL) contains highly optimized, extensively threaded math routines for science, engineering, and financial applications. Core math functions include BLAS, LAPACK, ScaLAPACK, Sparse Solvers, Fast Fourier Transforms, Vector Math, and more.

MKL is available on NERSC computer platforms where the Intel compilers are available. For instances, on Cori and Edison. If you use intel compilers to compile your code, you can conveniently use the Intel compiler flag, -mkl,  to link your code to MKL. If you use other compilers, for example, GNU or Cray Compilers, we recommend you to use the Intel MKL Link  Line Advisor  to get the advice about the compiler flags and the link lines to use MKL.

In this page we provide the instructions about how to use MKL on Cori and Edison. Please refer to the Intel MKL Link Line Advisor page for any use cases that are not covered in this page. 

How to Use MKL on Cori and Edison

For Intel compilers: 

On Cori and Edison, the Intel programming environment is the default. So if you compile under the default programming environment, you just use the "-mkl" flag with the compiler wrappers under the Intel programming environment. The default is to use the threaded libraries ("-mkl" is equivalent to "-mkl=parallel").  If sequential libraries are needed, use the "-mkl=sequential" flag instead. If ScaLapack routines are needed, use the -mkl=cluster option. Note, the -mkl=cluster flag links to the sequential routines of the libraries, if the ScaLapack with threaded libraries are needed, you need to provide the correct combinations of the libraries to the link line. Please refer to the Intel MKL Link  Line Advisor  page.

%ftn my_code.f -mkl
%cc test.c -mkl 

On Edison, the cray-libsci module, which also provides math libraries as MKL, is loaded by default. So the default library searched for math routines such as BLAS is Cray's SciLib. If you use the -mkl flag, the Cray's LibSci will be ignored. You can always check which library is used with the -Wl,-yNAME compiler option, where NAME is the actual symbol you want to check. Example: 

% ftn dgemmx.f -Wl,-ydgemm_
/tmp/ifortwGr9Rc.o: reference to dgemm_
/opt/cray/libsci/13.3.0/INTEL/14.0/x86_64/lib/libsci_intel.a(dgemm_.o): definition of dgemm_

% ftn dgemmx.f -mkl -Wl,-ydgemm_
libraries from PE_LIBSCI will be ignored because they conflict with -mkl.
/tmp/ifortHcLomU.o: reference to dgemm_
/opt/intel/composer_xe_2015.1.133/mkl/lib/intel64/libmkl_intel_lp64.a(_dgemm_lp64.o): definition of dgemm_
/opt/intel/composer_xe_2015.1.133/mkl/lib/intel64/libmkl_core.a(mkl_aa_fw_load_orsl_lite_lib.o): In function `mkl_aa_fw_load_orsl_lite_lib':
../../../../serv/offload/framework/core/mkl_aa_fw_load_orsl_lite_lib.c:(.text+0xbe): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking

For Other Compilers:

Please refer to the  Intel MKL Link  Line Advisor  page. 


The release notes, user's guide, and reference manual are available in PDF and HTML format on the Intel web site.

Intel also has an "MKL Link Line Advisor" that can help with choosing linking options.  To see which libraries are recommended for a particular use case view the Intel interactive form.


MKL is available on the NERSC computers where the Intel compilers are available. So to check the availability of MKL, you can check the availability of the intel modules by typing the "module avail intel" command. On some platforms, we have also made the separate modulefiles for MKL, named mkl.

PackagePlatformCategoryVersionModuleInstall DateDate Made Default
mkl genepool libraries/ general 2013.1.117 mkl/2013.1.117 2013-06-13 2013-06-13
mkl phoebe libraries/ general 2013.1.117 mkl/2013.1.117 2013-06-18 2013-06-26