ABINIT
IMPORTANT:
The information provided on this page is valid for Abinit 8.5 and future versions only.

Configuring linear algebra

Underlying concepts

Linear algebra is the most critical dependency to consider since Abinit could not be built nor run without it. It is also the most complex one, due to:

It logically corresponds to the most complex core block of the build system. On one side, there are vendors, who develop specific components for specific architectures. On another side, there are architectures, which include various kinds of optimizations and offer various degrees of parallelism. And on a third side, there are components, defined by the kind of mathematical operations they provide and the architectures they aim at.

We have designed our implementation to cover the highest possible number of cases while preserving a relative simplicity in the configuration of their parameters. For this, we have grouped the three above concepts under flavors that users select depending on their situations and preferences.

Tip: This document is best understood when consulted peacefully. Please take your time to read it and feel free to come back as many times as you wish.

Linear algebra flavors

For the sake of clarity, we provide here three different perspectives on the linear algebra flavors supported by Abinit and their relationships with the other concepts. The build system lets you configure linear algebra from each of these three perspectives, mainly by setting its with_linalg_flavor option in different ways (explained in detail below). You can choose between:

The following table lists the available flavors supported by Abinit and their relationships with the other relevant concepts:

Flavor Vendor Software project Architectures Components
acml AMD ACML serial blas, lapack
atlas LSU ATLAS serial blas
elpa2014 MPCDF ELPA 2014 mpi elpa
elpa2015 MPCDF ELPA 2015 mpi elpa
elpa2016 MPCDF ELPA 2016 mpi elpa
elpa2017 MPCDF ELPA 2017 mpi elpa
essl IBM ESSL serial, openmp, mpi blas, lapack, scalapack
magma10 UTK MAGMA 1.0 gpu magma
magma15 UTK MAGMA 1.5 gpu magma
magma25 UTK MAGMA 2.5 gpu magma
mkl Intel MKL serial, openmp, mpi blas, lapack, scalapack
netlib Netlib Netlib Repository serial, mpi blas, lapack, lapacke, scalapack
openblas Zhang Xianyi OpenBLAS serial blas
plasma1 UTK PLASMA openmp plasma

Please refer to the instructions of each vendor listed above by clicking on the corresponding link to obtain information on how to install their linear algebra implementation.

Automatic detection

By default, the build system assumes that you want the fastest possible linear algebra operations. When no linear algebra option is specified, it thus looks for each component as soon as its prerequisites are met. The only required components are BLAS and LAPACK, since Abinit relies on them in each and every situation. Unless forced by the user, the other components are enabled only if their prerequisites are met, their detection succeeds, and they are proved working.

In the absence of any option, the build system will use an internal heuristic to look for linear algebra libraries and enable/disable components depending on the following criteria:

In all cases, the build system will try to mitigate side effects on other components, e.g., FFT, but there is no guarantee that it will succeed by itself. This selection and detection process is known to work in the most common cases. If you have a customized linear algebra configuration, you will likely want to use some options to direct the build system to the right libraries and give it instructions to minimize side effects.

Linear algebra options

To deal more easily with the various linear algebra implementations that can be used concurrently on the same computer, Abinit provides the with_linalg_flavor option. It will tune the detection tests made by the build system so that the probability of finding the correct libraries and setting up the environment is maximized.

Tip: Please note that, when using with_linalg_flavor, the LD_LIBRARY_PATH and PATH environment variables must be properly set for the detection to succeed, particularly if you do not specify any other linear algebra option.

You can tune the detection mechanism through the with_linalg_flavor option in three ways:

Please note that you can only use one of these three methods at a time. Mixes are explicitly forbidden. Omitting an architectural item or a linear algebra component with the two latter methods will be equivalent to disabling this element.

The other options provide hints to the build system and determine which kinds of tests will be performed:

Creating your own blend of flavors

Example:

with_linalg_flavor="openblas+netlib"

will cause the build system to look for OpenBLAS for the blas component and use Netlib for the other ones, i.e., lapack for the serial case and scalapack if MPI is enabled in the current build. Unspecified components will be detected using the default behavior, e.g., the build system will look for all available implementations of elpa if MPI is enabled but do nothing if MPI is disabled.

Architecture-first method

Example:

with_linalg_flavor="serial:atlas+netlib,mpi:netlib,gpu:magma15"

will cause the build system to look for Atlas for blas, Netlib for lapack and scalapack, and MAGMA 1.5 for magma. However, it will never look for elpa, since it has not been explicitly stated, and will stop with an error if one of the specified elements is not present or not working. When using this method, you must specify the serial block. If one of the blas or lapack components is omitted, then netlib is assumed.

The following table links the serial and multicore architectures supported by Abinit with the other relevant concepts:

Architecture Flavors Components
serial acml, atlas, essl, mkl, netlib, openblas blas, lapack
openmp essl, plasma1 plasma
mpi elpa2014, elpa2015, essl, mkl, netlib elpa, scalapack
gpu magma10, magma15 magma

Component-first method

Example:

with_linalg_flavor="blas:atlas,lapack:netlib,elpa:elpa2015"

will cause the build system to look for the blas, lapack, and elpa components, but not for scalapack, even if MPI is enabled. It will also fail if any component is missing or not working. When using this method, you must specify the blas and lapack components.

The following table summarizes the linear algebra components supported by Abinit and their relationships with the other relevant concepts:

Component Type Flavors Remarks
blas Mandatory acml, asl, essl, atlas, mkl, netlib, openblas Required in any case
lapack Mandatory acml, asl, essl, mkl, netlib Requires BLAS
lapacke Optional netlib Requires LAPACK
scalapack Optional mkl, netlib Requires MPI and LAPACK
elpa Optional elpa2014, elpa2015 Requires MPI and LAPACK
plasma Optional plasma1 Requires OpenMP (caveats)
magma Optional magma10, magma15 Requires MPI and GPU