From df7a9c01099905a8dba4b32472a06bf5a1999ba9 Mon Sep 17 00:00:00 2001 From: Attila Krasznahorkay <30694331+krasznaa@users.noreply.github.com> Date: Mon, 27 May 2024 14:45:57 +0200 Subject: [PATCH] Re-designed all the Ubuntu 20.04 based "GPU images". (#99) They are now all based on the "latest" vanilla Ubuntu 20.04 image, just adding GPU SDKs on top. From DEB repositories in all cases. --- ubuntu2004_cuda/Dockerfile | 223 ++++--------------------- ubuntu2004_cuda_oneapi/Dockerfile | 104 ++++++------ ubuntu2004_cuda_oneapi/oneapi.list | 1 + ubuntu2004_oneapi/Dockerfile | 242 ++++------------------------ ubuntu2004_oneapi/oneapi.list | 1 + ubuntu2004_rocm/Dockerfile | 218 +++---------------------- ubuntu2004_rocm/rocm-pin-600 | 3 + ubuntu2004_rocm/rocm.list | 1 + ubuntu2004_rocm_oneapi/Dockerfile | 92 +++++------ ubuntu2004_rocm_oneapi/oneapi.list | 1 + ubuntu2004_rocm_oneapi/rocm-pin-600 | 3 + ubuntu2004_rocm_oneapi/rocm.list | 1 + 12 files changed, 198 insertions(+), 692 deletions(-) create mode 100644 ubuntu2004_cuda_oneapi/oneapi.list create mode 100644 ubuntu2004_oneapi/oneapi.list create mode 100644 ubuntu2004_rocm/rocm-pin-600 create mode 100644 ubuntu2004_rocm/rocm.list create mode 100644 ubuntu2004_rocm_oneapi/oneapi.list create mode 100644 ubuntu2004_rocm_oneapi/rocm-pin-600 create mode 100644 ubuntu2004_rocm_oneapi/rocm.list diff --git a/ubuntu2004_cuda/Dockerfile b/ubuntu2004_cuda/Dockerfile index 29f330a..c596ded 100644 --- a/ubuntu2004_cuda/Dockerfile +++ b/ubuntu2004_cuda/Dockerfile @@ -1,198 +1,33 @@ -FROM nvidia/cuda:11.6.2-devel-ubuntu20.04 - -LABEL description="Ubuntu 20.04 with Acts dependencies and CUDA" -LABEL maintainer="Paul Gessinger /usr/share/keyrings/oneapi-archive-keyring.gpg + +# Set up the oneAPI repository. +COPY oneapi.list /etc/apt/sources.list.d/ + +# Install oneAPI. +ARG ONEAPI_VERSION=2024.1 +RUN apt-get update && \ + apt-get install -y intel-oneapi-compiler-dpcpp-cpp-${ONEAPI_VERSION} && \ + apt-get clean -y + +# Set up the oneAPI environment. Note that one *MUST* source the +# /opt/intel/oneapi/setvars.sh script to make the following work. Which has to +# be done in the respective CI scripts. +ENV CC="clang" +ENV CXX="clang++" +ENV SYCLCXX="clang++ -fsycl" +ENV SYCLFLAGS="-fsycl-targets=spir64,spir64_x86_64,nvidia_gpu_sm_75 -Wno-unknown-cuda-version -Xclang -opaque-pointers" diff --git a/ubuntu2004_cuda_oneapi/oneapi.list b/ubuntu2004_cuda_oneapi/oneapi.list new file mode 100644 index 0000000..3939bca --- /dev/null +++ b/ubuntu2004_cuda_oneapi/oneapi.list @@ -0,0 +1 @@ +deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main diff --git a/ubuntu2004_oneapi/Dockerfile b/ubuntu2004_oneapi/Dockerfile index 10ac444..d356e0b 100644 --- a/ubuntu2004_oneapi/Dockerfile +++ b/ubuntu2004_oneapi/Dockerfile @@ -1,208 +1,34 @@ -FROM ubuntu:20.04 - -LABEL description="Ubuntu 20.04 with Acts dependencies" -LABEL maintainer="Paul Gessinger " -# increase whenever any of the RUN commands change -LABEL version="1" - -# DEBIAN_FRONTEND ensures non-blocking operation (tzdata is a problem) -ENV DEBIAN_FRONTEND noninteractive - -# Get the packages necessary to set up the Intel repository. -RUN apt-get update -y \ - && apt-get install -y gnupg2 curl \ - && apt-get clean -y - -# Set up the Intel package repository. -RUN curl https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | apt-key add - \ - && echo "deb https://apt.repos.intel.com/oneapi all main" > /etc/apt/sources.list.d/oneAPI.list - -# Install the oneAPI compiler. -RUN apt-get update -y \ - && apt-get install -y \ - intel-oneapi-compiler-dpcpp-cpp-2022.0.2 \ - && apt-get clean -y - -# Set up the environment variables compelling CMake to use the Intel compilers. -ENV CC icx -ENV CXX icpx -ENV SYCLCXX dpcpp - -# Install all packages needed by the Acts projects, and the other externals -# built by hand. -RUN apt-get update -y \ - && apt-get install -y \ - libstdc++-9-dev \ - binutils \ - make \ - git \ - freeglut3-dev \ - libboost-dev \ - libboost-filesystem-dev \ - libboost-program-options-dev \ - libboost-test-dev \ - libeigen3-dev \ - libexpat-dev \ - libftgl-dev \ - libgl2ps-dev \ - libglew-dev \ - libgsl-dev \ - liblz4-dev \ - liblzma-dev \ - libpcre3-dev \ - libtbb-dev \ - libx11-dev \ - libxext-dev \ - libxft-dev \ - libxpm-dev \ - libxerces-c-dev \ - libxxhash-dev \ - libzstd-dev \ - ninja-build \ - python3 \ - python3-dev \ - python3-pip \ - rsync \ - zlib1g-dev \ - ccache \ - && apt-get remove --purge -y gcc-9 \ - && apt-get autoremove -y \ - && apt-get clean -y - -# manual builds for hep-specific packages -ENV GET curl --location --silent --create-dirs -ENV UNPACK_TO_SRC tar -xz --strip-components=1 --directory src -ENV PREFIX /usr/local - -# CMake 3.16.3 version in APT is too old -# requires rsync; installation uses `rsync` instead of `install` -RUN mkdir src \ - && ${GET} https://github.com/Kitware/CMake/releases/download/v3.21.2/cmake-3.21.2-Linux-x86_64.tar.gz \ - | ${UNPACK_TO_SRC} \ - && rsync -ruv src/ ${PREFIX} \ - && cd .. \ - && rm -rf src - -# Geant4 -RUN mkdir src \ - && ${GET} https://geant4-data.web.cern.ch/releases/geant4.10.06.p01.tar.gz \ - | ${UNPACK_TO_SRC} \ - && . /opt/intel/oneapi/setvars.sh \ - && cmake -B build -S src -GNinja \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX=${PREFIX} \ - -DGEANT4_BUILD_CXXSTD=17 \ - -DGEANT4_INSTALL_DATA=OFF \ - -DGEANT4_USE_GDML=ON \ - -DGEANT4_USE_SYSTEM_EXPAT=ON \ - -DGEANT4_USE_SYSTEM_ZLIB=ON \ - && cmake --build build -- install \ - && rm -rf build src - -# HepMC3 -RUN mkdir src \ - && ${GET} https://hepmc.web.cern.ch/hepmc/releases/HepMC3-3.2.1.tar.gz \ - | ${UNPACK_TO_SRC} \ - && . /opt/intel/oneapi/setvars.sh \ - && cmake -B build -S src -GNinja \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX=${PREFIX} \ - -DHEPMC3_BUILD_STATIC_LIBS=OFF \ - -DHEPMC3_ENABLE_PYTHON=OFF \ - -DHEPMC3_ENABLE_ROOTIO=OFF \ - -DHEPMC3_ENABLE_SEARCH=OFF \ - && cmake --build build -- install \ - && rm -rf build src - -# Pythia8 -# requires rsync; installation uses `rsync` instead of `install` -RUN mkdir src \ - && ${GET} https://pythia.org/download/pythia82/pythia8244.tgz\ - | ${UNPACK_TO_SRC} \ - && cd src \ - && . /opt/intel/oneapi/setvars.sh \ - && ./configure --enable-shared --prefix=${PREFIX} \ - && make -j$(nproc) install \ - && cd .. \ - && rm -rf src - -# nlohmann's JSON -RUN mkdir src \ - && ${GET} https://github.com/nlohmann/json/archive/refs/tags/v3.10.2.tar.gz \ - | ${UNPACK_TO_SRC} \ - && . /opt/intel/oneapi/setvars.sh \ - && cmake -B build -S src -GNinja \ - -DCMAKE_BUILD_TYPE=Release \ - -DJSON_BuildTests=OFF \ - && cmake --build build -- install \ - && rm -rf build src - -# ROOT -RUN mkdir src \ - && ${GET} https://root.cern/download/root_v6.24.06.source.tar.gz \ - | ${UNPACK_TO_SRC} \ - && . /opt/intel/oneapi/setvars.sh \ - && cmake -B build -S src -GNinja \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_CXX_STANDARD=17 \ - -DCMAKE_INSTALL_PREFIX=${PREFIX} \ - -Dfail-on-missing=ON \ - -Dgminimal=ON \ - -Dgdml=ON \ - -Dopengl=ON \ - -Dpyroot=ON \ - && cmake --build build -- install \ - && rm -rf build src - -# environment variables needed for DD4hep to find ROOT libraries -ENV LD_LIBRARY_PATH /usr/local/lib -ENV PYTHON_PATH /usr/local/lib - -# podio -RUN mkdir src \ - && ${GET} https://github.com/AIDASoft/podio/archive/refs/tags/v00-14-01.tar.gz \ - | ${UNPACK_TO_SRC} \ - && . /opt/intel/oneapi/setvars.sh \ - && cmake -B build -S src -GNinja \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX=${PREFIX} \ - -DCMAKE_PREFIX_PATH=${PREFIX} \ - -DBUILD_TESTING=OFF \ - -USE_EXTERNAL_CATCH2=OFF \ - && cmake --build build -- install \ - && rm -rf build src - -# EDM4hep -RUN pip3 install jinja2 pyyaml \ - && mkdir src \ - && ${GET} https://github.com/key4hep/EDM4hep/archive/refs/tags/v00-04-02.tar.gz \ - | ${UNPACK_TO_SRC} \ - && . /opt/intel/oneapi/setvars.sh \ - && cmake -B build -S src -GNinja \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX=${PREFIX} \ - -DCMAKE_PREFIX_PATH=${PREFIX} \ - -DBUILD_TESTING=OFF \ - -DUSE_EXTERNAL_CATCH2=OFF \ - && cmake --build build -- install \ - && rm -rf build src - -# DD4hep -# requires Geant4 and ROOT and must come last -RUN mkdir src \ - && ${GET} https://github.com/AIDASoft/DD4hep/archive/v01-21.tar.gz \ - | ${UNPACK_TO_SRC} \ - && . /opt/intel/oneapi/setvars.sh \ - && cmake -B build -S src -GNinja \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_CXX_STANDARD=17 \ - -DCMAKE_INSTALL_PREFIX=${PREFIX} \ - -DCMAKE_PREFIX_PATH=${PREFIX} \ - -DBUILD_TESTING=OFF \ - -DDD4HEP_BUILD_PACKAGES="DDG4 DDDetectors DDRec" \ - -DDD4HEP_IGNORE_GEANT4_TLS=ON \ - -DDD4HEP_USE_GEANT4=ON \ - -DDD4HEP_USE_XERCESC=ON \ - -DDD4HEP_USE_EDM4HEP=ON \ - && cmake --build build -- install \ - && rm -rf build src +# Docker machinery, part of the ACTS project +# +# (c) 2021-2024 CERN for the benefit of the ACTS project +# +# Mozilla Public License Version 2.0 + +# Start from the (at the time of writing) latest Acts Ubuntu 20.04 image. +FROM ghcr.io/acts-project/ubuntu2004:v43 + +# Some description for the image. +LABEL description="Ubuntu 20.04 with Acts dependencies and oneAPI" +LABEL maintainer="Paul Gessinger /usr/share/keyrings/oneapi-archive-keyring.gpg + +# Set up the oneAPI repository. +COPY oneapi.list /etc/apt/sources.list.d/ + +# Install oneAPI. +ARG ONEAPI_VERSION=2024.1 +RUN apt-get update && \ + apt-get install -y intel-oneapi-compiler-dpcpp-cpp-${ONEAPI_VERSION} && \ + apt-get clean -y + +# Set up the environment. Note that one *MUST* source the +# /opt/intel/oneapi/setvars.sh script to make the following work. Which has to +# be done in the respective CI scripts. +ENV CC="clang" +ENV CXX="clang++" +ENV SYCLCXX="clang++ -fsycl" +ENV SYCLFLAGS="-fsycl-targets=spir64,spir64_x86_64" diff --git a/ubuntu2004_oneapi/oneapi.list b/ubuntu2004_oneapi/oneapi.list new file mode 100644 index 0000000..3939bca --- /dev/null +++ b/ubuntu2004_oneapi/oneapi.list @@ -0,0 +1 @@ +deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main diff --git a/ubuntu2004_rocm/Dockerfile b/ubuntu2004_rocm/Dockerfile index 7af98b7..f953468 100644 --- a/ubuntu2004_rocm/Dockerfile +++ b/ubuntu2004_rocm/Dockerfile @@ -1,198 +1,28 @@ -FROM rocm/dev-ubuntu-20.04:5.3 - -LABEL description="Ubuntu 20.04 with Acts dependencies and ROCm" -LABEL maintainer="Paul Gessinger /etc/apt/keyrings/rocm.gpg + +# Set up the ROCm repository. +COPY rocm.list /etc/apt/sources.list.d/ +COPY rocm-pin-600 /etc/apt/preferences.d/ + +# Install ROCm/HIP. +ARG ROCM_VERSION=6.1.1 +RUN apt-get update && \ + apt-get install -y rocm-hip-runtime-dev${ROCM_VERSION} && \ + apt-get clean -y +ENV HIP_PLATFORM=amd diff --git a/ubuntu2004_rocm/rocm-pin-600 b/ubuntu2004_rocm/rocm-pin-600 new file mode 100644 index 0000000..88348a5 --- /dev/null +++ b/ubuntu2004_rocm/rocm-pin-600 @@ -0,0 +1,3 @@ +Package: * +Pin: release o=repo.radeon.com +Pin-Priority: 600 diff --git a/ubuntu2004_rocm/rocm.list b/ubuntu2004_rocm/rocm.list new file mode 100644 index 0000000..a8f250e --- /dev/null +++ b/ubuntu2004_rocm/rocm.list @@ -0,0 +1 @@ +deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/rocm/apt/6.1.1 focal main diff --git a/ubuntu2004_rocm_oneapi/Dockerfile b/ubuntu2004_rocm_oneapi/Dockerfile index 6017435..5582571 100644 --- a/ubuntu2004_rocm_oneapi/Dockerfile +++ b/ubuntu2004_rocm_oneapi/Dockerfile @@ -1,49 +1,49 @@ +# Docker machinery, part of the ACTS project # -# Image building the Intel LLVM compiler from scratch, with Intel and AMD -# backend support. +# (c) 2021-2024 CERN for the benefit of the ACTS project # +# Mozilla Public License Version 2.0 -# Base the image on the repository's ubuntu2004_rocm configuration. -FROM ghcr.io/acts-project/ubuntu2004_rocm:v36 - -# Build the Intel DPC++ compiler from source. -ARG LLVM_VERSION=2022-12 -ARG LLVM_SOURCE_DIR=/root/llvm -ARG LLVM_BINARY_DIR=/root/build -RUN git clone https://github.com/intel/llvm.git ${LLVM_SOURCE_DIR} && \ - cd ${LLVM_SOURCE_DIR}/ && git checkout ${LLVM_VERSION} && \ - cmake -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX=${PREFIX} \ - -DLLVM_ENABLE_ASSERTIONS=ON -DCMAKE_INSTALL_LIBDIR=lib \ - -DLLVM_TARGETS_TO_BUILD="X86;AMDGPU" \ - -DLLVM_EXTERNAL_PROJECTS="sycl;sycl-fusion;llvm-spirv;opencl;libdevice;xpti;xptifw" \ - -DLLVM_ENABLE_PROJECTS="clang;compiler-rt;sycl;sycl-fusion;llvm-spirv;opencl;libdevice;xpti;xptifw;libclc;lld;clang-tools-extra;openmp" \ - -DLLVM_EXTERNAL_LLVM_SPIRV_SOURCE_DIR=${LLVM_SOURCE_DIR}/llvm-spirv \ - -DLLVM_EXTERNAL_SYCL_SOURCE_DIR=${LLVM_SOURCE_DIR}/sycl \ - -DLLVM_EXTERNAL_SYCL_FUSION_SOURCE_DIR=${LLVM_SOURCE_DIR}/sycl-fusion \ - -DLLVM_EXTERNAL_LIBDEVICE_SOURCE_DIR=${LLVM_SOURCE_DIR}/libdevice \ - -DLLVM_EXTERNAL_XPTI_SOURCE_DIR=${LLVM_SOURCE_DIR}/xpti \ - -DXPTI_SOURCE_DIR=${LLVM_SOURCE_DIR}/xpti \ - -DLLVM_EXTERNAL_XPTIFW_SOURCE_DIR=${LLVM_SOURCE_DIR}/xptifw \ - -DLIBCLC_TARGETS_TO_BUILD="amdgcn--;amdgcn--amdhsa" \ - -DLIBCLC_GENERATE_REMANGLED_VARIANTS=ON \ - -DLLVM_BUILD_TOOLS=ON -DSYCL_ENABLE_WERROR=OFF \ - -DSYCL_INCLUDE_TESTS=OFF -DLLVM_ENABLE_DOXYGEN=OFF \ - -DLLVM_ENABLE_SPHINX=OFF -DBUILD_SHARED_LIBS=OFF \ - -DSYCL_ENABLE_XPTI_TRACING=ON -DLLVM_ENABLE_LLD=OFF \ - -DLLVM_ENABLE_PIC=ON -DLLVM_ENABLE_RTTI=ON -DXPTI_ENABLE_WERROR=OFF \ - -DOpenCL_INSTALL_KHRONOS_ICD_LOADER=TRUE \ - -DSYCL_ENABLE_PLUGINS="opencl;level_zero;hip" \ - -DSYCL_ENABLE_KERNEL_FUSION=ON \ - -S ${LLVM_SOURCE_DIR}/llvm/ -B ${LLVM_BINARY_DIR} && \ - export MAKEFLAGS=-j`nproc` && \ - cmake --build ${LLVM_BINARY_DIR} --target intrinsics_gen && \ - cmake --build ${LLVM_BINARY_DIR} && \ - cmake --build ${LLVM_BINARY_DIR} --target sycl-toolchain && \ - cmake --install ${LLVM_BINARY_DIR} && \ - rm -rf ${LLVM_SOURCE_DIR} ${LLVM_BINARY_DIR} - -# Set up the correct runtime environment for using the compiler(s). -ENV CC="${PREFIX}/bin/clang" -ENV CXX="${PREFIX}/bin/clang++" -ENV SYCLCXX="${CXX} -fsycl -fsycl-targets=amdgcn-amd-amdhsa -Xsycl-target-backend --offload-arch=gfx803" +# Start from the (at the time of writing) latest Acts Ubuntu 20.04 image. +FROM ghcr.io/acts-project/ubuntu2004:v43 + +# Some description for the image. +LABEL description="Ubuntu 20.04 with Acts dependencies and ROCm/HIP + oneAPI" +LABEL maintainer="Paul Gessinger /etc/apt/keyrings/rocm.gpg + +# Set up the ROCm repository. +COPY rocm.list /etc/apt/sources.list.d/ +COPY rocm-pin-600 /etc/apt/preferences.d/ + +# Install ROCm/HIP. +ARG ROCM_VERSION=5.4.6 +RUN apt-get update && \ + apt-get install -y rocm-hip-runtime-dev${ROCM_VERSION} && \ + apt-get clean -y +ENV HIP_PLATFORM=amd + +# Set up the Intel package signing key. +RUN curl -SL https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | \ + gpg --dearmor > /usr/share/keyrings/oneapi-archive-keyring.gpg + +# Set up the oneAPI repository. +COPY oneapi.list /etc/apt/sources.list.d/ + +# Install oneAPI. +ARG ONEAPI_VERSION=2024.1 +RUN apt-get update && \ + apt-get install -y intel-oneapi-compiler-dpcpp-cpp-${ONEAPI_VERSION} && \ + apt-get clean -y + +# Set up the oneAPI environment. Note that one *MUST* source the +# /opt/intel/oneapi/setvars.sh script to make the following work. Which has to +# be done in the respective CI scripts. +ENV CC="clang" +ENV CXX="clang++" +ENV SYCLCXX="clang++ -fsycl" +ENV SYCLFLAGS="-fsycl-targets=spir64,spir64_x86_64,amd_gpu_gfx803 -Xclang -opaque-pointers" diff --git a/ubuntu2004_rocm_oneapi/oneapi.list b/ubuntu2004_rocm_oneapi/oneapi.list new file mode 100644 index 0000000..3939bca --- /dev/null +++ b/ubuntu2004_rocm_oneapi/oneapi.list @@ -0,0 +1 @@ +deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main diff --git a/ubuntu2004_rocm_oneapi/rocm-pin-600 b/ubuntu2004_rocm_oneapi/rocm-pin-600 new file mode 100644 index 0000000..88348a5 --- /dev/null +++ b/ubuntu2004_rocm_oneapi/rocm-pin-600 @@ -0,0 +1,3 @@ +Package: * +Pin: release o=repo.radeon.com +Pin-Priority: 600 diff --git a/ubuntu2004_rocm_oneapi/rocm.list b/ubuntu2004_rocm_oneapi/rocm.list new file mode 100644 index 0000000..146b36a --- /dev/null +++ b/ubuntu2004_rocm_oneapi/rocm.list @@ -0,0 +1 @@ +deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/rocm/apt/5.4.6 focal main