CP2K 2025.2

ウェブページ

https://www.cp2k.org/

バージョン

2025.2

ビルド環境

  • GCC 13.1.1 (gcc-toolset-13)
  • Open MPI 4.1.8

ビルドに必要なファイル

  • cp2k-2025.2.tar.bz2

ビルド手順

#!/bin/sh
set -e  # エラー時に即座に終了

VERSION=2025.2
DBCSR_VERSION=v2.5.0
INSTDIR=/apl/cp2k/${VERSION}  
SOURCE_ROOT=/home/users/${USER}/Software/CP2K/${VERSION}
TARBALL=${SOURCE_ROOT}/cp2k-${VERSION}.tar.bz2
PARALLEL=32

# ------------------------------------------------------------------------
umask 0022
export LANG=C
export LC_ALL=C
ulimit -s unlimited

module -s purge
module -s load gcc-toolset/13
module -s load openmpi/4.1.8/gcc13
module -s load cmake/3.31.6

rm -rf $INSTDIR/*
cd $INSTDIR
if [ -d cp2k-${VERSION} ]; then
  mv cp2k-${VERSION} cp2k-erase
  rm -rf cp2k-erase &
fi

tar jxf ${TARBALL}
sleep 5
rsync -aq cp2k-${VERSION}/ ./
sleep 5
rm -rf cp2k-${VERSION}  # rmdir の代わりに rm -rf を使用

cd ${INSTDIR}/tools/toolchain


export CC=gcc
export CXX=g++
export FC=gfortran
export MPICC=mpicc
export MPICXX=mpicxx
export MPIFC=mpif90


./install_cp2k_toolchain.sh --mpi-mode=openmpi \
                           --math-mode=openblas \
                           --with-gcc=system \
                           --with-cmake=system \
                           --with-openmpi=system \
                           --with-mpich=no \
                           --with-intelmpi=no \
                           --with-libxc=install \
                           --with-libint=install \
                           --with-fftw=install \
                --with-libgrpp=install \
                           --with-acml=no \
                           --with-mkl=no \
                           --with-openblas=install \
                           --with-scalapack=install \
                           --with-libxsmm=install \
                           --with-elpa=install \
                --with-deepmd=no \
                           --with-plumed=install \
                           --with-sirius=install \
                           --with-gsl=install \
                           --with-libvdwxc=install \
                           --with-spglib=install \
                           --with-hdf5=install \
                           --with-spfft=install \
                           --with-spla=install \
                           --with-cosma=install \
                           --with-libvori=install \
                --with-libtorch=no \
                --with-libsmeagol=install \
                --with-dftd4=install \
                --with-tblite=install \
                --with-trexio=install \
                --with-greenx=install \
                --with-gmp=install \
                --with-ace=install \
                -j ${PARALLEL}

source install/setup

cd ${INSTDIR}

#buildディレクトリが存在する場合は削除
if [ -d "build" ]; then
   echo "既存のbuildディレクトリを削除中..."
   rm -rf build
fi
mkdir build

cd build

# CMake設定
cmake  -S .. -B . \
     -DCMAKE_BUILD_TYPE=Release \
     -DCMAKE_INSTALL_PREFIX=${INSTDIR} \
     -DCP2K_USE_ACCEL=OFF \
     -DCP2K_WITH_CUDA_PROFILING=OFF \
     -DCP2K_USE_MPI=ON \
     -DCP2K_USE_MPI_F08=ON \
     -DCP2K_ENABLE_DBM_GPU=OFF \
     -DCP2K_ENABLE_GRID_GPU=OFF \
     -DCP2K_ENABLE_PW_GPU=OFF \
     -DCP2K_USE_COSMA=ON \
     -DCP2K_USE_ELPA=ON \
     -DCP2K_ENABLE_ELPA_OPENMP_SUPPORT=ON \
     -DCP2K_USE_SPLA=ON \
     -DCP2K_USE_SPLA_GEMM_OFFLOADING=OFF \
     -DCP2K_USE_LIBXSMM=ON \
     -DCP2K_USE_FFTW3=ON \
     -DCP2K_ENABLE_FFTW3_OPENMP_SUPPORT=ON \
     -DCP2K_USE_LIBXC=ON \
     -DCP2K_USE_LIBINT2=ON \
     -DCP2K_USE_SIRIUS=ON \
     -DCP2K_USE_LIBVDWXC=ON \
     -DCP2K_USE_SIRIUS_DFTD4=ON \
     -DCP2K_USE_SIRIUS_VCSQNM=ON \
     -DCP2K_USE_SIRIUS_NLCG=ON \
     -DCP2K_USE_DFTD4=ON \
     -DCP2K_USE_TBLITE=ON \
     -DCP2K_USE_ACE=OFF \
     -DCP2K_USE_GRPP=ON \
     -DCP2K_USE_DEEPMD=OFF \
     -DCP2K_USE_PLUMED=ON \
     -DCP2K_USE_PEXSI=OFF \
     -DCP2K_USE_LIBSMEAGOL=ON \
     -DCP2K_USE_GREENX=ON \
     -DCP2K_USE_HDF5=ON \
     -DCP2K_USE_SPGLIB=ON \
     -DCP2K_USE_VORI=ON \
     -DCP2K_USE_TREXIO=ON \
     -DBUILD_SHARED_LIBS=OFF \
     -DCMAKE_POSITION_INDEPENDENT_CODE=ON

#ビルド実行
cmake --build . -j ${PARALLEL}
cmake --build . --target install -j ${PARALLEL}
 

テスト

以下のジョブスクリプトで実行

#!/bin/sh
#PBS -l select=1:ncpus=2:mpiprocs=2:ompthreads=1
#PBS -l walltime=72:00:00

set -e  

VERSION=2025.2
INSTDIR=/apl/cp2k/${VERSION}
WORKDIR=$(pwd)

module -s purge
module -s load openmpi/4.1.8/gcc13

cd ${INSTDIR}

source tools/toolchain/install/setup

export CP2K_DATA_DIR=${INSTDIR}/data/
python3.11 ./tests/do_regtest.py ${INSTDIR}/bin psmp --mpiranks=1 --ompthreads=1 --timeout=4000 > ${WORKDIR}/mpi1_omp1.log

python3.11 ./tests/do_regtest.py ${INSTDIR}/bin psmp --mpiranks=2 --ompthreads=1 --timeout=4000 > ${WORKDIR}/mpi2_omp1.log

python3.11 ./tests/do_regtest.py ${INSTDIR}/bin psmp --mpiranks=1 --ompthreads=2 --timeout=4000 > ${WORKDIR}/mpi1_omp2.log

メモ

MPI=1, OMP=2のテストでは以下のエラーが出ている。
------------------------------- Errors ---------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
SE/regtest-2-2/ZrF2-PM6.inp.out
Spec: {'matcher': 'M003', 'tol': 4e-12, 'ref': -985.9930664264728}
Difference too large: 4.64e-12 > 4e-12, value: -985.9930664218987.

ライブラリの選択について

  • gcc14ではいくつかのテストで数値エラーがでる。
  • Open MPI 5系は計算速度が遅い可能性がある。