General Information

CP2K is a quantum chemistry and solid state physics software package that can perform atomistic simulations of solid state, liquid, molecular, periodic, material, crystal, and biological systems. CP2K provides a general framework for different modeling methods such as DFT using the mixed Gaussian and plane waves approaches GPW and GAPW. Supported theory levels include DFTB, LDA, GGA, MP2, RPA, semi-empirical methods (AM1, PM3, PM6, RM1, MNDO, etc.), and classical force fields (AMBER, CHARMM, etc.). CP2K can do simulations of molecular dynamics, metadynamics, Monte Carlo, Ehrenfest dynamics, vibrational analysis, core level spectroscopy, energy minimization, and transition state optimization using NEB or dimer method. Detailed overview of features.

CP2K is written in Fortran 2008 and can be run efficiently in parallel using a combination of multi-threading, MPI, and CUDA. It is freely available under the GPL license.

Running CP2K

Discover available CP2K versions

Discover available CP2K versions
ml spider cp2k

Running CP2K on CPU

For CP2K the recommendation is to request relative ressources ( *-per-*= ) and first increase --tasks-per-node up to 64 before increasing --nodes to avoid inter-node communication, which is slower than intra-node communication.

CP2K benefits from light OpenMP threading (at least in the benchmarks used below). Use 2 cpus-per-task by default, and increase threading for very large systems, when memory becomes an issue, otherwise prefer increasing MPI tasks.
Sample sbatch file "cp2k.sl"
#!/usr/bin/env bash
#SBATCH --job-name=cp2k
#SBATCH --partition=epyc
#SBATCH --nodes=1
#SBATCH --tasks-per-node=64
#SBATCH --cpus-per-task=2
#SBATCH --mem-per-cpu=4G
#SBATCH --mail-type=END,INVALID_DEPEND,TIME_LIMIT
# replace the email with your personal one in order to receive mail notifications:
#SBATCH --mail-user=noreply@physik.uni-augsburg.de
#SBATCH --time=1-0

ml purge
ml load cp2k/2024.1

srun cp2k.psmp < job.in > job-${SLURM_JOB_ID}.out

There is also a pure OpenMP binary cp2k.ssmp available, but its usecase is quite limited in a HPC context (max 64 CPU cores). All olther versions are symlinks to the psmp and ssmp version.

Running CP2K on GPU

Running CP2K on a GPU may improve runtimes (up to 3.7x in certain cases [1]), but the gain is highly dependent on the type of calculation and features used. Use with caution, benchmark against CPU-Nodes, and use GPU version only when sufficient speedup is achieved.
Sample sbatch file "cp2k.sl"
#!/usr/bin/env bash
#SBATCH --job-name=cp2k-gpu
#SBATCH --partition=epyc
#SBATCH --nodes=1
#SBATCH --tasks-per-node=1
#SBATCH --cpus-per-task=32
#SBATCH --mem-per-cpu=4G
#SBATCH --gpus-per-task=1
#SBATCH --mail-type=END,INVALID_DEPEND,TIME_LIMIT
# replace the email with your personal one in order to receive mail notifications:
#SBATCH --mail-user=noreply@physik.uni-augsburg.de
#SBATCH --time=1-0

ml purge
ml load cp2k/2024.1-ompi-gcc11-cuda12.2

srun cp2k.psmp < job.in > job-${SLURM_JOB_ID}.out

Benchmarks (CPU-only)

Single-Node (varying OpenMP threads)

H2O-n: a system of n water molecules (3n atoms, 8n electrons) in a 31.3 cubic angstrom cell and MD is run for 10 steps.

BenchmarkTask-per-NodeNodesCPUs-per-TaskTime (64)Time (256)Time (1024)
H2O-{64,256,1024}1281124.358186.0622899.579
H2O-{64,256,1024}641217.791156.6402640.062
H2O-{64,256,1024}321418.676164.1612626.582
H2O-{64,256,1024}161819.662169.2903698.717
H2O-{64,256,1024}811627.585240.2327278.237

Multi-Node (varying nodes)

BenchmarkTask-per-NodeNodesCPUs-per-TaskTime Efficiency
H2O-102464122640.062100,00%
H2O-102464221591.70082,93%
H2O-102464321478.28559,53%
H2O-102464421043.40963,26%
H2O-102432441059.45562,30%
H2O-10246482748.61244,08%
H2O-10243284722.93245,65%
H2O-102464162

2070.555

7,97%
H2O-102432164

582.709

28,32%

Support

If you have any problems with CP2K please contact the team of IT-Physik (preferred) or the HPC-Servicedesk.


  • Keine Stichwörter