Skip to content

Commit

Permalink
Merge pull request #308 from aproeme/master
Browse files Browse the repository at this point in the history
Update for cp2/2023.2 install
  • Loading branch information
xguo-epcc authored Mar 11, 2024
2 parents e448a08 + 415bbcc commit 85ad7cb
Showing 1 changed file with 31 additions and 56 deletions.
87 changes: 31 additions & 56 deletions docs/software-packages/cp2k.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,79 +14,54 @@ state optimisation using NEB or dimer method.

## Useful Links

- [CP2K Reference Manual](https://manual.cp2k.org/#gsc.tab=0)
- [CP2K Reference Manual](https://manual.cp2k.org)
- [CP2K HOWTOs](https://www.cp2k.org/howto)
- [CP2K FAQs](https://www.cp2k.org/faq)

## Using CP2K on Cirrus

CP2K is available through the `cp2k` module. MPI only `cp2k.popt` and
MPI/OpenMP Hybrid `cp2k.psmp` binaries are available.
CP2K is available through the `cp2k` module. Loading this module
provides access to the MPI/OpenMP hybrid `cp2k.psmp` executable.

## Running parallel CP2K jobs - MPI Only
To run CP2K after loading this module you should also source the
environment setup script that was generated by CP2K's toolchain (see
example job script below)

To run CP2K using MPI only, load the `cp2k` module and use the
`cp2k.popt` executable.

For example, the following script will run a CP2K job using 4 nodes (144
cores):

#!/bin/bash

# Slurm job options (name, compute nodes, job time)
#SBATCH --job-name=CP2K_test
#SBATCH --time=0:20:0
#SBATCH --exclusive
#SBATCH --nodes=4
#SBATCH --tasks-per-node=36
#SBATCH --cpus-per-task=1

# Replace [budget code] below with your budget code (e.g. t01)
#SBATCH --account=[budget code]
# Replace [partition name] below with your partition name (e.g. standard,gpu)
#SBATCH --partition=[partition name]
# Replace [qos name] below with your qos name (e.g. standard,long,gpu)
#SBATCH --qos=[qos name]

# Load CP2K
module load cp2k

#Ensure that no libraries are inadvertently using threading
export OMP_NUM_THREADS=1

# Run using input in test.inp
srun cp2k.popt -i test.inp

## Running Parallel CP2K Jobs - MPI/OpenMP Hybrid Mode

To run CP2K using MPI and OpenMP, load the `cp2k` module and use the
`cp2k.psmp` executable.
`cp2k.psmp` executable.

For example, the following script will run a CP2K job using 8 nodes,
with 2 OpenMP threads per MPI process:

#!/bin/bash
#!/bin/bash

# Slurm job options (name, compute nodes, job time)
#SBATCH --job-name=CP2K_test
#SBATCH --time=0:20:0
#SBATCH --exclusive
#SBATCH --nodes=8
#SBATCH --tasks-per-node=18
#SBATCH --cpus-per-task=2

# Replace [budget code] below with your budget code (e.g. t01)
#SBATCH --account=[budget code]
# Replace [partition name] below with your partition name (e.g. standard,gpu)
#SBATCH --partition=[partition name]
# Replace [qos name] below with your qos name (e.g. standard,long,gpu)
#SBATCH --qos=[qos name]

# Slurm job options (name, compute nodes, job time)
#SBATCH --job-name=CP2K_test
#SBATCH --time=0:20:0
#SBATCH --exclusive
#SBATCH --nodes=8
#SBATCH --tasks-per-node=18
#SBATCH --cpus-per-task=2
# Load CP2K
module load cp2k

# Replace [budget code] below with your budget code (e.g. t01)
#SBATCH --account=[budget code]
# Replace [partition name] below with your partition name (e.g. standard,gpu)
#SBATCH --partition=[partition name]
# Replace [qos name] below with your qos name (e.g. standard,long,gpu)
#SBATCH --qos=[qos name]
# Source the environment setup script generated by CP2K's install toolchain
source $CP2K/tools/toolchain/install/setup

# Load CP2K
module load cp2k
# Set the number of threads to the value specified for --cpus-per-task above
export OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK

# Set the number of threads to 2
export OMP_NUM_THREADS=2
# Run using input in test.inp
srun cp2k.psmp -i test.inp

# Run using input in test.inp
srun cp2k.psmp -i test.inp

0 comments on commit 85ad7cb

Please sign in to comment.