Jean Zay: The LAPACK library


LAPACK (Linear Algebra Package) is a library dedicated to dense linear algebra and depends on the BLAS (Basic Linear Algebra Subprograms) library. It provides functions for solving systems of linear equations, eigenvalue calculations and matrix decompositions (LU, QR, SVD, Cholesky). LAPACK is available via the Math Kernel Library (MKL) (recommended version) or in a free version (Netlib).

Installed versions

  • Intel MKL with the Intel compilers (recommended version)
  • 3.8.0 with the GCC 8.2.0 compiler
  • 3.8.0 with the GCC 9.1.0 compiler
  • 3.8.0 with the Intel 2019.4 compiler

Usage of LAPACK via MKL

MKL contains optimised implementations of the BLAS library. The library is directly accessible via the Intel compiler by using the module command:

$ module load intel-compilers/19.0.4 intel-mkl/19.0.4

To know which versions are installed on the machine:

$ module avail intel-compilers
$ module avail intel-mkl

For the linking, you must add the following options:

 '-L${MKLROOT}/lib/intel64 -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread -lm -ldl'

The options can vary from one version to another depending on the compiler used. Linking information can also be found on Intel MKL Link Line Advisor.

Usage of LAPACK in free version

The library is accessible with the following command:

$ module load netlib-lapack

To know which versions are installed on the machine:

$ module avail netlib-lapack

Important: At the linking, you must add the -lblas -lapack option.