mirror of
https://github.com/cp2k/cp2k.git
synced 2026-07-21 14:35:15 -04:00
113 lines
2.9 KiB
Text
113 lines
2.9 KiB
Text
#
|
|
# This file was created by generate_dockerfiles.py.
|
|
# Usage: ./spack_cache_start.sh; podman build --shm-size=1g -t spack_pdbg-p100 -f ./Dockerfile.test_spack_pdbg-P100 ../../
|
|
#
|
|
|
|
ARG BASE_IMAGE="docker.io/nvidia/cuda:12.9.1-devel-ubuntu24.04"
|
|
|
|
###### Stage 1: Build CP2K dependencies ######
|
|
|
|
FROM "${BASE_IMAGE}" AS build_deps
|
|
|
|
RUN apt-get update -qq && apt-get install -qq --no-install-recommends \
|
|
bzip2 \
|
|
ca-certificates \
|
|
cmake \
|
|
g++ g++-13 gcc gcc-13 gfortran gfortran-13 \
|
|
git \
|
|
gnupg \
|
|
libssh-dev \
|
|
libssl-dev \
|
|
libtool \
|
|
libtool-bin \
|
|
lsb-release \
|
|
make \
|
|
patch \
|
|
pkgconf \
|
|
python3 \
|
|
python3-dev \
|
|
python3-pip \
|
|
python3-venv \
|
|
unzip \
|
|
wget \
|
|
xxd \
|
|
xz-utils \
|
|
zlib1g \
|
|
zlib1g-dev \
|
|
zstd \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Setup CUDA environment
|
|
ENV LD_LIBRARY_PATH /usr/local/cuda/lib64
|
|
|
|
# Disable JIT cache as there seems to be an issue with file locking on overlayfs
|
|
# See also https://github.com/cp2k/cp2k/pull/2337
|
|
ENV CUDA_CACHE_DISABLE 1
|
|
|
|
ARG IMAGE_TAG
|
|
ENV IMAGE_TAG=${IMAGE_TAG:-spack_pdbg-P100}
|
|
|
|
ARG SPACK_CACHE
|
|
ENV SPACK_CACHE="${SPACK_CACHE:-s3://spack-cache --s3-endpoint-url=http://host.containers.internal:9000}"
|
|
|
|
# Build CP2K dependencies
|
|
WORKDIR /opt/cp2k
|
|
COPY ./tools/spack ./tools/spack
|
|
COPY ./tools/docker ./tools/docker
|
|
COPY ./make_cp2k.sh .
|
|
RUN ./make_cp2k.sh -bd_only -cv pdbg -gpu P100 -gv 13 -mpi mpich -ue
|
|
|
|
###### Stage 2: Build CP2K ######
|
|
|
|
FROM build_deps AS build_cp2k
|
|
|
|
COPY ./src ./src
|
|
COPY ./data ./data
|
|
COPY ./tools/build_utils ./tools/build_utils
|
|
COPY ./cmake ./cmake
|
|
COPY ./CMakeLists.txt .
|
|
|
|
RUN ./make_cp2k.sh -cv pdbg -gv 13 -gpu P100 -mpi mpich
|
|
|
|
###### Stage 3: Install CP2K ######
|
|
|
|
FROM "${BASE_IMAGE}" AS install_cp2k
|
|
|
|
RUN apt-get update -qq && apt-get install -qq --no-install-recommends \
|
|
g++ g++-13 gcc gcc-13 gfortran gfortran-13 \
|
|
python3 \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Setup CUDA environment
|
|
ENV LD_LIBRARY_PATH /usr/local/cuda/lib64
|
|
|
|
# Disable JIT cache as there seems to be an issue with file locking on overlayfs
|
|
# See also https://github.com/cp2k/cp2k/pull/2337
|
|
ENV CUDA_CACHE_DISABLE 1
|
|
|
|
WORKDIR /opt/cp2k
|
|
|
|
# Install CP2K dependencies built with spack
|
|
COPY --from=build_cp2k /opt/cp2k/spack/spack/opt/spack ./spack/spack/opt/spack
|
|
|
|
# Install CP2K
|
|
COPY --from=build_cp2k /opt/cp2k/install ./install
|
|
|
|
# Install CP2K regression tests
|
|
COPY ./tests ./tests
|
|
COPY --from=build_cp2k /opt/cp2k/src/grid/sample_tasks ./src/grid/sample_tasks
|
|
|
|
# Install CP2K/Quickstep CI benchmarks
|
|
COPY ./benchmarks/CI ./benchmarks/CI
|
|
|
|
# Do not rely only on LD_LIBRARY_PATH because it is fragile
|
|
COPY --from=build_cp2k /etc/ld.so.conf.d/cp2k.conf /etc/ld.so.conf.d/cp2k.conf
|
|
RUN ldconfig
|
|
|
|
# Run CP2K regression test
|
|
RUN /opt/cp2k/install/bin/launch /opt/cp2k/install/bin/run_tests --keepalive || echo "ERROR: Tests failed"
|
|
|
|
# Create entrypoint and finalise container build
|
|
WORKDIR /mnt
|
|
ENTRYPOINT ["/opt/cp2k/install/bin/launch"]
|
|
CMD ["cp2k", "--help", "--version"]
|