Quantum ESPRESSO/PWSCF¶
Quantum ESPRESSO is an integrated suite of computer codes for electronic structure calculations and materials modeling at the nanoscale. It builds on the electronic structure codes PWscf, PHONON, CP90, D3Q, EPW, FPMD, and Wannier90. It is based on density-functional theory, plane waves, and pseudopotentials (both norm-conserving and ultrasoft).
Availability and Supported Architectures at NERSC¶
Quantum ESPRESSO is available at NERSC as a provided support level package. Quantum ESPRESSO 7.x supports GPU execution.
Versions Supported¶
| Perlmutter GPU | Perlmutter CPU |
|---|---|
| 7.x | 7.x |
Use the module avail espresso command to see a full list of available sub-versions.
Application Information, Documentation, and Support¶
Quantum ESPRESSO is freely available and can be downloaded from the Quantum ESPRESSO home page. See the preceding link for more resources, including documentation for building the code and preparing input files, tutorials, pseudopotentials, and auxiliary software. For troubleshooting, see the FAQ for solutions to common issues encountered while building and running the package. See the Quantum ESPRESSO users forum and mail archives for additional support-related questions. For help with issues specific to the NERSC module, please file a support ticket.
Using Quantum ESPRESSO at NERSC¶
Use the module avail command to see which versions are available and module load <version> to load the environment:
nersc$ module avail espresso
---------------------------------------- NERSC Modules ----------------------------------------
espresso/7.3.1-libxc-6.2.2-cpu espresso/7.5-libxc-7.0.0-cpu
espresso/7.3.1-libxc-6.2.2-gpu espresso/7.5-libxc-7.0.0-gpu (D)
Where:
D: Default Module
nersc$ module load espresso/7.5-libxc-7.0.0-gpu
The preceding command loads Quantum ESPRESSO 7.5 built for GPUs and linked to the LibXC v7.0.0 density functional library.
Sample Job Scripts¶
See the example jobs page for additional examples and information about jobs. For all routines except pw.x, run Quantum ESPRESSO in full MPI mode as there is currently no efficient OpenMP implementation available.
Sample job script for running Quantum ESPRESSO on Perlmutter GPU nodes
#!/bin/bash
#SBATCH -A <your account name> # e.g., m1111
#SBATCH -C gpu
#SBATCH -q regular
#SBATCH -N 2
#SBATCH -t 01:00:00
#SBATCH -J qe_job
ml espresso/7.5-libxc-7.0.0-gpu
export OMP_NUM_THREADS=1
export OMP_PLACES=threads
export OMP_PROC_BIND=spread
srun -n 8 -c 32 -G 8 --cpu-bind=cores --gpu-bind=none pw.x -input scf.in
Tip
For GPU runs, use 1 MPI-rank-per-GPU and set OMP_NUM_THREADS=1 to avoid oversubscribing each GPU.
Sample job script for running Quantum ESPRESSO on Perlmutter CPU nodes
#!/bin/bash
#SBATCH -A <your account name> # e.g., m1111
#SBATCH -C cpu
#SBATCH -q regular
#SBATCH -N 2
#SBATCH -t 01:00:00
#SBATCH -J qe_job
ml espresso/7.5-libxc-7.0.0-cpu
export OMP_NUM_THREADS=1
export OMP_PLACES=threads
export OMP_PROC_BIND=spread
srun -n 256 -c 2 --cpu-bind=cores pw.x -input scf.in
Tip
When running pw.x, Quantum Espresso v7.1 and later versions include an automated feature for selecting internal parallelization flags -nk, -nt, and -nd. We encourage users to run benchmark tests to determine the optimal values of these parameters for their systems of interest before beginning production runs.
Building Quantum ESPRESSO from Source¶
Some users may be interested in tweaking the Quantum ESPRESSO build parameters and building QE themselves. Quantum ESPRESSO tarballs are available for download at the developers' download page. One can also build Quantum ESPRESSO by cloning the GitHub repository using the following scripts:
Quantum ESPRESSO + LibXC (NVIDIA build targeting Perlmutter GPU)
#!/bin/bash
set -x
LIBXCVSN=7.0.0
QEVSN=7.5
# Download and extract libxc
curl -O https://gitlab.com/libxc/libxc/-/archive/${LIBXCVSN}/libxc-${LIBXCVSN}.tar.bz2 && tar -xjf libxc-${LIBXCVSN}.tar.bz2
# Get the archived QE tarball
wget https://gitlab.com/QEF/q-e/-/archive/qe-${QEVSN}/q-e-qe-${QEVSN}.tar.gz
tar -xvf q-e-qe-${QEVSN}.tar.gz
# Modules for GPU build
module reset
module load gpu PrgEnv-nvidia cray-hdf5-parallel cray-fftw
# Build LibXC with NVIDIA compilers
LIBXC_DIR_nv=${PWD}/libxc-${LIBXCVSN}-nvidia
cd libxc-${LIBXCVSN}
autoreconf -i
./configure CC=cc CXX=CC FC=ftn MPI90=ftn pgf90=ftn --prefix=${LIBXC_DIR_nv}
make -j 8 1>make.out 2>&1
make install
cd ..
# Build QE with NVIDIA compilers
cd q-e-qe-${QEVSN}
mkdir build-nvidia && cd build-nvidia
cmake -DCMAKE_INSTALL_PREFIX=${PWD}/../../qe-${QEVSN}-gpu-build -DCMAKE_C_COMPILER=cc -DCMAKE_CXX_COMPILER=CC -DCMAKE_Fortran_COMPILER=ftn -DCMAKE_SYSTEM_NAME=CrayLinuxEnvironment -DQE_ENABLE_OPENACC=ON -DQE_ENABLE_OPENMP=ON -DQE_ENABLE_CUDA=ON -DQE_ENABLE_HDF5=ON -DQE_ENABLE_LIBXC=ON -DQE_ENABLE_PLUGINS=pw2qmcpack -DLIBXC_ROOT=${LIBXC_DIR_nv} ..
make -j 8 all 1>all.out 2>&1
make install
cd ../..
Quantum ESPRESSO + LibXC (GNU build targeting Perlmutter CPU)
#!/bin/bash
set -x
LIBXCVSN=7.0.0
QEVSN=7.5
# Download and extract libxc
curl -O https://gitlab.com/libxc/libxc/-/archive/${LIBXCVSN}/libxc-${LIBXCVSN}.tar.bz2 && tar -xjf libxc-${LIBXCVSN}.tar.bz2
# Get the archived QE tarball
wget https://gitlab.com/QEF/q-e/-/archive/qe-${QEVSN}/q-e-qe-${QEVSN}.tar.gz
tar -xvf q-e-qe-${QEVSN}.tar.gz
# Modules for CPU build
module reset
module load cpu PrgEnv-gnu cray-hdf5-parallel cray-fftw
# Build LibXC with GNU compilers
LIBXC_DIR_gnu=${PWD}/libxc-${LIBXCVSN}-gnu
cd libxc-${LIBXCVSN}
autoreconf -i
./configure CC=cc CXX=CC FC=ftn MPI90=ftn --prefix=${LIBXC_DIR_gnu}
make -j 8 1>make.out 2>&1
make install
cd ..
# Build QE with GNU compilers
cd q-e-qe-${QEVSN}
mkdir build-gnu && cd build-gnu
cmake -DCMAKE_INSTALL_PREFIX=${PWD}/../../qe-${QEVSN}-cpu-build -DCMAKE_C_COMPILER=cc -DCMAKE_CXX_COMPILER=CC -DCMAKE_Fortran_COMPILER=ftn -DCMAKE_SYSTEM_NAME=CrayLinuxEnvironment -DQE_ENABLE_OPENMP=ON -DQE_ENABLE_HDF5=ON -DQE_ENABLE_LIBXC=ON -DQE_ENABLE_PLUGINS=pw2qmcpack -DLIBXC_ROOT=${LIBXC_DIR_gnu} ..
make -j 8 all 1>all.out 2>&1
make install
cd ../..
Tip
To run the included examples, you may need to modify the prefix and directory paths in the file environment_variables in the main QE directory.
Related Applications¶
User Contributed Information¶
Please help us improve this page
Users are invited to contribute helpful information and corrections through our GitLab repository.