Skip to content

Commit 7459f52

Browse files
committed
creating rocm tensorflow python 3.12 image
1 parent a5c9144 commit 7459f52

File tree

12 files changed

+8831
-480
lines changed

12 files changed

+8831
-480
lines changed

Makefile

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -423,9 +423,9 @@ else ifeq ($(PYTHON_VERSION), 3.12)
423423
runtimes/datascience/ubi9-python-$(PYTHON_VERSION) \
424424
runtimes/pytorch/ubi9-python-$(PYTHON_VERSION) \
425425
runtimes/tensorflow/ubi9-python-$(PYTHON_VERSION) \
426-
runtimes/rocm-pytorch/ubi9-python-$(PYTHON_VERSION)
427-
# runtimes/rocm-tensorflow/ubi9-python-$(PYTHON_VERSION)
428-
# jupyter/rocm/tensorflow/ubi9-python-$(PYTHON_VERSION)
426+
runtimes/rocm-pytorch/ubi9-python-$(PYTHON_VERSION) \
427+
jupyter/rocm/pytorch/ubi9-python-$(PYTHON_VERSION) \
428+
jupyter/rocm/tensorflow/ubi9-python-$(PYTHON_VERSION)
429429
# rstudio/rhel9-python-$(PYTHON_VERSION)
430430
# rstudio/c9s-python-$(PYTHON_VERSION)
431431
else
@@ -514,14 +514,15 @@ all-images: \
514514
runtime-cuda-tensorflow-ubi9-python-$(RELEASE_PYTHON_VERSION) \
515515
rocm-jupyter-minimal-ubi9-python-$(RELEASE_PYTHON_VERSION) \
516516
rocm-jupyter-pytorch-ubi9-python-$(RELEASE_PYTHON_VERSION) \
517-
rocm-runtime-pytorch-ubi9-python-$(RELEASE_PYTHON_VERSION)
518-
# rocm-runtime-tensorflow-ubi9-python-$(RELEASE_PYTHON_VERSION)
517+
rocm-runtime-pytorch-ubi9-python-$(RELEASE_PYTHON_VERSION) \
518+
rocm-jupyter-pytorch-ubi9-python-$(RELEASE_PYTHON_VERSION) \
519+
rocm-jupyter-tensorflow-ubi9-python-$(RELEASE_PYTHON_VERSION) \
520+
rocm-jupyter-tensorflow-ubi9-python-$(RELEASE_PYTHON_VERSION)
519521
# rstudio-c9s-python-$(RELEASE_PYTHON_VERSION)
520522
# cuda-rstudio-c9s-python-$(RELEASE_PYTHON_VERSION)
521523
# rstudio-rhel9-python-$(RELEASE_PYTHON_VERSION)
522524
# cuda-rstudio-rhel9-python-$(RELEASE_PYTHON_VERSION)
523-
# rocm-jupyter-tensorflow-ubi9-python-$(RELEASE_PYTHON_VERSION)
524-
525+
# rocm-jupyter-minimal-ubi9-python-$(RELEASE_PYTHON_VERSION)
525526
else
526527
$(error Invalid Python version $(RELEASE_PYTHON_VERSION))
527528
endif
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[packages-microsoft-com-prod]
2+
name=packages-microsoft-com-prod
3+
baseurl=https://packages.microsoft.com/rhel/9.0/prod/
4+
enabled=1
5+
gpgcheck=1
6+
gpgkey=https://packages.microsoft.com/keys/microsoft.asc
Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
######################################################
2+
# mongocli-builder (build stage only, not published) #
3+
######################################################
4+
FROM registry.access.redhat.com/ubi9/go-toolset:latest AS mongocli-builder
5+
6+
ARG MONGOCLI_VERSION=2.0.3
7+
8+
WORKDIR /tmp/
9+
RUN curl -Lo mongodb-cli-mongocli-v${MONGOCLI_VERSION}.zip https://github.com/mongodb/mongodb-cli/archive/refs/tags/mongocli/v${MONGOCLI_VERSION}.zip
10+
RUN unzip ./mongodb-cli-mongocli-v${MONGOCLI_VERSION}.zip
11+
RUN cd ./mongodb-cli-mongocli-v${MONGOCLI_VERSION}/ && \
12+
CGO_ENABLED=1 GOOS=linux go build -a -tags strictfipsruntime -o /tmp/mongocli ./cmd/mongocli/
13+
14+
####################
15+
# base #
16+
####################
17+
FROM registry.access.redhat.com/ubi9/python-312:latest AS base
18+
19+
WORKDIR /opt/app-root/bin
20+
21+
# OS Packages needs to be installed as root
22+
USER 0
23+
24+
# Install useful OS packages
25+
RUN dnf install -y mesa-libGL skopeo && dnf clean all && rm -rf /var/cache/yum
26+
27+
# Other apps and tools installed as default user
28+
USER 1001
29+
30+
# Install micropipenv to deploy packages from Pipfile.lock
31+
RUN pip install --no-cache-dir -U "micropipenv[toml]"
32+
33+
# Install the oc client
34+
RUN curl -L https://mirror.openshift.com/pub/openshift-v4/$(uname -m)/clients/ocp/stable/openshift-client-linux.tar.gz \
35+
-o /tmp/openshift-client-linux.tar.gz && \
36+
tar -xzvf /tmp/openshift-client-linux.tar.gz oc && \
37+
rm -f /tmp/openshift-client-linux.tar.gz
38+
39+
########################
40+
# rocm-base #
41+
########################
42+
FROM base AS rocm-base
43+
44+
USER 0
45+
WORKDIR /opt/app-root/bin
46+
47+
# Please keep in sync with ROCm/python3.12 dependent images
48+
ARG ROCM_VERSION=6.4.1
49+
ARG AMDGPU_VERSION=6.4.1
50+
51+
# Install the ROCm rpms
52+
# ref: https://github.com/ROCm/ROCm-docker/blob/master/dev/Dockerfile-centos-7-complete
53+
# Note: Based on 6.4 above new package mivisionx is a pre-requistes, which bring in more dependent packages
54+
# so we are only installing meta packages of rocm
55+
# ref: https://rocm.docs.amd.com/projects/install-on-linux/en/develop/reference/package-manager-integration.html#packages-in-rocm-programming-models
56+
RUN echo "[ROCm]" > /etc/yum.repos.d/rocm.repo && \
57+
echo "name=ROCm" >> /etc/yum.repos.d/rocm.repo && \
58+
echo "baseurl=https://repo.radeon.com/rocm/el9/${ROCM_VERSION}/main" >> /etc/yum.repos.d/rocm.repo && \
59+
echo "enabled=1" >> /etc/yum.repos.d/rocm.repo && \
60+
echo "gpgcheck=0" >> /etc/yum.repos.d/rocm.repo && \
61+
echo "[amdgpu]" > /etc/yum.repos.d/amdgpu.repo && \
62+
echo "name=amdgpu" >> /etc/yum.repos.d/amdgpu.repo && \
63+
echo "baseurl=https://repo.radeon.com/amdgpu/${AMDGPU_VERSION}/rhel/9.4/main/x86_64" >> /etc/yum.repos.d/amdgpu.repo && \
64+
echo "enabled=1" >> /etc/yum.repos.d/amdgpu.repo && \
65+
echo "gpgcheck=0" >> /etc/yum.repos.d/amdgpu.repo && \
66+
dnf install -y 'https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm' && \
67+
dnf clean all && dnf makecache && \
68+
dnf install -y ocl-icd ocl-icd-devel opencl-icd opencl-icd-loader && \
69+
dnf install -y rocm-developer-tools rocm-ml-sdk rocm-opencl-sdk rocm-openmp-sdk rocm-utils && \
70+
dnf clean all && rm -rf /var/cache/dnf
71+
72+
# Restore notebook user workspace
73+
USER 1001
74+
WORKDIR /opt/app-root/src
75+
76+
########################
77+
# rocm-jupyter-minimal #
78+
########################
79+
FROM rocm-base AS rocm-jupyter-minimal
80+
81+
ARG JUPYTER_REUSABLE_UTILS=jupyter/utils
82+
ARG MINIMAL_SOURCE_CODE=jupyter/minimal/ubi9-python-3.12
83+
84+
WORKDIR /opt/app-root/bin
85+
86+
COPY ${JUPYTER_REUSABLE_UTILS} utils/
87+
88+
USER 0
89+
90+
# Dependencies for PDF export
91+
RUN ./utils/install_pdf_deps.sh
92+
ENV PATH="/usr/local/texlive/bin/x86_64-linux:/usr/local/pandoc/bin:$PATH"
93+
94+
USER 1001
95+
96+
COPY ${MINIMAL_SOURCE_CODE}/start-notebook.sh ./
97+
98+
WORKDIR /opt/app-root/src
99+
100+
ENTRYPOINT ["start-notebook.sh"]
101+
102+
############################
103+
# rocm-jupyter-datascience #
104+
############################
105+
FROM rocm-jupyter-minimal AS rocm-jupyter-datascience
106+
107+
ARG DATASCIENCE_SOURCE_CODE=jupyter/datascience/ubi9-python-3.12
108+
109+
WORKDIR /opt/app-root/bin
110+
111+
# OS Packages needs to be installed as root
112+
USER root
113+
114+
# Install useful OS packages
115+
RUN dnf install -y jq unixODBC postgresql git-lfs libsndfile && dnf clean all && rm -rf /var/cache/yum
116+
117+
# Copy dynamically-linked mongocli built in earlier build stage
118+
COPY --from=mongocli-builder /tmp/mongocli /opt/app-root/bin/
119+
120+
# Install MSSQL Client, We need a special repo for MSSQL as they do their own distribution
121+
COPY ${DATASCIENCE_SOURCE_CODE}/mssql-2022.repo-x86_64 /etc/yum.repos.d/mssql-2022.repo
122+
123+
RUN ACCEPT_EULA=Y dnf install -y mssql-tools18 unixODBC-devel && dnf clean all && rm -rf /var/cache/yum
124+
125+
ENV PATH="$PATH:/opt/mssql-tools18/bin"
126+
127+
# Other apps and tools installed as default user
128+
USER 1001
129+
130+
# Copy Elyra setup to utils so that it's sourced at startup
131+
COPY ${DATASCIENCE_SOURCE_CODE}/setup-elyra.sh ${DATASCIENCE_SOURCE_CODE}/utils ./utils/
132+
133+
WORKDIR /opt/app-root/src
134+
135+
136+
###########################
137+
# rocm-jupyter-tensorflow #
138+
###########################
139+
FROM rocm-jupyter-datascience AS rocm-jupyter-tensorflow
140+
141+
ARG DATASCIENCE_SOURCE_CODE=jupyter/datascience/ubi9-python-3.12
142+
ARG TENSORFLOW_SOURCE_CODE=jupyter/rocm/tensorflow/ubi9-python-3.12
143+
144+
WORKDIR /opt/app-root/bin
145+
146+
LABEL name="odh-notebook-jupyter-rocm-tensorflow-ubi9-python-3.12" \
147+
summary="Jupyter AMD tensorflow notebook image for ODH notebooks" \
148+
description="Jupyter AMD tensorflow notebook image with base Python 3.12 builder image based on UBI9 for ODH notebooks" \
149+
io.k8s.display-name="Jupyter AMD tensorflow notebook image for ODH notebooks" \
150+
io.k8s.description="Jupyter AMD tensorflow notebook image with base Python 3.12 builder image based on UBI9 for ODH notebooks" \
151+
authoritative-source-url="https://github.com/opendatahub-io/notebooks" \
152+
io.openshift.build.commit.ref="main" \
153+
io.openshift.build.source-location="https://github.com/opendatahub-io/notebooks/tree/main/jupyter/rocm/tensorflow/ubi9-python-3.12" \
154+
io.openshift.build.image="quay.io/opendatahub/workbench-images:rocm-jupyter-tensorflow-ubi9-python-3.12"
155+
156+
COPY ${TENSORFLOW_SOURCE_CODE}/Pipfile.lock ./
157+
158+
RUN echo "Installing softwares and packages" && \
159+
micropipenv install --dev && \
160+
rm -f ./Pipfile.lock && \
161+
# setup path for runtime configuration
162+
mkdir /opt/app-root/runtimes && \
163+
# Remove default Elyra runtime-images \
164+
rm /opt/app-root/share/jupyter/metadata/runtime-images/*.json && \
165+
# Replace Notebook's launcher, "(ipykernel)" with Python's version 3.x.y \
166+
sed -i -e "s/Python.*/$(python --version | cut -d '.' -f-2)\",/" /opt/app-root/share/jupyter/kernels/python3/kernel.json && \
167+
# copy jupyter configuration
168+
cp /opt/app-root/bin/utils/jupyter_server_config.py /opt/app-root/etc/jupyter && \
169+
# Disable announcement plugin of jupyterlab \
170+
jupyter labextension disable "@jupyterlab/apputils-extension:announcements" && \
171+
# Apply JupyterLab addons \
172+
/opt/app-root/bin/utils/addons/apply.sh && \
173+
# Fix permissions to support pip in Openshift environments \
174+
chmod -R g+w /opt/app-root/lib/python3.12/site-packages && \
175+
fix-permissions /opt/app-root -P
176+
177+
WORKDIR /opt/app-root/src
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
[[source]]
2+
url = "https://pypi.org/simple"
3+
verify_ssl = true
4+
name = "pypi"
5+
6+
[dev-packages]
7+
# tf2onnx has pinned protobuf version, that causes conflict with other packages
8+
# This is a workaround to avoid the conflict
9+
tf2onnx = "~= 1.16.1"
10+
11+
[packages]
12+
# ROCm TensorFlow packages
13+
tensorflow_rocm = "~=2.18.1"
14+
tensorboard = "~=2.18.0"
15+
16+
# Datascience and useful extensions
17+
boto3 = "~=1.37.8"
18+
kafka-python-ng = "~=2.2.3"
19+
kfp = "~=2.12.1"
20+
matplotlib = "~=3.10.1"
21+
numpy = "~=1.26.4"
22+
pandas = "~=2.2.3"
23+
plotly = "~=6.0.0"
24+
scikit-learn = "~=1.6.1"
25+
scipy = "~=1.15.2"
26+
skl2onnx = "~=1.17.0"
27+
onnxconverter-common = "~=1.13.0" # Required for skl2onnx, as upgraded version is not compatible with protobuf
28+
codeflare-sdk = "~=0.29.0"
29+
kubeflow-training = "==1.9.0"
30+
31+
# DB connectors
32+
pymongo = "~=4.11.2"
33+
psycopg = "~=3.2.5"
34+
pyodbc = "~=5.2.0"
35+
mysql-connector-python = "~=9.3.0"
36+
37+
# JupyterLab packages
38+
39+
odh-elyra = "==4.2.1"
40+
41+
jupyterlab = "==4.2.7"
42+
jupyter-bokeh = "~=4.0.5"
43+
jupyter-server = "~=2.15.0"
44+
jupyter-server-proxy = "~=4.4.0"
45+
jupyter-server-terminals = "~=0.5.3"
46+
jupyterlab-git = "~=0.50.1"
47+
jupyterlab-lsp = "~=5.1.0"
48+
jupyterlab-widgets = "~=3.0.13"
49+
jupyter-resource-usage = "~=1.1.0"
50+
nbdime = "~=4.0.2"
51+
nbgitpuller = "~=1.2.2"
52+
53+
# Base packages
54+
wheel = "~=0.45.1"
55+
setuptools = "~=78.1.1"
56+
57+
[requires]
58+
python_version = "3.12"

0 commit comments

Comments
 (0)