Building Quantum Espresso on Caviness/DARWIN

The build procedure outlined herein uses Open MPI on top of the Intel compiler suite.

To begin, choose a directory in which the Quantum Espresso version(s) will be built and installed. To build in your home directory, for example:

[user@login00.darwin ~]$ QE_BASEDIR=~/sw/quantum-espresso
[user@login00.darwin ~]$ QE_BASEDIR_PRIVS=0700

If you are managing Quantum Espresso software for your entire workgroup, you could instead use

[user@login00.darwin ~]$ QE_BASEDIR="${WORKDIR}/sw/quantum-espresso"
[user@login00.darwin ~]$ QE_BASEDIR_PRIVS=2770

If the directory hierarchy does not yet exist, it can be setup using

[user@login00.darwin ~]$ mkdir -p -m $QE_BASEDIR_PRIVS "${QE_BASEDIR}"

In this example version 7.3 of quantum-espresso will be built. Our standard recipes for quantum-espresso will entail use of the Intel compilers, the MKL for BLAS/LAPACK/FFTW/ScaLAPACK/BLACS, and Open MPI for parallelism.

Unpack "qe-7.3-ReleasePack.tar.gz" will create a directory to hold our base build of quantum-espresso 7.3, naming it with the version identifier: qe-7.3. The source is then unpacked therein:

[user@login00.darwin ~]$ tar -xvzf "${QE_BASEDIR}/qe-7.3-ReleasePack.tar.gz"

We use cmake for compilation and installation on "v7.3" directory.

[user@login00.darwin ~]$ QE_INSTALL_PREFIX="${QE_BASEDIR}/v7.3"
[user@login00.darwin ~]$ export QE_INSTALL_PREFIX
[user@login00.darwin ~]$ QE_SRC_PREFIX="${QE_BASEDIR}/qe-7.3"
[user@login00.darwin ~]$ mkdir -m $QE_BASEDIR_PRIVS "$QE_INSTALL_PREFIX"
[user@login00.darwin ~]$ QE_BUILDDIR="${QE_SRC_PREFIX}/build"
[user@login00.darwin ~]$ mkdir -m $QE_BASEDIR_PRIVS "$QE_BUILDDIR"
[user@login00.darwin ~]$ cd "$QE_BUILDDIR"

Our current working directory is now the build root. Here, we create build.sh :

build.sh.darwin
#!/bin/bash -l
 
vpkg_require cmake/3.28.3 openmpi/4.1.5:intel-oneapi-2023 git
 
PREFIX="${QE_INSTALL_PREFIX}"
 
cmake -DCMAKE_C_COMPILER=mpicc -DCMAKE_CXX_COMPILER=mpicxx \
-DCMAKE_Fortran_COMPILER=mpifort \
-DCMAKE_INSTALL_PREFIX="${PREFIX}" \
-DCMAKE_C_FLAGS="-msse3 -axsse3,sse4.2,AVX,core-AVX2,CORE-AVX512" \
-DCMAKE_Fortran_FLAGS="-msse3 -axsse3,sse4.2,AVX,core-AVX2,CORE-AVX512" \
-DQE_ENABLE_OPENMP=ON -DCMAKE_BUILD_TYPE:STRING=RELWITHDEBINFO ../
 
make -j 20
make install
build.sh.caviness
#!/bin/bash -l
 
vpkg_require cmake/3.28.3 openmpi/4.1.4:intel-oneapi-2023 git
 
PREFIX="${QE_INSTALL_PREFIX}"
 
cmake -DCMAKE_C_COMPILER=mpicc -DCMAKE_CXX_COMPILER=mpicxx \
-DCMAKE_Fortran_COMPILER=mpifort \
-DCMAKE_INSTALL_PREFIX="${PREFIX}" \
-DCMAKE_C_FLAGS="-msse3 -axsse3,sse4.2,AVX,core-AVX2,CORE-AVX512" \
-DCMAKE_Fortran_FLAGS="-msse3 -axsse3,sse4.2,AVX,core-AVX2,CORE-AVX512" \
-DQE_ENABLE_OPENMP=ON -DCMAKE_BUILD_TYPE:STRING=RELWITHDEBINFO ../
 
make -j 20
make install

Executing the script compile and install quantum-expresso 7.3.

[user@login00.darwin build]$ ./build.sh

With this version of quantum espresso built, the remaining step is to leverage VALET for setup of the runtime environment when you use the software. VALET automatically recognizes the standard directory layout, so configuring versions/variants of quantum espresso is very straightforward. First, note your installation path:

[user@login00.darwin build]$ vpkg_rollback all
[user@login00.darwin build]$ cd
[user@login00.darwin ~]$ echo $QE_BASEDIR
/home/user/sw/quantum-espresso

Since this build was done in the user's home directory, they were personal copies of the software and should use a VALET package definition file stored in ~/.valet

[user@login00.darwin ~]$ VALET_PKG_DIR=~/.valet ; VALET_PKG_DIR_MODE=0700

versus an installation made for an entire workgroup, which would store the VALET package definition files in $WORKDIR/sw/valet

[user@login00.darwin ~]$ VALET_PKG_DIR="$WORKDIR/sw/valet" ; VALET_PKG_DIR_MODE=2770

Whichever scheme is in-use, ensure the directory exists:

[user@login00.darwin ~]$ mkdir -p --mode=$VALET_PKG_DIR_MODE "$VALET_PKG_DIR"

VALET allows package definitions in a variety of formats (XML, JSON, YAML) but YAML tends to be the simplest format so we will use it here.

The package section of the definition file includes items that apply to all versions/variants of the software:

quantum-espresso:
    prefix: /home/user/sw/quantum-espresso
    description: quantum-espresso
    url: "https://www.quantum-espresso.org/"

The package identifier is the top-level key in the document — quantum-espresso — and the value of $QE_BASEDIR is the value of the prefix key in this section. The URL and description are information taken from the official quantum-espresso web site.

The versions key is used to provide a list of the versions/variants of the software:

quantum-espresso:
    prefix: /home/user/sw/quantum-espresso
    description: quantum-espresso
    url: "https://www.quantum-espresso.org/"
    
    versions:
        "v7.3":
            description: compiled with Open MPI, Intel compilers, MKL, ScaLAPACK
            dependencies:
                - openmpi/4.1.5:intel-oneapi-2023
 

The version identifier v7.3 is inferred to be the path prefix to the version in question here. The package's prefix (/home/user/sw/quantum-espresso) with the version identifier appended (/home/user/sw/quantum-espresso/v7.3) is implicit.

The implicit behavior is overridden by providing a prefix key in the version definition: a relative path is appended to the package's prefix, an absolute path is used as-is.

It is a good idea to specify which version definition should act as the default. This yields the following package definition file

quantum-espresso.vpkg_yaml.darwin
quantum-espresso:
    prefix: /home/user/sw/quantum-espresso
    description: quantum-espresso
    url: "https://www.quantum-espresso.org/"
    
    default-version: "v7.3"
    
    versions:
        "v7.3":
            description: compiled with Open MPI, Intel compilers, MKL, ScaLAPACK
            dependencies:
                - openmpi/4.1.5:intel-oneapi-2023
quantum-espresso.vpkg_yaml.caviness
quantum-espresso:
    prefix: /home/user/sw/quantum-espresso
    description: quantum-espresso
    url: "https://www.quantum-espresso.org/"
    
    default-version: "v7.3"
    
    versions:
        "v7.3":
            description: compiled with Open MPI, Intel compilers, MKL, ScaLAPACK
            dependencies:
                - openmpi/4.1.4:intel-oneapi-2023

saved at $VALET_PKG_DIR/quantum-espresso.vpkg_yaml.

The package definition file can be checked for proper syntax using the VALET command vpkg_check:

[user@login00.darwin ~]$ vpkg_check "$VALET_PKG_DIR/quantum-espresso.vpkg_yaml"
/home/user/.valet/quantum-espresso.vpkg_yaml is OK
[quantum-espresso] {
  contexts: all
  actions: {
    QUANTUM_DASH_ESPRESSO_PREFIX=${VALET_PATH_PREFIX} (contexts: development)
  }
  https://www.quantum-espresso.org/
  quantum-espresso
  prefix: /work/user/sw/quantum-espresso
  source file: /home/user/.valet/quantum-espresso.vpkg_yaml
  default version: quantum-espresso/v7.3
  versions: {
    [quantum-espresso/v7.3] {
      contexts: all
      dependencies: {
        openmpi/4.1.5:intel-oneapi-2023
      }
      compiled with Open MPI, Intel compilers, MKL, ScaLAPACK
      prefix: /work/user/sw/quantum-espresso/v7.3
    }
  }
}

The file had no errors in its YAML syntax. Notice also that the standard path (bin) is found and noted by VALET!

To load quantum-espresso 7.3 into the runtime environment, the vpkg_require command is used:

[user@login00.darwin ~]$ vpkg_require quantum-espresso/v7.3
Adding dependency `binutils/2.35.1` to your environment
Adding dependency `gcc/12.2.0` to your environment
Adding dependency `intel-oneapi/2023.0.0.25537` to your environment
Adding dependency `ucx/1.13.1` to your environment
Adding dependency `openmpi/4.1.5:intel-oneapi-2023` to your environment
Adding package `quantum-espresso/v7.3` to your environment
[user@login00.darwin ~]$ which pw.x
~/sw/quantum-espresso/v7.3/bin/pw.x

This is the wall time for the structure relaxation of silicon with respect to the number of cores. The wall time decreases with an increased number of cores.

  • technical/recipes/quantum-espresso.txt
  • Last modified: 2024-05-12 11:05
  • by bkang