Files
TheRock/dockerfiles/install_rocm_deps.sh
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

175 lines
4.7 KiB
Bash

#!/bin/bash
# Copyright Advanced Micro Devices, Inc.
# SPDX-License-Identifier: MIT
# install_rocm_deps.sh
#
# Installs runtime dependencies for ROCm on various Linux distributions.
# Automatically detects the distribution and uses the appropriate package manager.
#
# Supported distributions:
# - Ubuntu 22.04, 24.04 (apt)
# - Debian 12, 13 (apt)
# - AlmaLinux 8 (dnf)
# - Azure Linux 3 (tdnf)
# - RHEL 8.10, 9.7, 10.1 (dnf)
# - SLES 15.7, 16.0 (zypper)
set -e
# Detect distribution type from /etc/os-release
detect_distro() {
if [ -f /etc/os-release ]; then
. /etc/os-release
echo "$ID"
else
echo "unknown"
fi
}
# Detect distribution version from /etc/os-release
detect_version() {
if [ -f /etc/os-release ]; then
. /etc/os-release
echo "${VERSION_ID:-unknown}"
else
echo "unknown"
fi
}
DISTRO=$(detect_distro)
VERSION_ID=$(detect_version)
echo "Detected distribution: $DISTRO"
echo "Detected version: $VERSION_ID"
case "$DISTRO" in
ubuntu|debian)
echo "Installing dependencies using apt..."
apt-get update
apt-get install -y --no-install-recommends \
ca-certificates \
curl \
gpg \
build-essential \
libelf1 \
libnuma1 \
libunwind8 \
libncurses6 \
perl \
file \
python3 \
python3-dev \
python3-pip \
kmod
# libdw: libdw1t64 for Ubuntu 24.04+, libdw1 for older versions
apt-get install -y --no-install-recommends libdw1t64 2>/dev/null || \
apt-get install -y --no-install-recommends libdw1 || true
# libssl: libssl3 for Ubuntu 22.04+, libssl1.1 for older versions
apt-get install -y --no-install-recommends libssl3 2>/dev/null || \
apt-get install -y --no-install-recommends libssl1.1 || true
rm -rf /var/lib/apt/lists/*
;;
almalinux)
echo "Installing dependencies using dnf..."
# Fix AlmaLinux repo to use direct baseurl instead of mirrorlist
if [ -f /etc/yum.repos.d/almalinux.repo ]; then
sed -i 's/^mirrorlist=/#mirrorlist=/g' /etc/yum.repos.d/almalinux.repo
sed -i 's/^# baseurl=/baseurl=/g' /etc/yum.repos.d/almalinux.repo
fi
dnf install -y --setopt=install_weak_deps=False \
ca-certificates \
curl \
libatomic \
elfutils-libelf \
elfutils-libs \
numactl-libs \
ncurses-libs \
openssl-libs \
perl \
file \
python3 \
python3-devel \
python3-pip \
kmod
dnf clean all
;;
azurelinux)
echo "Installing dependencies using tdnf..."
tdnf install -y \
ca-certificates \
curl \
tar \
libatomic \
elfutils-libelf \
elfutils-libs \
numactl-libs \
libunwind \
ncurses-libs \
openssl-libs \
perl \
file \
python3 \
python3-devel \
python3-pip \
kmod
tdnf clean all
;;
rhel)
echo "Installing dependencies using dnf for RHEL ${VERSION_ID}..."
# Use --allowerasing to handle curl-minimal vs curl conflict in UBI images
dnf install -y --setopt=install_weak_deps=False --allowerasing \
ca-certificates \
curl \
libatomic \
elfutils-libelf \
elfutils-libs \
numactl-libs \
ncurses-libs \
openssl-libs \
perl \
file \
python3 \
python3-devel \
python3-pip \
kmod
dnf clean all
;;
sles)
echo "Installing dependencies using zypper for SLES ${VERSION_ID}..."
# Refresh repos
zypper --non-interactive refresh || true
# Install dependencies
zypper --non-interactive install --no-recommends \
ca-certificates \
curl \
tar \
libatomic1 \
libelf1 \
libdw1 \
libnuma1 \
ncurses-utils \
perl \
file \
kmod \
python3 \
python3-devel \
python3-pip
zypper clean --all
;;
*)
echo "Error: Unsupported distribution: $DISTRO"
echo "Supported distributions: ubuntu, debian, almalinux, azurelinux, rhel, sles"
exit 1
;;
esac
echo "Dependencies installed successfully for $DISTRO"