Skip to content

How to install ABINIT v9 on CentOS

This step-by-step recipe describes how to build ABINIT on Fedora/RHEL/CentOS *nix distributions. Tested with CentOS 8.2

Quick Guide for the Impatient

Quick Guide for the Impatient (MKL version)

Prerequisites

  1. Fortran compiler

    Possible options:

    • gfortran, the GNU compiler. (https://gcc.gnu.org/)
    • ifort, the intel compiler. This is a commercial compiler, slightly more complicated to use but more optimized for intel architecture.
  2. Python interpreter (v3.7+ recommended)

  3. MPI library (if you want to benefit from parallelism; recommended).

    Possible options:

  4. Linear Algebra library

    Possible options:

    • MKL (IntelĀ® Math Kernel Library): Free Download, recommended for performance
    • OpenBLAS: An optimized BLAS library, recommended with GNU.
    • Netlib: blas, lapack, scalapack
    • ATLAS: Automatically Tuned Linear Algebra Software
  5. Mandatory libraries:

    • HDF5: High-performance data management and storage suite
    • NetCDF: Network Common Data Form
    • libXC: Library of exchange-correlation functionals
  6. Optional libraries:

    • FFTW3: Library for computing the discrete Fourier transform, recommended with GNU
    • libxml2: XML C parser, recommended for multibinit
    • Wannier90
    • LibPSML + xmlf90 to read pseudopotentials in psml format

Installation of tools and libraries

All mandatory libraries are installed through the DNF package manager. For other optional libraries, compilation from source is needed.

The steps required to install MPICH, fftw3 and OpenBLAS with dnf and compile a relatively simple parallel version of ABINIT are summarized below:

  1. Install the compiler

    sudo dnf install gcc-gfortran

  2. Install the MPI library (MPICH)

    sudo dnf install mpich mpich-devel

  3. Install the linear algebra library (OpenBLAS)

    sudo dnf install openblas

  4. Install other mandatory libraries (use hdf5 with support for parallel MPI-IO)

    sudo dnf install hdf5-mpich hdf5-mpich-devel

    sudo dnf install netcdf-mpich-devel netcdf-fortran-mpich-devel

    sudo dnf install libxc libxc-devel

  5. Install fftw3

    sudo dnf install fftw fftw-devel

  6. Install the python interpreter

    sudo dnf install python3

Important

Before continuing, it is important to test whether your development environment is properly configured. To check whether the MPICH package is installed, execute the following command:

mpif90 --version

If the output is:

bash: mpif90: command not found...

then, you need to find out where the MPI wrappers are installed.

If you installed the MPICH package via dnf, the installation directories can be obtained by using e.g.

rpm -ql mpich-devel | grep mpif90

that should print

/usr/lib64/mpich/bin/mpif90

The $PATH variable needs to be updated:

export PATH=/usr/lib64/mpich/bin:$PATH

mpif90 --version

GNU Fortran (GCC) 8.3.1 20191121 (Red Hat 8.3.1-5)
/usr/lib64/mpich/bin/mpif90

Compiling, testing and installing ABINIT

Download ABINIT.

For normal users, it is advised to get the latest stable version from our website (replace 9.0.4 by the newest version available).

wget https://www.abinit.org/sites/default/files/packages/abinit-9.0.4.tar.gz
tar xzf abinit-9.0.4.tar.gz
cd abinit-9.0.4

Create a working directory:

mkdir build && cd build

Configure with:

../configure --with-config-file='my_config_file.ac'

where my_config_file.ac is an external file providing all the configuration flags and options. More on the configure options is presented in next section.

Compile with:

make -j 4

where -j 4 means that 4 cores are used to compile. Adjust this value according to number of physical cores available on your machine.

To run the test suite, issue:

cd tests
./runtests.py fast -j 4

Important

At the end of the test, one should get something like:

Suite   failed  passed  succeeded  skipped  disabled  run_etime  tot_etime
fast         0       0         11        0         0      27.72      27.98

Completed in 9.95 [s]. Average time for test=2.52 [s], stdev=2.94 [s]
Summary: failed=0, succeeded=11, passed=0, skipped=0, disabled=0

otherwise there is a problem with the compilation: see Troubleshooting

Install (optional):

make install

The configuration file

The configure command takes in input variables and flags. For example:

../configure --with-mpi="yes"

tells ABINIT to enable MPI support. All the variables and flags supported by the script can be found by typing:

../configure --help

Some options are detected automatically by the script. For example, with the option --with-mpi="yes", ABINIT will try to use the parallel fortran compiler found in $PATH (e.g. mpifort) and will try to detect the directories containing the libraries and the associated header files required by MPI.

When a lot of options are needed, it is advised to use a config file.

The .ac file for our simple parallel ABINIT build based on OpenBLAS is:

# installation location
prefix=$HOME/local

# MPI settings
with_mpi="yes"
enable_mpi_io="yes"

# linear algebra settings
with_linalg_flavor="openblas"
LINALG_LIBS="-L/usr/lib64 -lopenblas"

# mandatory libraries
with_hdf5="yes"
with_netcdf="yes"
with_netcdf_fortran="yes"
with_libxc="yes"

# FFT flavor
with_fft_flavor="fftw3"
FFTW3_LIBS="-L/usr/lib64 -lfftw3 -lfftw3f"

# Enable Netcdf mode in Abinit (use netcdf as default I/O library)
enable_netcdf_default="yes"

Important

The name of the options in the .ac files is in normalized form that is the initial -- is removed from the option name and all the other - characters in the string are replaced by an underscore _. Following these simple rules, the configure option --with-mpi becomes with_mpi in the ac file.

Quick Guide for the impatient

We will build ABINIT with the following components:

  • GNU compilers
  • MPICH
  • OpenBLAS
  • FFTW3

Installing required packages

sudo dnf install gcc-gfortran
sudo dnf install mpich mpich-devel
sudo dnf install openblas
sudo dnf install hdf5-mpich hdf5-mpich-devel
sudo dnf install netcdf-mpich-devel netcdf-fortran-mpich-devel
sudo dnf install libxc libxc-devel
sudo dnf install fftw fftw-devel
sudo dnf install python3

Getting the ABINIT tarball

wget https://www.abinit.org/sites/default/files/packages/abinit-9.0.4.tar.gz
tar xzf abinit-9.0.4.tar.gz
cd abinit-9.0.4
mkdir build && cd build
export PATH=/usr/lib64/mpich/bin:$PATH

Creating a config file

Edit a config.ac file:

# installation location
prefix=$HOME/local

# MPI settings
with_mpi="yes"
enable_mpi_io="yes"

# linear algebra settings
with_linalg_flavor="openblas"
LINALG_LIBS="-L/usr/lib64 -lopenblas"

# mandatory libraries
with_hdf5="yes"
with_netcdf="yes"
with_netcdf_fortran="yes"
with_libxc="yes"

# FFT flavor
with_fft_flavor="fftw3"
FFTW3_LIBS="-L/usr/lib64 -lfftw3 -lfftw3f"

# Enable Netcdf mode in Abinit (use netcdf as default I/O library)
enable_netcdf_default="yes"

Compiling ABINIT

../configure -q --with-config-file='config.ac'
make -j 8

Testing ABINIT

cd tests
export OPENBLAS_NUM_THREADS=1
./runtest.py fast -j 8 --no-logo

Installing ABINIT

make install

Quick Guide for the impatient (MKL version)

We will build ABINIT with the following components:

  • GNU compilers
  • MPICH
  • MKL

Installing needed packages

sudo dnf install gcc-gfortran
sudo dnf install mpich mpich-devel
sudo dnf install hdf5-mpich hdf5-mpich-devel
sudo dnf install netcdf-mpich-devel netcdf-fortran-mpich-devel
sudo dnf install libxc libxc-devel
sudo dnf install python3

Getting the ABINIT tarball

wget https://www.abinit.org/sites/default/files/packages/abinit-9.0.4.tar.gz
tar xzf abinit-9.0.4.tar.gz
cd abinit-9.0.4
mkdir build && cd build
export PATH=/usr/lib64/mpich/bin:$PATH

Creating a configuration file

Edit a config.ac file:

# installation location
prefix=$HOME/local

# MPI settings
with_mpi="yes"
enable_mpi_io="yes"

# linear algebra settings
with_linalg_flavor="mkl"
LINALG_CPPFLAGS="-I${MKLROOT}/include"
LINALG_FCFLAGS="-I${MKLROOT}/include"
LINALG_LIBS="-L${MKLROOT}/lib/intel64 -Wl,--start-group  -lmkl_gf_lp64 -lmkl_sequential -lmkl_core -Wl,--end-group"

# mandatory libraries
with_hdf5="yes"
with_netcdf="yes"
with_netcdf_fortran="yes"
with_libxc="yes"

# FFT flavor
with_fft_flavor="dfti"
FFT_FCFLAGS="-I${MKLROOT}/include"

# Enable Netcdf mode in Abinit (use netcdf as default I/O library)
enable_netcdf_default="yes"

Compiling ABINIT

../configure --with-config-file='config.ac'
make -j 8

Testing ABINIT

cd tests
export MKL_NUM_THREADS=1
./runtest.py fast -j 8 --no-logo

Installing ABINIT

make install