LAPACK is a software library for numerical linear algebra. Note that MKL provides optimised implementations of LAPACK and BLAS.

User instructions

LAPACK is available via the modules system. To add it to your environment run:

$ module load lapack/3.7.1

The module contains the standard (netlib) implementation of both BLAS and LAPACK, which can be linked to by adding ‘-llapack -lblas’ to the link line. Full documentation to the LAPACK and BLAS libraries can be found on the netlib website.

A standard C interface to LAPACK, LAPACKE, is also provided. See for more details. LAPACKE provides only an API to LAPACK; it is not an implementation in its own right. The LAPACK implementation used in conjunction with LAPACKE can be the netlib implementation or optimised implementations (e.g. MKL). For example, to use the netlib implementation, ‘-llapacke -llapack -lblas’ must be added to the link line. The gfortran library (‘-lgfortran’) must also be added if the GNU compiler suite is used and gcc/g++ is used as the linker.


BSD (three-clause)

Admin notes

Whilst we already had optimised implementations of LAPACK and BLAS, some people just prefer the default version (or are following instructions which assume that the netlib implementation is the only implementation available. There is also an example file for the GCC and for the Intel compilers in the INSTALL directory which needs to be copied to the root directory. In addition, I set BLASLIB to libblas.a rather than librefblas.a for historical compatibility.

Building then amounted to running

cp INSTALL/ # similarly for the Intel compilers
ulimit -s unlimited
make -j12 blaslib all
make blas_testing lapack_testing
make lapacke

Note the stack size must be increased from the default (small) value for a few of the tests to successfully run.

I created the directory structure and copied the compiled libraries by hand. I ensured the BLAS, LAPACK and LAPACKE libaries were named libblas.a, liblapack.a and liblpacke.a respectively. LAPACKE also requires copying supplied header files to the appropriate include subdirectory.