CP2K¶
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 is available as a module on Apocrita.
Use Spack for additional variants
Simple variants of CP2K have been installed by the Apocrita ITSR Apps Team. Advanced users may want to self-install their own additional variants via Spack.
Versions¶
Regular and GPU accelerated versions have been installed on Apocrita.
Usage¶
To run the required version, load one of the following modules:
- For CP2K (non-GPU), load
cp2k/<version> - For GPU accelerated CP2K versions, load
cp2k-gpu/<version>
To run the default installed version of CP2K, simply load the cp2k module:
$ module load cp2k
$ cp2k.psmp -h
Usage:
cp2k.psmp -h
cp2k.psmp [-c|--check] [-e|--echo] [-h|--help]
[-i] <input_file>
[-mpi-mapping|--mpi-mapping] <method>
[-o] <output_file>
[-r|-run] [-s|--shell] [--xml]
For full usage documentation, run cp2k.psmp -h.
Example jobs¶
Serial CPU jobs¶
Here is an example job running on 1 core and 1GB of memory:
#!/bin/bash
#SBATCH -n 1 # (or --ntasks=1) Request 1 core
#SBATCH --mem-per-cpu=1G # Request 1GB RAM per core
#SBATCH -t 1:0:0 # Request 1 hour runtime
module load cp2k
cp2k.psmp -i myinput.inp -o myoutput.out
Here is an example job running on 4 cores and 4GB memory:
Core Usage
For serial multi-core jobs, the cp2k modules will automatically export the
$OMP_NUM_THREADS environment variable to match your core request and
automatically thread your job correctly using
OpenMP. There is no need for any additional
threading arguments.
#!/bin/bash
#SBATCH -n 4 # (or --ntasks=4) Request 4 cores
#SBATCH --mem-per-cpu=1G # Request 1GB RAM per core (4G total)
#SBATCH -t 1:0:0 # Request 1 hour runtime
module load cp2k
cp2k.psmp -i myinput.inp -o myoutput.out
Parallel CPU job¶
Here is an example job running on 96 cores across 2 nodes with MPI:
#!/bin/bash
#SBATCH -N 2 # (or --nodes=2) Request 2 nodes
#SBATCH -n 96 # (or --ntasks=96) Request 96 cores
#SBATCH -t 240:0:0 # Request 240 hours runtime
#SBATCH -p parallel # (or --partition=parallel) Request parallel partition
#SBATCH --exclusive
#SBATCH --mem=0
module load cp2k
# Slurm knows how many tasks to use for mpirun, detected automatically from
# ${SLURM_NTASKS}. Use -- to ensure arguments are passed to the application
# and not mpirun
mpirun -- \
cp2k.psmp \
-i myinput.inp \
-o myoutput.out
GPU job¶
Here is an example job running on 1 GPU:
Core Usage
For GPU jobs, the cp2k modules will automatically export the
$OMP_NUM_THREADS environment variable to match your core request and
automatically thread your job correctly using
OpenMP. There is no need for any additional
threading arguments.
#!/bin/bash
#SBATCH -n 8 # (or --ntasks=8) Request 8 cores
#SBATCH --mem-per-cpu=11G # Request 11GB RAM per core (88G total)
#SBATCH -p gpu # (or --partition=gpu) Request gpu partition
#SBATCH --cpus-per-gpu=8 # 8 cores per GPU
#SBATCH --gres=gpu:1 # Request 1 GPU of any type
#SBATCH -t 240:0:0 # Request 240 hours runtime
# Load a GPU compatible version of CP2K
module load cp2k-gpu
cp2k.psmp -i myinput.inp -o myoutput.out