Skip to content

Commit

Permalink
update cp2k container to 2024.1, switch to MPICH again
Browse files Browse the repository at this point in the history
  • Loading branch information
svandenhaute committed Jul 7, 2024
1 parent b533282 commit 0876f24
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 19 deletions.
21 changes: 9 additions & 12 deletions Dockerfile.cp2k
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
#
# This file was created by generate_docker_files.py
#
# Usage: docker build -f ./2023.2_openmpi_generic_psmp.Dockerfile -t cp2k/cp2k:2023.2_openmpi_generic_psmp .
# Usage: docker build -f ./2024.1_mpich_generic_psmp.Dockerfile -t cp2k/cp2k:2024.1_mpich_generic_psmp .

# Stage 1: build step
FROM ubuntu:22.04 AS build


# Install packages required for the CP2K toolchain build
RUN apt-get update -qq && apt-get install -qq --no-install-recommends \
g++ gcc gfortran openssh-client python3 \
g++ gcc gfortran libmpich-dev mpich openssh-client python3 \
bzip2 ca-certificates git make patch pkg-config unzip wget zlib1g-dev

# Download CP2K
RUN git clone --recursive -b support/v2023.2 https://github.com/cp2k/cp2k.git /opt/cp2k
RUN git clone --recursive -b support/v2024.1 https://github.com/cp2k/cp2k.git /opt/cp2k

# Build CP2K toolchain for target CPU generic
WORKDIR /opt/cp2k/tools/toolchain
RUN /bin/bash -c -o pipefail \
"./install_cp2k_toolchain.sh -j 8 \
"./install_cp2k_toolchain.sh -j 12 \
--install-all \
--enable-cuda=no \
--target-cpu=generic \
--with-cusolvermp=no \
--with-gcc=system \
--with-openmpi=install \
--with-mpich=system \
--with-libtorch=no"

# Build CP2K for target CPU generic
WORKDIR /opt/cp2k
RUN /bin/bash -c -o pipefail \
"cp ./tools/toolchain/install/arch/local.psmp ./arch/; \
source ./tools/toolchain/install/setup; \
make -j 8 ARCH=local VERSION=psmp"
make -j 12 ARCH=local VERSION=psmp"

# Collect components for installation and remove symbolic links
RUN /bin/bash -c -o pipefail \
Expand All @@ -52,7 +52,7 @@ FROM ubuntu:22.04 AS install

# Install required packages
RUN apt-get update -qq && apt-get install -qq --no-install-recommends \
g++ gcc gfortran openssh-client python3 && rm -rf /var/lib/apt/lists/*
g++ gcc gfortran libmpich-dev mpich openssh-client python3 && rm -rf /var/lib/apt/lists/*

# Install CP2K binaries
COPY --from=build /opt/cp2k/exe/local/ /opt/cp2k/exe/local/
Expand Down Expand Up @@ -83,17 +83,14 @@ RUN /bin/bash -c -o pipefail \
RUN printf "#!/bin/bash\n\
ulimit -c 0 -s unlimited\n\
\
export OMPI_ALLOW_RUN_AS_ROOT=1\n\
export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1\n\
export OMPI_MCA_btl_vader_single_copy_mechanism=none\n\
export OMP_STACKSIZE=16M\n\
export PATH=/opt/cp2k/exe/local:\${PATH}\n\
source /opt/cp2k/tools/toolchain/install/setup\n\
\"\$@\"" \
>/opt/entry.sh && chmod 755 /opt/entry.sh

# Create shortcut for regression test
RUN printf "/opt/cp2k/tools/regtesting/do_regtest.py --mpiexec \"mpiexec --bind-to none\" --maxtasks 8 --workbasedir /mnt \$* local psmp" \
RUN printf "/opt/cp2k/tests/do_regtest.py --maxtasks 8 --workbasedir /mnt \$* local psmp" \
>/usr/local/bin/run_tests && chmod 755 /usr/local/bin/run_tests

# Define entrypoint
Expand All @@ -103,7 +100,7 @@ CMD ["cp2k", "--help"]

# Label docker image
LABEL author="CP2K Developers" \
cp2k_version="2023.2" \
cp2k_version="2024.1" \
dockerfile_generator_version="0.2"

# EOF
2 changes: 1 addition & 1 deletion build_containers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ if [ "$psiflow" = "true" ]; then
fi

if [ "$cp2k" = "true" ]; then
TAG="cp2k:2023.2"
TAG="cp2k:2024.1"
docker build \
-t ghcr.io/molmod/$TAG \
-f Dockerfile.cp2k .
Expand Down
9 changes: 3 additions & 6 deletions configs/threadpool.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,17 @@ ModelTraining:
CP2K:
cores_per_worker: 2
max_evaluation_time: 0.3
launch_command: 'mpirun -np 2 -x OMP_NUM_THREADS=1 cp2k.psmp -i cp2k.inp'
use_threadpool: true
launch_command: 'apptainer exec -e --no-init oras://ghcr.io/molmod/cp2k:2024.1 /opt/entry.sh mpirun -bind-to core -np 2 -env OMP_NUM_THREADS 1 cp2k.psmp -i cp2k.inp'
CP2K_container:
cores_per_worker: 2
max_evaluation_time: 0.3
launch_command: 'apptainer exec -e --no-init oras://ghcr.io/molmod/cp2k:2023.2 /opt/entry.sh mpirun -np 2 -x OMP_NUM_THREADS=1 cp2k.psmp -i cp2k.inp'
use_threadpool: true
launch_command: 'apptainer exec -e --no-init oras://ghcr.io/molmod/cp2k:2024.1 /opt/entry.sh mpirun -bind-to core -np 2 -env OMP_NUM_THREADS 1 cp2k.psmp -i cp2k.inp'
GPAW:
cores_per_worker: 2
max_evaluation_time: 0.3
use_threadpool: true
launch_command: 'apptainer exec -e --no-init oras://ghcr.io/molmod/gpaw:24.1 /opt/entry.sh mpirun -np 2 gpaw python /opt/run_gpaw.py input.json'
GPAW_container:
cores_per_worker: 2
max_evaluation_time: 0.3
launch_command: 'apptainer exec -e --no-init oras://ghcr.io/molmod/gpaw:24.1 /opt/entry.sh mpirun -np 2 gpaw python /opt/run_gpaw.py input.json'
use_threadpool: true
...

0 comments on commit 0876f24

Please sign in to comment.