Skip to content

Commit

Permalink
dockerfile for ROCM
Browse files Browse the repository at this point in the history
  • Loading branch information
dibryant committed May 7, 2024
1 parent 5166b53 commit 68ae299
Showing 1 changed file with 115 additions and 0 deletions.
115 changes: 115 additions & 0 deletions amd/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
ARG BASE_IMAGE
FROM ${BASE_IMAGE}
LABEL name="odh-notebook-rocm-python-3.9" \
summary="ROCm Python 3.9 base image for ODH notebooks" \
description="ROCm Python 3.9 builder image based on CentOS Stream 9 for ODH notebooks" \
io.k8s.display-name="ROCm Python 3.9 base image for ODH notebooks" \
io.k8s.description="ROCm Python 3.9 builder image based on C9S for ODH notebooks" \
authoritative-source-url="https://github.com/opendatahub-io/notebooks" \
io.openshift.build.commit.ref="main" \
io.openshift.build.source-location="https://github.com/opendatahub-io/notebooks/tree/main/amd/python-3.9" \
io.openshift.build.image="quay.io/opendatahub/workbench-images:rocm-python-3.9"

USER 0
WORKDIR /opt/app-root/bin

ARG ROCM_VERSION=5.3
ARG AMDGPU_VERSION=5.3
# Base
RUN yum -y install git java-1.8.0-openjdk python; yum clean all

# Enable epel-release repositories
# RUN yum --enablerepo=extras install -y epel-release
RUN dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm && \
dnf clean all && rm -rf /var/cache/yum


# Install required base build and packaging commands for ROCm
RUN yum -y install \
ca-certificates \
bc \
bridge-utils \
cmake \
cmake3 \
dpkg \
file \
python3-pip \
gettext \
gcc-c++ \
libgcc \
glibc.i686 \
ncurses \
ncurses-base \
ncurses-libs \
numactl-libs \
libssh \
libunwind-devel \
libunwind \
llvm \
llvm-libs \
make \
openssl \
openssl-libs \
openssh \
openssh-clients \
pciutils \
pciutils-libs \
python \
python-pip \
python-devel \
pkgconfig \
kmod \
file \
rpm \
rpm-build \
wget
# Can't install these packages
# devscripts \
# doxygen \
# lzma need by dpkg-dev \
# dpkg-perl \
# elfutils-libelf-devel \ needed by dkms \
# expect \
# python3-dev \
# libcxx-devel \
# numactl-devel \
# pciutils-devel \
# pth \
# qemu-kvm \
# re2c \
# subversion \


# Enable the epel repository for fakeroot
# RUN yum --enablerepo=extras install -y fakeroot
# RUN yum clean all
RUN dnf install -y fakeroot
RUN yum clean all


# On CentOS, install package centos-release-scl available in CentOS repository:
# RUN yum install -y centos-release-scl

# Install the devtoolset-7 collection:
# RUN yum install -y devtoolset-7
# RUN yum install -y devtoolset-7-libatomic-devel devtoolset-7-elfutils-libelf-devel

# Install the ROCm rpms
RUN yum clean all
RUN echo -e "[ROCm]\nname=ROCm\nbaseurl=https://repo.radeon.com/rocm/yum/$ROCM_VERSION/main\nenabled=1\ngpgcheck=0" >> /etc/yum.repos.d/rocm.repo
RUN echo -e "[amdgpu]\nname=amdgpu\nbaseurl=https://repo.radeon.com/amdgpu/$AMDGPU_VERSION/rhel/7.9/main/x86_64\nenabled=1\ngpgcheck=0" >> /etc/yum.repos.d/amdgpu.repo

RUN yum install -y rocm-dev rocm-libs

# Set ENV to enable devtoolset7 by default
ENV PATH=/opt/rh/devtoolset-7/root/usr/bin:/opt/rocm/hcc/bin:/opt/rocm/hip/bin:/opt/rocm/bin:/opt/rocm/hcc/bin:${PATH:+:${PATH}}
ENV MANPATH=/opt/rh/devtoolset-7/root/usr/share/man:${MANPATH}
ENV INFOPATH=/opt/rh/devtoolset-7/root/usr/share/info${INFOPATH:+:${INFOPATH}}
ENV PCP_DIR=/opt/rh/devtoolset-7/root
ENV PERL5LIB=/opt/rh/devtoolset-7/root//usr/lib64/perl5/vendor_perl:/opt/rh/devtoolset-7/root/usr/lib/perl5:/opt/rh/devtoolset-7/root//usr/share/perl5/
ENV LD_LIBRARY_PATH=/opt/rocm/lib:/usr/local/lib:/opt/rh/devtoolset-7/root$rpmlibdir$rpmlibdir32${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
ENV PYTHONPATH=/opt/rh/devtoolset-7/root/usr/lib64/python$pythonvers/site-packages:/opt/rh/devtoolset-7/root/usr/lib/python$pythonvers/
ENV LDFLAGS="-Wl,-rpath=/opt/rh/devtoolset-7/root/usr/lib64 -Wl,-rpath=/opt/rh/devtoolset-7/root/usr/lib"
# Restore notebook user workspace
USER 1001
WORKDIR /opt/app-root/srcScd all

0 comments on commit 68ae299

Please sign in to comment.