Skip to main content
Texas Tech University

Quantum ESPRESSO

Introduction

Quantum ESPRESSO (Quantum Open-Source Package for Research in Electronic Structure, Simulation, and Optimization) is a free, open-source software suite for electronic-structure calculations and materials modeling at the nanoscale. Coordinated by the Quantum ESPRESSO Foundation and licensed under the GNU General Public License, it uses density-functional theory (DFT), plane-wave basis sets, and pseudopotentials to simulate materials from first principles.

Running Quantum ESPRESSO in HPCC

Submitting a Quantum ESPRESSO job to Nocona

There are two MPI Quantum ESPRESSO (QE) modules in Nocona: QE built against GCC 14.2.0 and QE built against AOCC 4.2.0.

Create a job submission script with the following content as a reference:

#!/bin/bash 
#SBATCH --job-name=qe_gcc
#SBATCH --output=%x.o%j 
#SBATCB --error=%x.e%j 
#SBATCH --partition=nocona 
#SBATCH --nodes=1 
#SBATCH --ntasks-per-node=32
#SBATCH --cpus-per-task=4
#SBATCH --time=10:00:00 

module load gcc/14.2.0 openmpi/5.0.5 quantum-espresso/7.3.1-mpi-omp

# Set 4 OpenMP threads per MPI rank 
export OMP_NUM_THREADS=4 
export OMP_PLACES=cores 
export OMP_PROC_BIND=close
export OPENBLAS_NUM_THREADS=1 # Prevent BLAS from spawning extra threads 

# Hybrid MPI+OpenMP approach: 32 MPI ranks × 4 OpenMP threads
# Each of the 32 MPI processes is placed on every L3 cache that shares 4 CPU cores each,
# where each MPI process spawns 4 OpenMP threads

mpirun -np 32 --bind-to core --map-by ppr:1:l3cache:pe=4 pw.x -in input.in
#!/bin/bash 
#SBATCH --job-name=qe_gcc
#SBATCH --output=%x.o%j 
#SBATCB --error=%x.e%j 
#SBATCH --partition=nocona 
#SBATCH --nodes=1 
#SBATCH --ntasks-per-node=32
#SBATCH --cpus-per-task=4
#SBATCH --time=10:00:00 

module load aocc/4.2.0 openmpi/5.0.5 quantum-espresso/7.4.1-mpi-omp

# Set 4 OpenMP threads per MPI rank 
export OMP_NUM_THREADS=4 
export OMP_PLACES=cores 
export OMP_PROC_BIND=close
export OPENBLAS_NUM_THREADS=1 # Prevent BLAS from spawning extra threads 

# Hybrid MPI+OpenMP approach: 32 MPI ranks × 4 OpenMP threads
# Each of the 32 MPI processes is placed on every L3 cache that shares 4 CPU cores each,
# where each MPI process spawns 4 OpenMP threads

mpirun -np 32 --bind-to core --map-by ppr:1:l3cache:pe=4 pw.x -in input.in

Submitting a Quantum ESPRESSO job to Quanah

There are two MPI Quantum ESPRESSO (QE) modules in Quanah: QE built against GCC 14.2.0 and QE built against Intel OneAPI 2024.2.1.

Create a job submission script with the following content as a reference:

#!/bin/bash 
#SBATCH --job-name=qe_gcc
#SBATCH --output=%x.o%j 
#SBATCB --error=%x.e%j 
#SBATCH --partition=quanah
#SBATCH --nodes=1 
#SBATCH --ntasks-per-node=4 
#SBATCH --time=10:00:00 

module load gcc/14.2.0 openmpi/4.1.6 quantum-espresso/7.3.1-mpi-omp

mpirun -np $SLURM_NTASKS --map-by socket --bind-to core pw.x -in input.in
#!/bin/bash 
#SBATCH --job-name=qe_gcc
#SBATCH --output=%x.o%j 
#SBATCB --error=%x.e%j 
#SBATCH --partition=quanah
#SBATCH --nodes=1 
#SBATCH --ntasks-per-node=4 
#SBATCH --time=10:00:00 

module load intel-oneapi/2024.2.1 oneapi-mpi/2021.13.1 quantum-espresso/7.4.1-mkl-mpi-omp

mpirun -np $SLURM_NTASKS --map-by socket --bind-to core pw.x -in input.in

Submitting a Quantum ESPRESSO job to Matador

The available Quantum ESPRESSO instances on GPU partitions come from the official Nvidia NGC Quantum ESPRESSO container. 

#!/bin/bash  
#SBATCH --job-name=qe_gpus
#SBATCH --output=%x.o%j 
#SBATCB --error=%x.e%j 
#SBATCH --partition=matador
#SBATCH --nodes=1 
#SBATCH --ntasks-per-node=2        # Start with 1 MPI rank per GPU
#SBATCH --cpus-per-task=2          # CPU cores per MPI rank
#SBATCH --gpus-per-node=2          # 1 GPU per MPI rank
#SBATCH --time=10:00:00

module load quantum-espresso/7.3.1-gpu

export OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK
export OMP_PLACES=cores
export OMP_PROC_BIND=close

# Run pw.x (-npool should divide your k-points and usually match GPU count) 
srun pw.x -npool 2 -in scf.in > scf.out

Key Tuning Rules for V100
  • MPI Ranks vs. GPUs:  Start with 1 MPI task per V100.
  • VRAM Limits (16 GB vs. 32 GB): NVIDIA V100 GPUs in the Matador partition come in 32 GB variants. If you hit Out-Of-Memory (OOM) errors on large supercells:
    • Reduce mixing_ndim in &electrons (e.g., from 8 down to 4).
    • Add more GPUs across MPI ranks to distribute wavefunction arrays.
    • Avoid oversubscribing multiple MPI ranks onto a single 32 GB V100.
  • K-point Parallelization (-npool): Set -npool equal to the number of V100 GPUs (provided your number of k-points is divisible by that count) to minimize inter-GPU communication.
  • Verify GPU Offloading: Check the top of your scf.out file after starting—a properly active run will print GPU acceleration is ACTIVE along with Tesla V100 and Compute capability : 70.

Then submit the job using the sbatch command. Please make sure to edit the following Slurm parameters as needed:

Number of nodes (--nodes): If you want to scale out your job to run across multiple worker nodes.

Number of MPI tasks (--ntasks-per-node): We recommend setting this parameter to the maximum number of available CPU cores per node on each partition.

Wall time (--time): If your job won’t take longer than 10 hours, leave it as it is. Adjust the wall time based on how long you estimate your job will take.


Please contact HPCC support at hpccsupport@ttu.edu if you have any questions.