From Fedora Project Wiki
This page is a draft only
It is still under construction and content may change. Do not rely on the information on this page.


Besides being implementations, BLAS and LAPACK are also API standards for basic linear algebra operations (such as vector and matrix multiplication). Many implementations of these API exist. The reference implementation of BLAS and LAPACK from Netlib is very stable but is not as fast as optimized ones such as ATLAS and OpenBLAS.

Implementations of BLAS:

  • blas - Reference implementation from Netlib.
  • atlas - Automatically Tuned Linear Algebra Software.
  • openblas - OpenBLAS, an optimized BLAS based on GotoBLAS2. It provides several flavors: a sequential version, a threaded one, and another with OpenMP support (all of them with or without support for 64-bit integers).

Implementations of LAPACK:

  • lapack - Reference implementation from Netlib.
  • ATLAS and OpenBLAS both provide an optimized subset of LAPACK.

Due to implementation differences, it is important that all components of a particular software stack link to the same BLAS/LAPACK implementation. Also, users may want to choose a particular implementation that works best for them at run time. This guideline gives a structure that can enforce the first while allowing the second, as well as providing a transparent fallback mechanism to Netlib's reference implementation for those symbols not included in the selected backend.


FlexiBLAS is a framework that wraps both BLAS and LAPACK APIs in a single library. BLAS/LAPACK consumers must link against FlexiBLAS, and this wrapper is able to redirect calls to a selected optimized backend with negligible overhead. It also provides transparent fallback to Netlib's reference implementation if a certain symbol is not present in the selected backend. These are the main features:

  • Provides a 100% BLAS and LAPACK compatible ABI/API, with interfaces for both 32- and 64-bit integers.
  • Runtime exchangable BLAS and LAPACK backend without recompilation via an environment variable.
  • Integration of user-owned BLAS libraries without administrator privileges, even in system-wide installed programs.
  • Works with OpenBLAS, ATLAS, Intel MKL, ACML, ...
  • Flexible per-system/user/host configuration files.
  • Basic profiling support.

FlexiBLAS provides a common interface,

%files wrapper

%files wrapper64

as well as fallbacks to Netlib's reference implementation,

%files wrapper

%files wrapper64

and, finally, several wrappers for different implementations under different names:

%files atlas

%files openblas-serial

%files openblas-threads

%files openblas-openmp

%files openblas-serial64

%files openblas-threads64

%files openblas-openmp64

These are sub-packaged separately to avoid pulling the whole stack of implementations. The wrapper and wrapper64 sub-packages require a default implementation:

%global default_backend openblas-serial

%package        wrapper
Requires:       %{name}%{?_isa} = %{version}-%{release}
Requires:       %{name}-%{default_backend}%{?_isa} = %{version}-%{release}

%package        wrapper64
Requires:       %{name}%{?_isa} = %{version}-%{release}
Requires:       %{name}-%{default_backend}64%{?_isa} = %{version}-%{release}

Packaging guidelines

BLAS/LAPACK implementations

Implementations of BLAS and/or LAPACK available in Fedora do not need to change anything.

BLAS/LAPACK dependent packages

Consumers of any subset of BLAS and/or LAPACK must compile against FlexiBLAS:

BuildRequires: pkgconfig(flexiblas)


BuildRequires: pkgconfig(flexiblas64)

and they will automatically benefit from any system/user/host-selected optimized subset of routines.

Backend selection

System-level selection

To allow system-level selection of the desired BLAS/LAPACK implementation, a "default=IMPLEMENTATION-NAME" key must be added to the configuration files shipped with FlexiBLAS:

%files wrapper
%config(noreplace) %{_sysconfdir}/flexiblasrc

%files wrapper64
%config(noreplace) %{_sysconfdir}/flexiblasrc64

User-level selection

Persistent user-level selection of system-provided BLAS/LAPACK implementations can be done via the CLI tool:

$ flexiblas64 set IMPLEMENTATION-NAME

provided the sub-package for IMPLEMENTATION-NAME is installed.

Non-persistent user-level selection can be triggered via an environment variable:


User-level selection of user-owned BLAS/LAPACK libraries can be achieved just by changing IMPLEMENTATION-NAME with a path to any custom BLAS/LAPACK-compatible library in the examples above.