Update docker files for Intel

- Exclude SIRIUS and libtorch from toolchain build
- Prepare for automatic Intel arch file generation
This commit is contained in:
Matthias Krack 2023-03-06 17:47:16 +01:00
parent acdfcf0025
commit 96c0780206
3 changed files with 27 additions and 13 deletions

View file

@ -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.

View file

@ -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.

View file

@ -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",
)