For users, the preferred method is to download a release
(use the versioned tarballs, cp2k-X.Y.tar.bz2). For developers, the preferred method is to
download from Git.
For more details on downloading CP2K, see https://www.cp2k.org/download.
The easiest way to build CP2K with its dependencies is via the make_cp2k.sh script, which builds
CP2K using Spack and CMake locally within the CP2K_ROOT folder.
The script can either be sourced with:
source ./make_cp2k.shor run in a subshell with:
./make_cp2k.shYou can run the following command to get information about how to use this script:
./make_cp2k.sh --helpNote: it is recommended to install podman to take advantage of a spack cache. This will accelerate the build of the CP2K dependencies with Spack significantly.
Alternatively, the toolchain script can also be run directly.
For a complete introduction to the toolchain script, see the README.
The basic steps are:
- Read toolchain installation options:
cd tools/toolchain/
./install_cp2k_toolchain.sh --helpCP2K supports GPU acceleration via CUDA (for NVIDIA GPUs), HIP/ROCm (for AMD GPUs), and OpenCL (for a range of devices). If you wish to build with GPU support, please see the manual.
- Launch toolchain script (example option choice for NVIDIA/CUDA):
./install_cp2k_toolchain.sh --with-libxsmm=install --with-openblas=system \
--with-fftw=system --enable-cuda- For AMD/ROCm/HIP support, use:
./install_cp2k_toolchain.sh --with-libxsmm=install --with-openblas=system \
--with-fftw=system --enable-hip- Build and install CP2K with prepared toolchain environment:
./build_cp2k.shIt is also available to make installed program and dependencies outside the source tree:
./install_cp2k_toolchain.sh --install-dir=/opt/cp2k/toolchain
./build_cp2k.sh --prefix /opt/cp2kThis section has been moved to the manual.
If things fail, take a break... go back to step 2.
If compilation works fine, it is recommended to test the generated binary, to exclude errors in libraries, or miscompilations, etc.
./tests/do_regtest.py ./build/bin/ ${VERSION}should work if you can locally execute CP2K without the need for, e.g., batch submission.
In the other case, you might need to configure the underlying testing script as described more systematically at https://www.cp2k.org/dev:regtesting
In any case please tell us your comments, praise, criticism, thanks, etc. see https://www.cp2k.org.
A reference manual of CP2K can be found on the web: https://manual.cp2k.org or can be generated using the cp2k binary, see https://manual.cp2k.org/trunk/generate_manual_howto.html
The CP2K team.