From f3d4d772494ced9273e2a5cf88fdcf1870b740ac Mon Sep 17 00:00:00 2001 From: Fabrice Le Goff Date: Fri, 8 Nov 2024 11:04:20 +0100 Subject: [PATCH 1/3] added container to build traccc/SYCL for AMD GPU backend on Alma9 --- alma9_rocm_oneapi/Dockerfile | 48 +++++++++++++++++++++++++++++++++++ alma9_rocm_oneapi/oneapi.repo | 7 +++++ alma9_rocm_oneapi/rocm.repo | 7 +++++ alma9_rocm_oneapi/setenv.sh | 27 ++++++++++++++++++++ 4 files changed, 89 insertions(+) create mode 100644 alma9_rocm_oneapi/Dockerfile create mode 100644 alma9_rocm_oneapi/oneapi.repo create mode 100644 alma9_rocm_oneapi/rocm.repo create mode 100755 alma9_rocm_oneapi/setenv.sh diff --git a/alma9_rocm_oneapi/Dockerfile b/alma9_rocm_oneapi/Dockerfile new file mode 100644 index 0000000..4cc370c --- /dev/null +++ b/alma9_rocm_oneapi/Dockerfile @@ -0,0 +1,48 @@ +# Docker machinery, part of the ACTS project +# +# (c) 2024 CERN for the benefit of the ACTS project +# +# Mozilla Public License Version 2.0 + +FROM cern/alma9-base:latest + +LABEL description="CERN AlmaLinux 9 with Acts dependencies and ROCm/HIP + oneAPI" +LABEL version="1" + +RUN dnf install -y https://linuxsoft.cern.ch/wlcg/el9/x86_64/HEP_OSlibs-9.1.0-2.el9.x86_64.rpm \ + && dnf -y clean all + +# Set up gcc 13. +RUN dnf install -y gcc-toolset-13 + +# Install boost development package +RUN dnf install -y boost boost-devel + +# Set up the ROCm repository. +COPY rocm.repo /etc/yum.repos.d/rocm.repo +ARG ROCM_VERSION=6.1.0 + +# Install ROCm/HIP: latest version supported by the CodePlay plugin +RUN dnf install -y rocm-hip-runtime-devel +ENV HIP_PLATFORM=amd + +# Set up the oneAPI repository. +COPY oneapi.repo /etc/yum.repos.d/oneapi.repo + +# Install oneAPI. +ARG ONEAPI_VERSION=2024.2 +RUN dnf install -y intel-oneapi-compiler-dpcpp-cpp-${ONEAPI_VERSION} + +# Install the CodePlay AMD plugin on top of oneAPI. +RUN ONEAPI_INSTALLED_VERSION=$(/opt/intel/oneapi/compiler/latest/bin/icpx --version | grep -oP '(?<=Intel\(R\) oneAPI DPC\+\+\/C\+\+ Compiler )[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+') && \ + echo "Installing CodePlay for OneAPI ${ONEAPI_INSTALLED_VERSION}" && \ + curl -SL "https://developer.codeplay.com/api/v1/products/download?product=oneapi&variant=amd&version=${ONEAPI_INSTALLED_VERSION}&filters[]=${ROCM_VERSION}&filters[]=linux" \ + -o plugin.sh && \ + sh plugin.sh --install-dir /opt/intel/oneapi --yes && \ + rm plugin.sh + +# By default the environment with ROCm, OneAPI SYCL compiler, and AMD backend plugin is loaded +ADD --chmod=700 setenv.sh / +# Make sure it's executable +RUN chmod +x /setenv.sh +ENTRYPOINT /setenv.sh diff --git a/alma9_rocm_oneapi/oneapi.repo b/alma9_rocm_oneapi/oneapi.repo new file mode 100644 index 0000000..ec85829 --- /dev/null +++ b/alma9_rocm_oneapi/oneapi.repo @@ -0,0 +1,7 @@ +[oneAPI] +name=Intel oneAPI repository +baseurl=https://yum.repos.intel.com/oneapi +enabled=1 +gpgcheck=1 +repo_gpgcheck=1 +gpgkey=https://yum.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB diff --git a/alma9_rocm_oneapi/rocm.repo b/alma9_rocm_oneapi/rocm.repo new file mode 100644 index 0000000..b34595f --- /dev/null +++ b/alma9_rocm_oneapi/rocm.repo @@ -0,0 +1,7 @@ +[ROCm-6.1.0] +name=ROCm6.1.0 +baseurl=https://repo.radeon.com/rocm/el9/6.1/main +enabled=1 +priority=50 +gpgcheck=1 +gpgkey=https://repo.radeon.com/rocm/rocm.gpg.key diff --git a/alma9_rocm_oneapi/setenv.sh b/alma9_rocm_oneapi/setenv.sh new file mode 100755 index 0000000..37b780b --- /dev/null +++ b/alma9_rocm_oneapi/setenv.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +GCCDIR=/opt/rh/gcc-toolset-13/root + +# Set up gcc 13. +source ${GCCDIR}/../enable +# Set up SYCL compiler, including AMD backend. +source /opt/intel/oneapi/setvars.sh --include-intel-llvm + +# Set up the compilers to use (with CMake). +export CC="`which clang` --gcc-toolchain=${GCCDIR}" +export CXX="`which clang++` --gcc-toolchain=${GCCDIR}" + +# Set up the compiler and its options for SYCL +# gfx90a is the GPU at RAL +export SYCLCXX="${CXX} -fsycl" +export SYCLFLAGS="-fsycl-targets=amd_gpu_gfx90a -Xclang -opaque-pointers" + +export TRACCC_URL="https://github.com/acts-project/traccc" + +# Clean +unset GCCDIR + +echo "git clone $TRACCC_URL" +echo "cmake -S . -B buildamd -DTRACCC_BUILD_SYCL=ON -DTRACCC_USE_ROOT=OFF -DCMAKE_INSTALL_PREFIX:PATH=./installed" +echo "cmake --build buildamd --target install" + +bash From 2e13bccabc5302d635cfaefeb97ad8d1f1744e5d Mon Sep 17 00:00:00 2001 From: Fabrice Le Goff Date: Fri, 8 Nov 2024 14:21:24 +0100 Subject: [PATCH 2/3] alma9_rocm_oneapi: make sure AMD GPU are visible --- alma9_rocm_oneapi/setenv.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/alma9_rocm_oneapi/setenv.sh b/alma9_rocm_oneapi/setenv.sh index 37b780b..47b349f 100755 --- a/alma9_rocm_oneapi/setenv.sh +++ b/alma9_rocm_oneapi/setenv.sh @@ -15,11 +15,14 @@ export CXX="`which clang++` --gcc-toolchain=${GCCDIR}" export SYCLCXX="${CXX} -fsycl" export SYCLFLAGS="-fsycl-targets=amd_gpu_gfx90a -Xclang -opaque-pointers" -export TRACCC_URL="https://github.com/acts-project/traccc" +# HIP_VISIBLE_DEVICES=all does not work +export HIP_VISIBLE_DEVICES=0,1 # Clean unset GCCDIR +# For user's convenience: +export TRACCC_URL="https://github.com/acts-project/traccc" echo "git clone $TRACCC_URL" echo "cmake -S . -B buildamd -DTRACCC_BUILD_SYCL=ON -DTRACCC_USE_ROOT=OFF -DCMAKE_INSTALL_PREFIX:PATH=./installed" echo "cmake --build buildamd --target install" From 8fdd5508091703983c3da617a34d543b2a9f21ac Mon Sep 17 00:00:00 2001 From: Fabrice Le Goff Date: Tue, 12 Nov 2024 08:38:49 +0100 Subject: [PATCH 3/3] add container to build matrix --- .github/workflows/build-images.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-images.yml b/.github/workflows/build-images.yml index 5fa572e..716ec27 100644 --- a/.github/workflows/build-images.yml +++ b/.github/workflows/build-images.yml @@ -30,6 +30,7 @@ jobs: - ubuntu2404_rocm_oneapi - ubuntu2404_oneapi - alma9-base + - alma9_rocm_oneapi steps: - uses: actions/checkout@v4