Handle different versions of BLAS and LAPACK


Beside being implementations, BLAS and LAPACK are also API standard for basic linear algebra operations (such as vector and matrix multiplication).

Many implementations of these API exist. The reference implementation of BLAS and LAPACK is very stable but is not as fast as optimized ones such as ATLAS and OpenBLAS.

Implementations of BLAS:

Implementations of LAPACK:

How to switch from an implementation to the other

It is just trivial. It can be used like any other software using update-alternatives.


update-alternatives --config libblas.so.3


There are 3 choices for the alternative libblas.so.3 (providing /usr/lib/libblas.so.3).

  Selection    Path                                     Priority   Status
* 0            /usr/lib/openblas-base/libopenblas.so.0   40        auto mode
  1            /usr/lib/atlas-base/atlas/libblas.so.3    35        manual mode
  2            /usr/lib/libblas/libblas.so.3             10        manual mode
  3            /usr/lib/openblas-base/libopenblas.so.0   40        manual mode


update-alternatives --config liblapack.so.3


There are 2 choices for the alternative liblapack.so.3 (providing /usr/lib/liblapack.so.3).

  Selection    Path                                      Priority   Status
* 0            /usr/lib/lapack/liblapack.so.3             10        auto mode
  1            /usr/lib/atlas-base/atlas/liblapack.so.3   5         manual mode
  2            /usr/lib/lapack/liblapack.so.3             10        manual mode

Note that even though the LAPACK implementation of ATLAS is more powerful than Netlib's reference LAPACK, it is given a lower priority (as a workaround for 624318 and its clones). The optimized LAPACK can still be manually chosen.

Getting the best performance out of ATLAS and OpenBLAS

The binary packages of ATLAS and OpenBLAS distributed by Debian are generic packages, which are not optimized for your specific machine.

The optimal way of using these two packages is to recompile them locally on the machines on which they are to be used. See the README.Debian file of the respective packages for details on how to achieve that easily.