ARG DISTRO=ubuntu ARG VERSION=22.04 ARG BASE_IMAGE=${DISTRO}:${VERSION} FROM ${BASE_IMAGE} ENV HOME=/root ENV LANG=C.UTF-8 ENV SHELL=/bin/bash ENV BASH_ENV=/etc/bash.bashrc ENV DEBIAN_FRONTEND=noninteractive WORKDIR /tmp SHELL [ "/bin/bash", "-c" ] ARG EXTRA_PACKAGES="" ARG ELFUTILS_DOWNLOAD_VERSION="0.188" ARG NJOBS="8" ENV PATH="/usr/local/bin:${PATH}" ENV LIBRARY_PATH="/usr/local/lib:/usr/local/lib64" ENV LD_LIBRARY_PATH="/usr/local/lib:/usr/local/lib64" ENV CMAKE_PREFIX_PATH="/usr/local" RUN apt-get update && \ apt-get dist-upgrade -y && \ apt-get install -y autoconf autotools-dev bash-completion build-essential \ bzip2 ccache chrpath cmake curl environment-modules flex gettext git-core gnupg2 \ gzip iproute2 libgmock-dev libgtest-dev libiberty-dev libpapi-dev libpfm4-dev \ libsqlite3-dev libtool locales lsb-release m4 ninja-build nlohmann-json3-dev \ pkg-config python3-pip software-properties-common unzip wget vim zip zlib1g-dev \ libucx-dev ucx-utils && \ apt-get autoclean RUN OS_VERSION=$(grep '^VERSION_ID=' /etc/os-release | cut -d'=' -f2 | tr -d '"') && \ OS_ID=$(grep '^ID=' /etc/os-release | cut -d'=' -f2 | tr -d '"') && \ if [ "${OS_ID}" == "ubuntu" ] && [ "${OS_VERSION}" == "22.04" ]; then \ python3 -m pip install 'cmake==3.25' perfetto; \ else \ python3 -m pip install --break-system-packages 'cmake==3.25' perfetto; \ fi RUN if ! pip show perfetto 2>&1 | tee pip_output.log | grep -q "WARNING"; then \ echo "perfetto successfully installed!"; \ else \ echo "ERROR: perfetto install failed."; \ exit 1; \ fi ARG PYTHON_VERSIONS="8 9 10 11 12 13" # Install pytest test dependencies into each conda env COPY requirements.txt /tmp/requirements.txt RUN wget https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh -O miniforge.sh && \ bash miniforge.sh -b -p /opt/conda && \ export PATH="/opt/conda/bin:${PATH}" && \ conda config --set always_yes yes --set changeps1 no --set solver classic && \ conda update -c conda-forge -n base conda && \ for i in ${PYTHON_VERSIONS}; do \ conda create -n py3.${i} -c conda-forge python=3.${i} pip && \ /opt/conda/envs/py3.${i}/bin/python -m pip install -r /tmp/requirements.txt; \ done && \ conda clean -a -y # Install pytest test dependencies for system python RUN if python3 -c "import sys; sys.exit(0 if sys.version_info >= (3, 8) else 1)"; then \ OS_VERSION=$(grep '^VERSION_ID=' /etc/os-release | cut -d'=' -f2 | tr -d '"') && \ OS_ID=$(grep '^ID=' /etc/os-release | cut -d'=' -f2 | tr -d '"') && \ if [ "${OS_ID}" == "ubuntu" ] && [ "${OS_VERSION}" == "22.04" ]; then \ python3 -m pip install --upgrade pip; \ python3 -m pip install -r /tmp/requirements.txt; \ else \ python3 -m pip install --break-system-packages -r /tmp/requirements.txt; \ fi; \ else \ echo "Skipping system Python install: $(python3 --version 2>&1) is too old (rocprofiler-systems test suite requires >=3.8)"; \ fi && \ rm -f /tmp/requirements.txt # The Rock Tarball ARG GPU_TYPE="" RUN if [ -n "${GPU_TYPE}" ]; then \ TARBALL=$(curl -fsSL "https://rocm.nightlies.amd.com/tarball-multi-arch/" | \ grep -oE "\"name\": \"therock-dist-linux-${GPU_TYPE}-[^\"]+\", \"mtime\": [0-9.]+" | \ sort -t' ' -k4 -g | \ tail -1 | \ sed 's/.*"name": "\([^"]*\)".*/\1/'); \ test -n "${TARBALL}" || { echo "Error: no therock-dist-linux-${GPU_TYPE}-* tarball found" >&2; exit 1; }; \ VERSION=$(echo "${TARBALL}" | sed -nE 's/.*([0-9]+\.[0-9]+\.[0-9]+).*/\1/p'); \ test -n "${VERSION}" || { echo "Error: could not extract version from '${TARBALL}'" >&2; exit 1; }; \ curl -fSL "https://rocm.nightlies.amd.com/tarball-multi-arch/${TARBALL}" \ -o "/opt/rocm-${VERSION}-${GPU_TYPE}.tar.gz"; \ fi ARG ROCM_VERSION="" RUN if [ -n "${ROCM_VERSION}" ]; then \ ROCM_MAJOR=$(echo ${ROCM_VERSION} | cut -d. -f1) && \ ROCM_MINOR=$(echo ${ROCM_VERSION} | cut -d. -f2) && \ ROCM_VERSN=$(( (ROCM_MAJOR*10000)+(ROCM_MINOR*100) )) && \ OS_CODENAME=$(grep '^VERSION_CODENAME=' /etc/os-release | cut -d'=' -f2) && \ if [ "${OS_CODENAME}" = "bookworm" ]; then OS_CODENAME=jammy; fi && \ wget -q https://repo.radeon.com/amdgpu-install/${ROCM_VERSION}/ubuntu/${OS_CODENAME}/amdgpu-install_${ROCM_MAJOR}.${ROCM_MINOR}.${ROCM_VERSN}-1_all.deb && \ DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-downgrades \ -o Dpkg::Options::="--force-confnew" \ ./amdgpu-install_${ROCM_MAJOR}.${ROCM_MINOR}.${ROCM_VERSN}-1_all.deb && \ rm -f ./amdgpu-install_*.deb && \ apt-get update && \ if [ ! -d /opt/rocm ]; then \ apt-get install -y rocm-dev; \ fi && \ apt-get install -y rocdecode-dev libavformat-dev libavcodec-dev libomp-dev libopenmpi-dev && \ apt-get autoclean; \ fi ENV LC_ALL=C.UTF-8 WORKDIR /home SHELL [ "/bin/bash", "--login", "-c" ]