# BLAS and LAPACK: Numerical Linear Algebra

## BLAS

The **B**asic **L**inear **A**lgebra **S**ubroutines provide a standardized interface for baseline numeric vector and matrix operation that is often needed in scientific codes. The interface is documented as part of the BLAS project, and a reference implementation is also supplied. However, in practice one should **always** use a vendor optimized implementation (see below) of this library to achieve high usage efficiency.

## LAPACK

The **L**inear **A**lgebra **PACK**age supplies a standardized interface for solution of more advanced and complex problems (e. g. matrix decompositions or eigenvalue problems) from linear algebra. The interface is documented as part of the LAPACK project, and a reference implementation is also supplied. Again, a vendor optimized implementation should normally be used. Note that LAPACK builds upon BLAS for its implementation, so the two libraries usually come bundled.

## Use of BLAS and/or LAPACK on LRZ HPC systems

Note that the libraries from the reference implementation usually are linked with a command like

f90 -o myprog.exe myprog.f90 |

(using the generic name "f90" for the Fortran compiler here), and therefore many build systems use this linkage. However this will **usually not work** on the LRZ HPC systems; you will need to replace the library specification by something like

f90 -o myprog.exe myprog.f90 $MKL_LIB |

assuming that you are using Intel's Math Kernel Library (MKL) implementation of BLAS and LAPACK.

### Available implementations

- Intel MKL
- NAG libraries
- GNU Scientific Library (unoptimize C interface to BLAS only)

### Further implementations

The versions listed here are **not currently supported** by LRZ on its HPC systems; however you might want to try them out on your own:

Furthermore, implementations exist that are targetted at different architectures:

- ACML (targeted to AMD processors, but retired)
- ESSL (an IBM product built for use on POWER processors)
- cuBLAS / CULA (targeted for use on NVidia GPUs)

## Further information

On the NAG web site, some examples for invocations of LAPACK routines are provided.