Quantum-espresso¶
How to use Quantum ESPRESSO on Arrhenius¶
Quantum ESPRESSO is available through the module system. To check which versions are available before loading a module:
To load the 7.6 version of the program for CPU nodes:
For supercomputers with a Lustre-based shared file system, such as the one mounted on Arrhenius, keep the main input and output files on the shared file system and store temporary files and wavefunction output on the node-local scratch directory whenever possible. This can be done by adding wfcdir = '/scratch/local/' to the QE input file. Moreover, to avoid unnecessary read/write of large output files, it is advisable to use QE options such as disk_io = 'low' and wf_collect = .false.. For some runs, these settings can substantially reduce excessive file I/O.
Example job scripts for Arrhenius CPU nodes¶
Replace naissYYYY-X-XXX-cpu in the examples below with your project account.
Example 1: single node, pure MPI¶
This example uses 256 MPI ranks with one core per rank, filling all physical cores on one CPU node.
#!/bin/bash
#SBATCH --job-name=qe-mpi
#SBATCH --account=naissYYYY-X-XXX-cpu
#SBATCH --partition=cpu
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=256
#SBATCH --cpus-per-task=1
#SBATCH --time=02:00:00
ml QuantumESPRESSO/7.6-gcc-2026.03-mpich-eb
# One thread per MPI rank, including numerical libraries
export OMP_NUM_THREADS=1
export OPENBLAS_NUM_THREADS=1
mpprun pw.x -in scf.in > scf.out
For smaller calculations, reduce --ntasks-per-node, for example to 32 or 64. Using more MPI ranks does not necessarily improve performance. Benchmark a few values to find a suitable setting for your system.
Example 2: single node, hybrid MPI + OpenMP¶
This example uses 64 MPI ranks with four OpenMP threads per rank, using 256 physical cores in total.
#!/bin/bash
#SBATCH --job-name=qe-hybrid
#SBATCH --account=naissYYYY-X-XXX-cpu
#SBATCH --partition=cpu
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=64
#SBATCH --cpus-per-task=4
#SBATCH --time=02:00:00
ml QuantumESPRESSO/7.6-gcc-2026.03-mpich-eb
# OpenMP threads per MPI rank
export OMP_NUM_THREADS="$SLURM_CPUS_PER_TASK"
# Keep BLAS thread counts low to avoid oversubscription
# OpenMP-based numerical routines follow OMP_NUM_THREADS
export OPENBLAS_NUM_THREADS=1
mpprun pw.x -in scf.in > scf.out
Possible full-node configurations to benchmark include:
| MPI ranks per node | OpenMP threads per rank | Cores per node |
|---|---|---|
| 256 | 1 | 256 |
| 128 | 2 | 256 |
| 64 | 4 | 256 |
| 32 | 8 | 256 |
Change --ntasks-per-node and --cpus-per-task together. These settings keep the total number of physical cores used per node constant while changing the MPI/OpenMP balance.
Example 3: two nodes, hybrid MPI + OpenMP¶
This example uses 64 MPI ranks per node and four threads per rank:
- 128 MPI ranks in total
- 256 physical cores per node
- 512 physical cores across two nodes
#!/bin/bash
#SBATCH --job-name=qe-2nodes
#SBATCH --account=naissYYYY-X-XXX-cpu
#SBATCH --partition=cpu
#SBATCH --nodes=2
#SBATCH --ntasks-per-node=64
#SBATCH --cpus-per-task=4
#SBATCH --time=04:00:00
ml QuantumESPRESSO/7.6-gcc-2026.03-mpich-eb
export OMP_NUM_THREADS="$SLURM_CPUS_PER_TASK"
export OPENBLAS_NUM_THREADS=1
mpprun pw.x -in scf.in > scf.out
Benchmark against the single-node case before using this configuration routinely. Communication between nodes can outweigh the benefit of additional cores for smaller systems.
K-point parallelism¶
The examples above leave QE's parallelization parameters at their automatically selected values.
For calculations with sufficient k-points, explicitly distributing them among pools may improve performance. For example, replace the execution line in the two-node script with:
This divides the 128 MPI ranks into eight pools of 16 ranks. Each MPI rank still uses four OpenMP threads.
Choose a pool count that divides the MPI rank count. For balanced work, the number of k-points actually calculated after symmetry reduction should ideally also be divisible by the pool count. For a Gamma-point-only calculation, use one pool (-nk 1) or leave the setting automatic.
Check the output file, here scf.out, for the expected MPI ranks, OpenMP threads, and parallelization layout.
For more advanced parallelization options, see the Quantum ESPRESSO user guide: https://www.quantum-espresso.org/Doc/user_guide/node20.html.
Notes¶
For a first job on Arrhenius CPU nodes, a practical starting configuration is the single-node hybrid case:
- 64 MPI ranks per node
- 4 OpenMP threads per rank
- 1 node
This is a useful baseline for benchmarking before moving to larger jobs or multi-node runs.
If memory usage is too high, reduce the number of MPI ranks or use fewer OpenMP threads per rank. Alternatively, you may use the fat partition.
If performance is poor, benchmark a few combinations of MPI ranks and OpenMP threads instead of assuming that the largest job is always best.
The exact optimal MPI/OpenMP balance depends on the size of the system, the number of k-points, and the memory footprint of the calculation. Start with a conservative configuration, test performance, and scale up only if the workload benefits from it.
Example job scripts for Arrhenius GPU nodes¶
To load the 7.6 version of the program for GPU nodes:
Replace naissYYYY-X-XXX-gpu in the examples below with your project account.
Example 1: On a single Grace Hopper superchip¶
#!/bin/bash
#SBATCH -A naissYYYY-X-XXX-cpu
#SBATCH -p gpu
#SBATCH -t 01:00:00
#SBATCH -n 1
#SBATCH -c 72
#SBATCH --gpus=1
#SBATCH -J qe
#SBATCH --network=single_node_vni
export SRUN_CPUS_PER_TASK=$SLURM_CPUS_PER_TASK
export OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK
# Load the environment
ml GPU/buildtool-easybuild/5.2.1-hpca3ef7d197
ml nvmpichcnvpl/25.9
# Load the program
ml QuantumESPRESSO/7.6
# Launch the executable
echo "Program initiated at `date` on `hostname`"
time mpprun pw.x < batio3_ortho.scf.in > batio3_ortho.scf.out
echo "Program finished at `date` on `hostname`"
Example 2: On two GPU nodes, in total 8 Grace Hopper superchips¶
#!/bin/bash
#SBATCH -A naissYYYY-X-XXX-gpu
#SBATCH -p gpu
#SBATCH -t 01:00:00
#SBATCH -N 2
#SBATCH -n 8
#SBATCH -c 72
#SBATCH --gpus=8
#SBATCH -J qe
export SRUN_CPUS_PER_TASK=$SLURM_CPUS_PER_TASK
export OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK
# Load the environment
ml GPU/buildtool-easybuild/5.2.1-hpca3ef7d197
ml nvmpichcnvpl/25.9
# Load the program
ml QuantumESPRESSO/7.6
# Launch the executable
echo "Program initiated at `date` on `hostname`"
time mpprun pw.x < batio3_ortho.scf.in > batio3_ortho.scf.out
echo "Program finished at `date` on `hostname`"
Notes¶
For a first job on Arrhenius GPU nodes, the general advice is to start running on a single Grace Hopper superchip. Experiment with the number of CPU threads by reducing from 72 in #SBATCH -c 72 to smaller numbers, for instance 8 or 16. Sometime a higher performance can be achieved when using fewer CPU cores per GPU.
Source repository