# Copyright (c) Advanced Micro Devices, Inc. All rights reserved. # # SPDX-License-Identifier: MIT ARG SUSE_MAJOR_VERSION=15 ARG SUSE_MINOR_VERSION=6 FROM opensuse/leap:${SUSE_MAJOR_VERSION}.${SUSE_MINOR_VERSION} AS base LABEL org.opencontainers.image.source=https://github.com/ROCm/hipFile ARG SUSE_MAJOR_VERSION ARG SUSE_MINOR_VERSION ARG ROCM_VERSION=7.2.2 # If the target ROCm Version on the package repository is non-standard, you can forcibly # set the ROCm version used in the package repo URL. # Ex. Package 7.0_alpha installs 7.0.0 ARG ROCM_PKG_REPO_OVERRIDE # The initial pull takes some time. Expect ~2.5 minutes to complete. RUN zypper refresh # Setup AMD/ROCm Repositories (using AMD SLES repo) # Method 1: Using amdgpu_install.rpm - buggy # The ROCm repo works in mysterious ways in that someone visiting from # a browser can download a certain version, but a utility like curl will # not be allowed to download it. Sometimes we may need to just forcibly # specify the version to make this work... # ARG AMDGPU_INSTALL="amdgpu-install-6.4.60402-1.el9.noarch.rpm" # RUN : "${AMDGPU_INSTALL:=$( \ # curl -s https://repo.radeon.com/amdgpu-install/latest/sle/${SUSE_VERSION}/ | \ # grep -oP '(?<=href=")[^"]+' | \ # grep amdgpu-install)}" && \ # echo "AMDGPU_INSTALL is: ${AMDGPU_INSTALL}" && \ # curl https://repo.radeon.com/amdgpu-install/latest/sle/${SUSE_VERSION}/${AMDGPU_INSTALL} \ # -o amdgpu_install.rpm && \ # dnf install -y ./amdgpu_install.rpm # Method 2: Manually create repo file. # ROCM_PKG_REPO_VERSION normalizes the ROCm version used in the package repo URL. # If the PATCH component is 0, the PATCH of the version is dropped. Otherwise no # modification is made. RUN ROCM_PKG_REPO_VERSION="$(echo ${ROCM_PKG_REPO_OVERRIDE:-$ROCM_VERSION} | sed -E 's|([^.]+\.[^.]+)\.0$|\1|')"; \ cat < /etc/zypp/repos.d/rocm.repo [ROCm-${ROCM_VERSION}] name=ROCm${ROCM_VERSION} baseurl=https://repo.radeon.com/rocm/zyp/${ROCM_PKG_REPO_VERSION}/main enabled=1 priority=50 gpgcheck=1 gpgkey=https://repo.radeon.com/rocm/rocm.gpg.key EOF RUN zypper --gpg-auto-import-keys refresh # Development Dependencies # clang18 missing. # llvm-dev == llvm-devel # graphviz - Dozygen dependency # Defaults to gcc7. Use gcc13 to match Ubuntu24. RUN zypper install -y \ clang19 \ cmake \ doxygen \ gcc13-c++ \ gdb \ git \ graphviz \ hip-devel \ libmount-devel \ llvm19-devel \ python312-devel \ rocm-device-libs \ rpm-build # Configure system linker for ROCm RUN cat < /etc/ld.so.conf.d/rocm.conf /opt/rocm/lib /opt/rocm/lib64 EOF RUN ldconfig # Add ROCm bin directory to the path ENV PATH=/opt/rocm/bin:${PATH} # Environment Build Arg for ROCm Packaging ENV ROCM_VERSION="${ROCM_VERSION}" ENV SLES_BUILD_ID_PREFIX="opensuse${SUSE_MAJOR_VERSION}${SUSE_MINOR_VERSION}." # Configure SUSE to use GCC-13 by default RUN update-alternatives \ --install /usr/bin/gcc gcc /usr/bin/gcc-13 100 \ --slave /usr/bin/cc cc /usr/bin/gcc-13 \ --slave /usr/bin/g++ g++ /usr/bin/g++-13 # AIS Code Repository Mount Point VOLUME /mnt/ais # Generic Mount point for container to access AIS-capable storage. VOLUME /mnt/ais-fs # ---- Stage 2: NVIDIA (extends base with CUDA SDK) ---- # The HIP runtime must be present to use hipFile with NVIDIA GPUs, # which is why this stage inherits from base rather than a bare CUDA image. FROM base AS nvidia ARG SUSE_MAJOR_VERSION=15 # Install a minimal CUDA SDK RUN curl https://developer.download.nvidia.com/compute/cuda/repos/opensuse${SUSE_MAJOR_VERSION}/$(uname -m)/cuda-opensuse${SUSE_MAJOR_VERSION}.repo \ -o /etc/zypp/repos.d/cuda-opensuse${SUSE_MAJOR_VERSION}.repo && \ zypper --gpg-auto-import-keys refresh # https://gitlab.com/nvidia/container-images/cuda/blob/master/dist/12.6.1/ubuntu2404/devel/Dockerfile # Attempt a "minimal" CUDA Dev install. # libcufile-dev-X.Y == libcufile-devel-X.Y # libnvidia-compute-570-server == nvidia-open-driver-G06 + nvidia-computer-G06 # (Must specify also specify full package version to install.) # (No named version packages in zypper.) # (opensuse15.6 Nvidia supports starts at 575.) RUN zypper install -y \ cuda-minimal-build-12-9 \ libcufile-devel-12-9 \ nvidia-compute-G06=575.57.08-1 \ nvidia-open-driver-G06=575.57.08-1 # Repair set alternative in case above zypper install # broke the symlink. RUN update-alternatives --auto gcc # Add CUDA bin directory to the path ENV PATH=/usr/local/cuda/bin:${PATH}