From 96c078020633fa80fbb650e06f444609e5d8caa2 Mon Sep 17 00:00:00 2001 From: Matthias Krack Date: Mon, 6 Mar 2023 17:47:16 +0100 Subject: [PATCH] Update docker files for Intel - Exclude SIRIUS and libtorch from toolchain build - Prepare for automatic Intel arch file generation --- tools/docker/Dockerfile.prod_intel_psmp | 2 ++ tools/docker/Dockerfile.test_intel-psmp | 12 +++++++----- tools/docker/generate_dockerfiles.py | 26 +++++++++++++++++-------- 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/tools/docker/Dockerfile.prod_intel_psmp b/tools/docker/Dockerfile.prod_intel_psmp index ed580420f0..705e6c3660 100644 --- a/tools/docker/Dockerfile.prod_intel_psmp +++ b/tools/docker/Dockerfile.prod_intel_psmp @@ -24,6 +24,8 @@ RUN ./install_cp2k_toolchain.sh \ --install-all \ --with-intelmpi \ --with-mkl \ + --with-libtorch=no \ + --with-sirius=no \ --dry-run # Dry-run leaves behind config files for the followup install scripts. diff --git a/tools/docker/Dockerfile.test_intel-psmp b/tools/docker/Dockerfile.test_intel-psmp index cbe80b2df5..6dcae1f2b5 100644 --- a/tools/docker/Dockerfile.test_intel-psmp +++ b/tools/docker/Dockerfile.test_intel-psmp @@ -24,6 +24,8 @@ RUN ./install_cp2k_toolchain.sh \ --install-all \ --with-intelmpi \ --with-mkl \ + --with-libtorch=no \ + --with-sirius=no \ --dry-run # Dry-run leaves behind config files for the followup install scripts. @@ -60,18 +62,18 @@ COPY ./tools/toolchain/scripts/arch_base.tmpl \ ./scripts/ RUN ./scripts/generate_arch_files.sh && rm -rf ./build -# Install CP2K using Linux-intel-x86_64.psmp. +# Install CP2K using local.psmp. WORKDIR /opt/cp2k COPY ./Makefile . COPY ./src ./src COPY ./exts ./exts COPY ./tools/build_utils ./tools/build_utils -COPY ./arch/Linux-intel-x86_64.psmp /opt/cp2k/arch/ RUN /bin/bash -c " \ - ln -s /opt/cp2k-toolchain /opt/cp2k/tools/toolchain && \ + mkdir -p arch && \ + ln -vs /opt/cp2k-toolchain/install/arch/local.psmp ./arch/ && \ echo 'Compiling cp2k...' && \ source /opt/cp2k-toolchain/install/setup && \ - ( make -j ARCH=Linux-intel-x86_64 VERSION=psmp &> /dev/null || true ) && \ + ( make -j ARCH=local VERSION=psmp &> /dev/null || true ) && \ rm -rf lib obj" COPY ./data ./data COPY ./tests ./tests @@ -82,7 +84,7 @@ ARG TESTOPTS="" COPY ./tools/docker/scripts/test_regtest.sh ./ RUN /bin/bash -o pipefail -c " \ TESTOPTS="${TESTOPTS}" \ - ./test_regtest.sh 'Linux-intel-x86_64' 'psmp' |& tee report.log && \ + ./test_regtest.sh 'local' 'psmp' |& tee report.log && \ rm -rf regtesting" # Output the report if the image is old and was therefore pulled from the build cache. diff --git a/tools/docker/generate_dockerfiles.py b/tools/docker/generate_dockerfiles.py index 667ae4ac7f..4673b01be0 100755 --- a/tools/docker/generate_dockerfiles.py +++ b/tools/docker/generate_dockerfiles.py @@ -32,10 +32,12 @@ def main() -> None: f.write(regtest("psmp")) with OutputFile(f"Dockerfile.test_intel-psmp", args.check) as f: - f.write(toolchain_intel() + regtest("psmp", "Linux-intel-x86_64")) + f.write(toolchain_intel() + regtest("psmp", intel=True)) with OutputFile(f"Dockerfile.prod_intel_psmp", args.check) as f: - f.write(toolchain_intel() + production("psmp", "Linux-intel-x86_64")) + f.write( + toolchain_intel() + production("psmp", "Linux-intel-x86_64", intel=True) + ) with OutputFile(f"Dockerfile.test_nvhpc", args.check) as f: f.write(toolchain_nvhpc()) @@ -119,9 +121,11 @@ def main() -> None: # ====================================================================================== -def regtest(version: str, arch: str = "local", testopts: str = "") -> str: +def regtest( + version: str, arch: str = "local", testopts: str = "", intel: bool = False +) -> str: return ( - install_cp2k(version=version, arch=arch) + install_cp2k(version=version, arch=arch, intel=intel) + rf""" # Run regression tests. ARG TESTOPTS="{testopts}" @@ -307,9 +311,9 @@ ENTRYPOINT [] # ====================================================================================== -def production(version: str, arch: str = "local") -> str: +def production(version: str, arch: str = "local", intel: bool = False) -> str: return ( - install_cp2k(version=version, arch=arch, revision=True, prod=True) + install_cp2k(version=version, arch=arch, revision=True, prod=True, intel=intel) + rf""" # Run regression tests. ARG TESTOPTS @@ -331,7 +335,11 @@ CMD ["cp2k", "--help"] # ====================================================================================== def install_cp2k( - version: str, arch: str, revision: bool = False, prod: bool = False + version: str, + arch: str, + revision: bool = False, + prod: bool = False, + intel: bool = False, ) -> str: input_lines = [] run_lines = [] @@ -373,7 +381,7 @@ def install_cp2k( run_lines.append(f"rm -rf lib obj") # Ensure MPI is dynamically linked, which is needed e.g. for Shifter. - if version.startswith("p") and not "intel" in arch: + if version.startswith("p") and not intel: binary = f"./exe/{arch}/cp2k.{version}" run_lines.append(f"( [ ! -f {binary} ] || ldd {binary} | grep -q libmpi )") @@ -490,6 +498,8 @@ FROM intel/oneapi-hpckit:2023.0.0-devel-ubuntu22.04 install_all="", with_intelmpi="", with_mkl="", + with_libtorch="no", + with_sirius="no", )