From f03dce5fa6fbb92d2b5ddf8a436aeb34ba481ba6 Mon Sep 17 00:00:00 2001 From: David Galiffi Date: Fri, 18 Apr 2025 16:33:34 -0400 Subject: [PATCH] Fix the rocm installation (#172) --- docker/Dockerfile.opensuse | 12 ++++++++---- docker/Dockerfile.rhel | 10 +++++++--- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/docker/Dockerfile.opensuse b/docker/Dockerfile.opensuse index a48a4147e4..1bcea11fd6 100644 --- a/docker/Dockerfile.opensuse +++ b/docker/Dockerfile.opensuse @@ -28,12 +28,16 @@ RUN zypper --non-interactive update -y && \ python3 -m pip install 'cmake==3.21' ARG ROCM_VERSION=0.0 -ARG AMDGPU_RPM=6.2/sle/15.6/amdgpu-install-6.2.60200-1.noarch.rpm RUN if [ "${ROCM_VERSION}" != "0.0" ]; then \ - OS_VERSION_MINOR=$(cat /etc/os-release | grep 'VERSION_ID' | sed 's/=/ /1' | awk '{print $NF}' | sed 's/"//g' | sed 's/\./ /g' | awk '{print $2}') && \ - zypper --non-interactive addrepo https://download.opensuse.org/repositories/devel:languages:perl/15.${OS_VERSION_MINOR}/devel:languages:perl.repo && \ - zypper --non-interactive --no-gpg-checks install -y https://repo.radeon.com/amdgpu-install/${AMDGPU_RPM} && \ + OS_VERSION=$(grep '^VERSION_ID=' /etc/os-release | cut -d'=' -f2 | tr -d '"') && \ + OS_VERSION_MAJOR=$(echo "$OS_VERSION" | cut -d'.' -f1) && \ + OS_VERSION_MINOR=$(echo "$OS_VERSION" | cut -d'.' -f2) && \ + ROCM_MAJOR=$(echo "${ROCM_VERSION}" | sed 's/\./ /g' | awk '{print $1}') && \ + ROCM_MINOR=$(echo "${ROCM_VERSION}" | sed 's/\./ /g' | awk '{print $2}') && \ + ROCM_VERSN=$(( ("${ROCM_MAJOR}"*10000)+("${ROCM_MINOR}"*100) )) && \ + zypper --non-interactive addrepo https://download.opensuse.org/repositories/devel:languages:perl/15.6/devel:languages:perl.repo && \ + zypper --non-interactive --no-gpg-checks install -y https://repo.radeon.com/amdgpu-install/${ROCM_VERSION}/sle/${OS_VERSION}/amdgpu-install-${ROCM_MAJOR}.${ROCM_MINOR}.${ROCM_VERSN}-1.noarch.rpm && \ zypper --non-interactive --gpg-auto-import-keys refresh && \ zypper --non-interactive install -y rocm-dev rccl-devel libpciaccess0 && \ zypper --non-interactive clean --all; \ diff --git a/docker/Dockerfile.rhel b/docker/Dockerfile.rhel index 486952de3f..c032a1a68b 100644 --- a/docker/Dockerfile.rhel +++ b/docker/Dockerfile.rhel @@ -22,13 +22,17 @@ RUN yum groupinstall -y "Development Tools" && \ python3 -m pip install 'perfetto' ARG ROCM_VERSION=0.0 -ARG AMDGPU_RPM=6.2/rhel/9.4/amdgpu-install-6.2.60202-1.el9.noarch.rpm RUN if [ "${ROCM_VERSION}" != "0.0" ]; then \ - OS_VERSION_MAJOR=$(cat /etc/os-release | grep 'VERSION_ID' | sed 's/=/ /1' | awk '{print $NF}' | sed 's/"//g' | sed 's/\./ /g' | awk '{print $1}') && \ + OS_VERSION=$(grep '^VERSION_ID=' /etc/os-release | cut -d'=' -f2 | tr -d '"') && \ + OS_VERSION_MAJOR=$(echo "$OS_VERSION" | cut -d'.' -f1) && \ + RPM_TAG=".el${OS_VERSION_MAJOR}" && \ + ROCM_MAJOR=$(echo "${ROCM_VERSION}" | sed 's/\./ /g' | awk '{print $1}') && \ + ROCM_MINOR=$(echo "${ROCM_VERSION}" | sed 's/\./ /g' | awk '{print $2}') && \ + ROCM_VERSN=$(( ("${ROCM_MAJOR}"*10000)+("${ROCM_MINOR}"*100) )) && \ if [ "${OS_VERSION_MAJOR}" -eq 8 ]; then PERL_REPO=powertools; else PERL_REPO=crb; fi && \ dnf -y --enablerepo=${PERL_REPO} install perl-File-BaseDir && \ - yum install -y https://repo.radeon.com/amdgpu-install/${AMDGPU_RPM} && \ + yum install -y https://repo.radeon.com/amdgpu-install/${ROCM_VERSION}/rhel/${OS_VERSION}/amdgpu-install-${ROCM_MAJOR}.${ROCM_MINOR}.${ROCM_VERSN}-1${RPM_TAG}.noarch.rpm && \ yum install -y rocm-dev && \ yum clean all; \ fi