Numerous math libraries are available on Frontera, but Intel MKL is especially important. Intel's Math Kernel Library contains highly optimized functions implementing many of the common mathematical kernels that are widely used in computational research. The library includes implementations of the following interfaces:

  • BLAS, the Basic Linear Algebra Subprograms
  • LAPACK, the Linear Algebra PACKage
  • Fast Fourier Transforms, including interfaces based on FFTW
  • ScaLAPACK/BLACS and other multi-node versions of selected LAPACK, BLAS, and FFT routines
  • Vector Mathematics (VM) for vectorized versions of functions like sine and square root

It is often to your advantage to link to MKL instead of the generic, less-optimized libraries you would otherwise get through linker options such as -lblas or -llapack. For instance, MKL can actually recognize your processor type at run time and choose the function version that runs fastest on it.

As an added bonus, MKL is multithreaded with OpenMP; thus, if you set OMP_NUM_THREADS or MKL_NUM_THREADS in your environment, calls to MKL will automatically be executed on multiple threads up to your maximum value. Of course, some care must be taken if your code is already parallelized with OpenMP or MPI, or both. See the Frontera User Guide for information and advice.

MKL with Intel Compilers

When you load one of the Intel compiler modules, you get access to MKL too, without needing to load an MKL module separately. To make things even more convenient, the usual options specifying MKL's include paths, libraries, etc., can all be replaced with a single -mkl flag:

$ icc   -mkl mycode.c
$ ifort -mkl mycode.c

The -mkl option is equivalent to -mkl=parallel, which says to link your code to the multithreaded version of MKL. If you want to link to the single-threaded version, use -mkl=sequential. There is also an -mkl=cluster variant which comes into play when you use ScaLAPACK, e.g. For details relevant to the most recent Intel compilers, consult Intel's MKL documentation.

MKL with GNU Compilers

If you use a GNU compiler, you need to execute module load mkl, then tell the compiler explicitly which MKL libraries, library paths, and include paths your code needs. All this gets rather messy, so Intel has eased the process for you with its Intel MKL Link Line Advisor website. And that's really the place you should go if you are doing anything beyond simply passing -mkl to the Intel compiler.

MKL in Uncompiled Languages

TACC's prebuilt modules for MATLAB, Python, and R are all linked to the threaded (parallel) version of MKL for their BLAS and LAPACK functionality. This means that when you load these modules on Frontera, not only do you get MKL's optimized performance, you also get the benefit of MKL's built-in parallelism, if you want it. No action is required on your part, other than specifying an appropriate maximum thread count for MKL through MKL_NUM_THREADS; or if that is left undefined, OMP_NUM_THREADS.

Note, the default value of OMP_NUM_THREADS is 1 on TACC systems, and MKL_NUM_THREADS is not initialized, so by default you will get no thread-based parallelism from MKL.

 
©  |   Cornell University    |   Center for Advanced Computing    |   Copyright Statement    |   Inclusivity Statement