-
Notifications
You must be signed in to change notification settings - Fork 110
RHOAIENG-27434: create ROCm Tensorflow Python 3.12 Image #1259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 12 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
704f1d1
RHOAIENG-27434: create ROCm Tensorflow Python 3.12 Image (#1259)
dibryant bea47d9
NO-JIRA: bring in changes and updates that happened on main while the…
jiridanek 481b11e
NO-JIRA: add ROCm TensorFlow wheel file to Pipfile directly
jiridanek ef5814d
Update Pipfile.lock for Python 3.12
github-actions[bot] 159766e
NO-JIRA: normalize `tf2onnx` version formatting across Pipfiles
jiridanek d1fd612
NO-JIRA: remove `--build-constraints` from pip install due to unnamed…
jiridanek bbdad6e
NO-JIRA: remove missing OpenCL ICD packages from ROCm TensorFlow Dock…
jiridanek 2467404
NO-JIRA: add hash verification for TensorFlow ROCm wheel in Pipfiles
jiridanek 3faaf84
Update Pipfile.lock for Python 3.11
github-actions[bot] 89e3244
Update Pipfile.lock for Python 3.12
github-actions[bot] 70309d2
NO-JIRA: update ROCm and AMDGPU versions to 6.4.3 in TensorFlow Docke…
jiridanek c83cdda
NO-JIRA: remove ROCm OpenCL SDK and configure ROCm shared libraries a…
jiridanek 26b399f
NO-JIRA: placate hadolint with an empty line
jiridanek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
194 changes: 194 additions & 0 deletions
194
jupyter/rocm/tensorflow/ubi9-python-3.12/Dockerfile.rocm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,194 @@ | ||
###################################################### | ||
# mongocli-builder (build stage only, not published) # | ||
###################################################### | ||
FROM registry.access.redhat.com/ubi9/go-toolset:latest AS mongocli-builder | ||
|
||
ARG MONGOCLI_VERSION=2.0.4 | ||
|
||
WORKDIR /tmp/ | ||
RUN curl -Lo mongodb-cli-mongocli-v${MONGOCLI_VERSION}.zip https://github.com/mongodb/mongodb-cli/archive/refs/tags/mongocli/v${MONGOCLI_VERSION}.zip | ||
RUN unzip ./mongodb-cli-mongocli-v${MONGOCLI_VERSION}.zip | ||
RUN cd ./mongodb-cli-mongocli-v${MONGOCLI_VERSION}/ && \ | ||
CGO_ENABLED=1 GOOS=linux go build -a -tags strictfipsruntime -o /tmp/mongocli ./cmd/mongocli/ | ||
|
||
#################### | ||
# base # | ||
#################### | ||
FROM registry.access.redhat.com/ubi9/python-312:latest AS base | ||
|
||
WORKDIR /opt/app-root/bin | ||
|
||
# OS Packages needs to be installed as root | ||
USER 0 | ||
|
||
# upgrade first to avoid fixable vulnerabilities begin | ||
RUN dnf -y upgrade --refresh --best --nodocs --noplugins --setopt=install_weak_deps=0 --setopt=keepcache=0 \ | ||
&& dnf clean all -y | ||
# upgrade first to avoid fixable vulnerabilities end | ||
|
||
# Install useful OS packages | ||
RUN dnf install -y mesa-libGL skopeo && dnf clean all && rm -rf /var/cache/yum | ||
|
||
# Other apps and tools installed as default user | ||
USER 1001 | ||
|
||
# Install micropipenv and uv to deploy packages from requirements.txt begin | ||
RUN pip install --no-cache-dir -U "micropipenv[toml]==1.9.0" "uv==0.8.12" | ||
# Install micropipenv and uv to deploy packages from requirements.txt end | ||
|
||
# Install the oc client begin | ||
RUN curl -L https://mirror.openshift.com/pub/openshift-v4/$(uname -m)/clients/ocp/stable/openshift-client-linux.tar.gz \ | ||
-o /tmp/openshift-client-linux.tar.gz && \ | ||
tar -xzvf /tmp/openshift-client-linux.tar.gz oc && \ | ||
rm -f /tmp/openshift-client-linux.tar.gz | ||
# Install the oc client end | ||
|
||
############# | ||
# rocm-base # | ||
############# | ||
FROM base AS rocm-base | ||
|
||
USER 0 | ||
WORKDIR /opt/app-root/bin | ||
|
||
# Please keep in sync with ROCm/python3.12 dependent images | ||
ARG ROCM_VERSION=6.4.3 | ||
ARG AMDGPU_VERSION=6.4.3 | ||
|
||
# Install the ROCm rpms | ||
# ref: https://github.com/ROCm/ROCm-docker/blob/master/dev/Dockerfile-centos-7-complete | ||
# docs: https://rocm.docs.amd.com/projects/install-on-linux/en/latest/install/install-methods/package-manager/package-manager-rhel.html#registering-rocm-repositories | ||
# Note: Based on 6.4 above new package mivisionx is a pre-requistes, which bring in more dependent packages | ||
# so we are only installing meta packages of rocm | ||
# ref: https://rocm.docs.amd.com/projects/install-on-linux/en/develop/reference/package-manager-integration.html#packages-in-rocm-programming-models | ||
RUN echo "[ROCm]" > /etc/yum.repos.d/rocm.repo && \ | ||
echo "name=ROCm" >> /etc/yum.repos.d/rocm.repo && \ | ||
echo "baseurl=https://repo.radeon.com/rocm/el9/${ROCM_VERSION}/main" >> /etc/yum.repos.d/rocm.repo && \ | ||
echo "enabled=1" >> /etc/yum.repos.d/rocm.repo && \ | ||
echo "gpgcheck=0" >> /etc/yum.repos.d/rocm.repo && \ | ||
echo "[amdgpu]" > /etc/yum.repos.d/amdgpu.repo && \ | ||
echo "name=amdgpu" >> /etc/yum.repos.d/amdgpu.repo && \ | ||
echo "baseurl=https://repo.radeon.com/amdgpu/${AMDGPU_VERSION}/rhel/9.4/main/x86_64" >> /etc/yum.repos.d/amdgpu.repo && \ | ||
echo "enabled=1" >> /etc/yum.repos.d/amdgpu.repo && \ | ||
echo "gpgcheck=0" >> /etc/yum.repos.d/amdgpu.repo && \ | ||
dnf install -y 'https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm' && \ | ||
dnf clean all && dnf makecache && \ | ||
dnf install -y rocm-developer-tools rocm-ml-sdk rocm-openmp-sdk rocm-utils && \ | ||
dnf clean all && rm -rf /var/cache/dnf | ||
|
||
# https://rocm.docs.amd.com/projects/install-on-linux/en/latest/install/post-install.html#configure-rocm-shared-objects | ||
RUN tee --append /etc/ld.so.conf.d/rocm.conf <<EOF | ||
/opt/rocm/lib | ||
/opt/rocm/lib64 | ||
EOF | ||
RUN ldconfig | ||
|
||
# Restore notebook user workspace | ||
USER 1001 | ||
WORKDIR /opt/app-root/src | ||
|
||
######################## | ||
# rocm-jupyter-minimal # | ||
######################## | ||
FROM rocm-base AS rocm-jupyter-minimal | ||
|
||
ARG JUPYTER_REUSABLE_UTILS=jupyter/utils | ||
ARG MINIMAL_SOURCE_CODE=jupyter/minimal/ubi9-python-3.12 | ||
|
||
WORKDIR /opt/app-root/bin | ||
|
||
COPY ${JUPYTER_REUSABLE_UTILS} utils/ | ||
|
||
USER 0 | ||
|
||
# Dependencies for PDF export begin | ||
RUN ./utils/install_pdf_deps.sh | ||
ENV PATH="/usr/local/texlive/bin/linux:/usr/local/pandoc/bin:$PATH" | ||
# Dependencies for PDF export end | ||
|
||
USER 1001 | ||
|
||
COPY ${MINIMAL_SOURCE_CODE}/start-notebook.sh ./ | ||
|
||
WORKDIR /opt/app-root/src | ||
|
||
ENTRYPOINT ["start-notebook.sh"] | ||
|
||
############################ | ||
# rocm-jupyter-datascience # | ||
############################ | ||
FROM rocm-jupyter-minimal AS rocm-jupyter-datascience | ||
|
||
ARG DATASCIENCE_SOURCE_CODE=jupyter/datascience/ubi9-python-3.12 | ||
|
||
WORKDIR /opt/app-root/bin | ||
|
||
# OS Packages needs to be installed as root | ||
USER root | ||
|
||
# Install useful OS packages | ||
RUN dnf install -y jq unixODBC postgresql git-lfs libsndfile && dnf clean all && rm -rf /var/cache/yum | ||
|
||
jiridanek marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# Copy dynamically-linked mongocli built in earlier build stage | ||
COPY --from=mongocli-builder /tmp/mongocli /opt/app-root/bin/ | ||
|
||
# Install MSSQL Client, We need a special repo for MSSQL as they do their own distribution | ||
COPY ${DATASCIENCE_SOURCE_CODE}/mssql-2022.repo /etc/yum.repos.d/mssql-2022.repo | ||
|
||
RUN ACCEPT_EULA=Y dnf install -y mssql-tools18 unixODBC-devel && dnf clean all && rm -rf /var/cache/yum | ||
|
||
ENV PATH="$PATH:/opt/mssql-tools18/bin" | ||
|
||
# Other apps and tools installed as default user | ||
USER 1001 | ||
|
||
# Copy Elyra setup to utils so that it's sourced at startup | ||
COPY ${DATASCIENCE_SOURCE_CODE}/setup-elyra.sh ${DATASCIENCE_SOURCE_CODE}/utils ./utils/ | ||
|
||
WORKDIR /opt/app-root/src | ||
|
||
|
||
########################### | ||
# rocm-jupyter-tensorflow # | ||
########################### | ||
FROM rocm-jupyter-datascience AS rocm-jupyter-tensorflow | ||
|
||
ARG DATASCIENCE_SOURCE_CODE=jupyter/datascience/ubi9-python-3.12 | ||
ARG TENSORFLOW_SOURCE_CODE=jupyter/rocm/tensorflow/ubi9-python-3.12 | ||
|
||
WORKDIR /opt/app-root/bin | ||
|
||
LABEL name="odh-notebook-jupyter-rocm-tensorflow-ubi9-python-3.12" \ | ||
summary="Jupyter AMD tensorflow notebook image for ODH notebooks" \ | ||
description="Jupyter AMD tensorflow notebook image with base Python 3.12 builder image based on UBI9 for ODH notebooks" \ | ||
io.k8s.display-name="Jupyter AMD tensorflow notebook image for ODH notebooks" \ | ||
io.k8s.description="Jupyter AMD tensorflow notebook image with base Python 3.12 builder image based on UBI9 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/jupyter/rocm/tensorflow/ubi9-python-3.12" \ | ||
io.openshift.build.image="quay.io/opendatahub/workbench-images:rocm-jupyter-tensorflow-ubi9-python-3.12" | ||
|
||
COPY ${TENSORFLOW_SOURCE_CODE}/requirements.txt ./ | ||
|
||
RUN echo "Installing softwares and packages" && \ | ||
# This may have to download and compile some dependencies, and as we don't lock requirements from `build-system.requires`, | ||
# we often don't know the correct hashes and `--require-hashes` would therefore fail on non amd64, where building is common. | ||
# Not using --build-constraints=./requirements.txt because error: Unnamed requirements are not allowed as constraints (found: `https://repo.radeon.com/rocm/manylinux/rocm-rel-6.4/ | ||
uv pip install --strict --no-deps --no-cache --no-config --no-progress --verify-hashes --compile-bytecode --index-strategy=unsafe-best-match --requirements=./requirements.txt && \ | ||
# setup path for runtime configuration | ||
mkdir /opt/app-root/runtimes && \ | ||
# Remove default Elyra runtime-images \ | ||
rm /opt/app-root/share/jupyter/metadata/runtime-images/*.json && \ | ||
# Replace Notebook's launcher, "(ipykernel)" with Python's version 3.x.y \ | ||
sed -i -e "s/Python.*/$(python --version | cut -d '.' -f-2)\",/" /opt/app-root/share/jupyter/kernels/python3/kernel.json && \ | ||
# copy jupyter configuration | ||
cp /opt/app-root/bin/utils/jupyter_server_config.py /opt/app-root/etc/jupyter && \ | ||
# Disable announcement plugin of jupyterlab \ | ||
jupyter labextension disable "@jupyterlab/apputils-extension:announcements" && \ | ||
# Apply JupyterLab addons \ | ||
/opt/app-root/bin/utils/addons/apply.sh && \ | ||
# Fix permissions to support pip in Openshift environments \ | ||
chmod -R g+w /opt/app-root/lib/python3.12/site-packages && \ | ||
fix-permissions /opt/app-root -P | ||
|
||
WORKDIR /opt/app-root/src |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
[[source]] | ||
url = "https://pypi.org/simple" | ||
verify_ssl = true | ||
name = "pypi" | ||
|
||
[dev-packages] | ||
# tf2onnx has pinned protobuf version, that causes conflict with other packages | ||
# This is a workaround to avoid the conflict | ||
tf2onnx = "~=1.16.1" | ||
|
||
[packages] | ||
# ROCm TensorFlow packages | ||
# https://rocm.docs.amd.com/projects/install-on-linux/en/latest/install/3rd-party/tensorflow-install.html#using-a-wheels-package | ||
tensorflow-rocm = {version = "==2.18.1", file = "https://repo.radeon.com/rocm/manylinux/rocm-rel-6.4/tensorflow_rocm-2.18.1-cp312-cp312-manylinux_2_28_x86_64.whl", hashes = ["sha256:814a5e4842b0c92d63c7a0bb4df0baf51ff2db8615535d83fe8958204b840598"]} | ||
tensorboard = "~=2.18.0" | ||
|
||
# Datascience and useful extensions | ||
boto3 = "~=1.37.8" | ||
kafka-python-ng = "~=2.2.3" | ||
kfp = "~=2.12.1" | ||
matplotlib = "~=3.10.1" | ||
numpy = "~=1.26.4" | ||
pandas = "~=2.2.3" | ||
plotly = "~=6.0.0" | ||
scikit-learn = "~=1.6.1" | ||
scipy = "~=1.15.2" | ||
skl2onnx = "~=1.17.0" | ||
onnxconverter-common = "~=1.13.0" # Required for skl2onnx, as upgraded version is not compatible with protobuf | ||
codeflare-sdk = "~=0.29.0" | ||
kubeflow-training = "==1.9.0" | ||
|
||
# DB connectors | ||
pymongo = "~=4.11.2" | ||
psycopg = "~=3.2.5" | ||
pyodbc = "~=5.2.0" | ||
mysql-connector-python = "~=9.3.0" | ||
jiridanek marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# JupyterLab packages | ||
|
||
odh-elyra = "==4.2.1" | ||
|
||
jupyterlab = "==4.2.7" | ||
jupyter-bokeh = "~=4.0.5" | ||
jupyter-server = "~=2.15.0" | ||
jupyter-server-proxy = "~=4.4.0" | ||
jupyter-server-terminals = "~=0.5.3" | ||
jupyterlab-git = "~=0.50.1" | ||
jupyterlab-lsp = "~=5.1.0" | ||
jupyterlab-widgets = "~=3.0.13" | ||
jupyter-resource-usage = "~=1.1.0" | ||
nbdime = "~=4.0.2" | ||
nbgitpuller = "~=1.2.2" | ||
|
||
# Base packages | ||
wheel = "~=0.45.1" | ||
setuptools = "~=78.1.1" | ||
|
||
[requires] | ||
python_version = "3.12" |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.