Skip to content

Commit 35d231a

Browse files
authored
Issue #1598: RHAIENG-337: add support for pytorch+llmcompressor variants to Makefile for jupyter and runtime CUDA images (#1600)
* Add TARGETARCH to CUDA Dockerfiles for pytorch+llmcompressor builds * Add mongocli build stage and fix PDF export, all by copy-pasting improvements that happened on main - Add a new `mongocli-builder` stage for building and including a dynamically linked `mongocli`. - Include utility for PDF export with relevant dependencies (`install_pdf_deps.sh`). - MongoDB and MSSQL repo handling. - Copy in new Jupyter server configuration file. * Update CUDA version to 12.4.1 in pytorch+llmcompressor Dockerfile * Update CUDA version to 12.4.1 in pytorch+llmcompressor Dockerfile
1 parent 2e6921e commit 35d231a

File tree

3 files changed

+52
-22
lines changed

3 files changed

+52
-22
lines changed

Makefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,10 @@ cuda-jupyter-tensorflow-ubi9-python-$(RELEASE_PYTHON_VERSION):
134134
cuda-jupyter-pytorch-ubi9-python-$(RELEASE_PYTHON_VERSION):
135135
$(call image,$@,jupyter/pytorch/ubi9-python-$(RELEASE_PYTHON_VERSION)/Dockerfile.cuda)
136136

137+
.PHONY: cuda-jupyter-pytorch-llmcompressor-ubi9-python-$(RELEASE_PYTHON_VERSION)
138+
cuda-jupyter-pytorch-llmcompressor-ubi9-python-$(RELEASE_PYTHON_VERSION):
139+
$(call image,$@,jupyter/pytorch+llmcompressor/ubi9-python-$(RELEASE_PYTHON_VERSION)/Dockerfile.cuda)
140+
137141
.PHONY: jupyter-trustyai-ubi9-python-$(RELEASE_PYTHON_VERSION)
138142
jupyter-trustyai-ubi9-python-$(RELEASE_PYTHON_VERSION):
139143
$(call image,$@,jupyter/trustyai/ubi9-python-$(RELEASE_PYTHON_VERSION)/Dockerfile.cpu)
@@ -150,6 +154,10 @@ runtime-datascience-ubi9-python-$(RELEASE_PYTHON_VERSION):
150154
runtime-cuda-pytorch-ubi9-python-$(RELEASE_PYTHON_VERSION):
151155
$(call image,$@,runtimes/pytorch/ubi9-python-$(RELEASE_PYTHON_VERSION)/Dockerfile.cuda)
152156

157+
.PHONY: runtime-cuda-pytorch-llmcompressor-ubi9-python-$(RELEASE_PYTHON_VERSION)
158+
runtime-cuda-pytorch-llmcompressor-ubi9-python-$(RELEASE_PYTHON_VERSION):
159+
$(call image,$@,runtimes/pytorch+llmcompressor/ubi9-python-$(RELEASE_PYTHON_VERSION)/Dockerfile.cuda)
160+
153161
.PHONY: runtime-cuda-tensorflow-ubi9-python-$(RELEASE_PYTHON_VERSION)
154162
runtime-cuda-tensorflow-ubi9-python-$(RELEASE_PYTHON_VERSION):
155163
$(call image,$@,runtimes/tensorflow/ubi9-python-$(RELEASE_PYTHON_VERSION)/Dockerfile.cuda)
@@ -399,6 +407,7 @@ ifeq ($(PYTHON_VERSION), 3.11)
399407
jupyter/pytorch/ubi9-python-$(PYTHON_VERSION) \
400408
jupyter/tensorflow/ubi9-python-$(PYTHON_VERSION) \
401409
jupyter/trustyai/ubi9-python-$(PYTHON_VERSION) \
410+
jupyter/pytorch+llmcompressor/ubi9-python-$(PYTHON_VERSION) \
402411
jupyter/rocm/tensorflow/ubi9-python-$(PYTHON_VERSION) \
403412
jupyter/rocm/pytorch/ubi9-python-$(PYTHON_VERSION) \
404413
codeserver/ubi9-python-$(PYTHON_VERSION) \
@@ -484,10 +493,12 @@ all-images: \
484493
cuda-jupyter-minimal-ubi9-python-$(RELEASE_PYTHON_VERSION) \
485494
cuda-jupyter-tensorflow-ubi9-python-$(RELEASE_PYTHON_VERSION) \
486495
cuda-jupyter-pytorch-ubi9-python-$(RELEASE_PYTHON_VERSION) \
496+
cuda-jupyter-pytorch-llmcompressor-ubi9-python-$(RELEASE_PYTHON_VERSION) \
487497
jupyter-trustyai-ubi9-python-$(RELEASE_PYTHON_VERSION) \
488498
runtime-minimal-ubi9-python-$(RELEASE_PYTHON_VERSION) \
489499
runtime-datascience-ubi9-python-$(RELEASE_PYTHON_VERSION) \
490500
runtime-cuda-pytorch-ubi9-python-$(RELEASE_PYTHON_VERSION) \
501+
runtime-cuda-pytorch-llmcompressor-ubi9-python-$(RELEASE_PYTHON_VERSION) \
491502
runtime-cuda-tensorflow-ubi9-python-$(RELEASE_PYTHON_VERSION) \
492503
codeserver-ubi9-python-$(RELEASE_PYTHON_VERSION) \
493504
rstudio-c9s-python-$(RELEASE_PYTHON_VERSION) \

jupyter/pytorch+llmcompressor/ubi9-python-3.11/Dockerfile.cuda

Lines changed: 36 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
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+
114
####################
215
# base #
316
####################
@@ -28,6 +41,8 @@ RUN curl -L https://mirror.openshift.com/pub/openshift-v4/$(uname -m)/clients/oc
2841
####################
2942
FROM base AS cuda-base
3043

44+
ARG TARGETARCH
45+
3146
ARG CUDA_SOURCE_CODE=cuda
3247

3348
# Install CUDA base from:
@@ -39,16 +54,14 @@ ENV NVARCH=x86_64
3954
ENV NVIDIA_REQUIRE_CUDA "cuda>=12.4 brand=tesla,driver>=470,driver<471 brand=unknown,driver>=470,driver<471 brand=nvidia,driver>=470,driver<471 brand=nvidiartx,driver>=470,driver<471 brand=geforce,driver>=470,driver<471 brand=geforcertx,driver>=470,driver<471 brand=quadro,driver>=470,driver<471 brand=quadrortx,driver>=470,driver<471 brand=titan,driver>=470,driver<471 brand=titanrtx,driver>=470,driver<471 brand=tesla,driver>=525,driver<526 brand=unknown,driver>=525,driver<526 brand=nvidia,driver>=525,driver<526 brand=nvidiartx,driver>=525,driver<526 brand=geforce,driver>=525,driver<526 brand=geforcertx,driver>=525,driver<526 brand=quadro,driver>=525,driver<526 brand=quadrortx,driver>=525,driver<526 brand=titan,driver>=525,driver<526 brand=titanrtx,driver>=525,driver<526 brand=tesla,driver>=535,driver<536 brand=unknown,driver>=535,driver<536 brand=nvidia,driver>=535,driver<536 brand=nvidiartx,driver>=535,driver<536 brand=geforce,driver>=535,driver<536 brand=geforcertx,driver>=535,driver<536 brand=quadro,driver>=535,driver<536 brand=quadrortx,driver>=535,driver<536 brand=titan,driver>=535,driver<536 brand=titanrtx,driver>=535,driver<536"
4055
ENV NV_CUDA_CUDART_VERSION 12.4.127-1
4156

42-
COPY ${CUDA_SOURCE_CODE}/cuda.repo-x86_64 /etc/yum.repos.d/cuda.repo
57+
COPY ${CUDA_SOURCE_CODE}/cuda.repo-${TARGETARCH} /etc/yum.repos.d/cuda.repo
4358
COPY ${CUDA_SOURCE_CODE}/NGC-DL-CONTAINER-LICENSE /
4459

4560
RUN NVIDIA_GPGKEY_SUM=d0664fbbdb8c32356d45de36c5984617217b2d0bef41b93ccecd326ba3b80c87 && \
4661
curl -fsSL https://developer.download.nvidia.com/compute/cuda/repos/rhel9/${NVARCH}/D42D0685.pub | sed '/^Version/d' > /etc/pki/rpm-gpg/RPM-GPG-KEY-NVIDIA && \
4762
echo "$NVIDIA_GPGKEY_SUM /etc/pki/rpm-gpg/RPM-GPG-KEY-NVIDIA" | sha256sum -c --strict -
4863

49-
50-
ENV CUDA_VERSION 12.4.
51-
64+
ENV CUDA_VERSION 12.4.1
5265

5366
# For libraries in the cuda-compat-* package: https://docs.nvidia.com/cuda/eula/index.html#attachment-a
5467
RUN yum upgrade -y && yum install -y \
@@ -137,7 +150,7 @@ RUN yum install -y \
137150
# ${NV_CUDNN_PACKAGE_DEV} \
138151
# && yum clean all \
139152
# && rm -rf /var/cache/yum/*
140-
153+
141154
# # Set this flag so that libraries can find the location of CUDA
142155
# ENV XLA_FLAGS=--xla_gpu_cuda_data_dir=/usr/local/cuda
143156

@@ -148,7 +161,7 @@ WORKDIR /opt/app-root/src
148161
#########################
149162
# cuda-jupyter-minimal #
150163
#########################
151-
FROM cuda-base AS cuda-jupyter-minimal
164+
FROM cuda-base AS cuda-jupyter-minimal
152165

153166
ARG JUPYTER_REUSABLE_UTILS=jupyter/utils
154167
ARG MINIMAL_SOURCE_CODE=jupyter/minimal/ubi9-python-3.11
@@ -158,7 +171,15 @@ WORKDIR /opt/app-root/bin
158171
COPY ${JUPYTER_REUSABLE_UTILS} utils/
159172

160173
COPY ${MINIMAL_SOURCE_CODE}/start-notebook.sh ./
161-
174+
175+
USER 0
176+
177+
# Dependencies for PDF export
178+
RUN ./utils/install_pdf_deps.sh
179+
ENV PATH="/usr/local/texlive/bin/linux:/usr/local/pandoc/bin:$PATH"
180+
181+
USER 1001
182+
162183
WORKDIR /opt/app-root/src
163184

164185
ENTRYPOINT ["start-notebook.sh"]
@@ -178,13 +199,11 @@ USER root
178199
# Install useful OS packages
179200
RUN dnf install -y jq unixODBC postgresql git-lfs libsndfile && dnf clean all && rm -rf /var/cache/yum
180201

181-
# Install MongoDB Client, We need a special repo for MongoDB as they do their own distribution
182-
COPY ${DATASCIENCE_SOURCE_CODE}/mongodb-org-6.0.repo-x86_64 /etc/yum.repos.d/mongodb-org-6.0.repo
183-
184-
RUN dnf install -y mongocli && dnf clean all && rm -rf /var/cache/yum
202+
# Copy dynamically-linked mongocli built in earlier build stage
203+
COPY --from=mongocli-builder /tmp/mongocli /opt/app-root/bin/
185204

186205
# Install MSSQL Client, We need a special repo for MSSQL as they do their own distribution
187-
COPY ${DATASCIENCE_SOURCE_CODE}/mssql-2022.repo-x86_64 /etc/yum.repos.d/mssql-2022.repo
206+
COPY ${DATASCIENCE_SOURCE_CODE}/mssql-2022.repo /etc/yum.repos.d/mssql-2022.repo
188207

189208
RUN ACCEPT_EULA=Y dnf install -y mssql-tools18 unixODBC-devel && dnf clean all && rm -rf /var/cache/yum
190209

@@ -206,7 +225,6 @@ FROM cuda-jupyter-datascience AS cuda-jupyter-pytorch
206225
ARG DATASCIENCE_SOURCE_CODE=jupyter/datascience/ubi9-python-3.11
207226
ARG PYTORCH_SOURCE_CODE=jupyter/pytorch+llmcompressor/ubi9-python-3.11
208227

209-
210228
WORKDIR /opt/app-root/bin
211229

212230
LABEL name="odh-notebook-jupyter-cuda-pytorch-ubi9-python-3.11" \
@@ -230,11 +248,13 @@ RUN echo "Installing softwares and packages" && \
230248
# Remove default Elyra runtime-images \
231249
rm /opt/app-root/share/jupyter/metadata/runtime-images/*.json && \
232250
# Replace Notebook's launcher, "(ipykernel)" with Python's version 3.x.y \
233-
sed -i -e "s/Python.*/$(python --version | cut -d '.' -f-2)\",/" /opt/app-root/share/jupyter/kernels/python3/kernel.json && \
251+
sed -i -e "s/Python.*/$(python --version | cut -d '.' -f-2)\",/" /opt/app-root/share/jupyter/kernels/python3/kernel.json && \
252+
# copy jupyter configuration
253+
cp /opt/app-root/bin/utils/jupyter_server_config.py /opt/app-root/etc/jupyter && \
234254
# Disable announcement plugin of jupyterlab \
235-
jupyter labextension disable "@jupyterlab/apputils-extension:announcements" && \
255+
jupyter labextension disable "@jupyterlab/apputils-extension:announcements" && \
236256
# Apply JupyterLab addons \
237-
/opt/app-root/bin/utils/addons/apply.sh && \
257+
/opt/app-root/bin/utils/addons/apply.sh && \
238258
# Fix permissions to support pip in Openshift environments \
239259
chmod -R g+w /opt/app-root/lib/python3.11/site-packages && \
240260
fix-permissions /opt/app-root -P
@@ -244,4 +264,3 @@ COPY ${DATASCIENCE_SOURCE_CODE}/runtime-images/ /opt/app-root/share/jupyter/meta
244264
COPY ${PYTORCH_SOURCE_CODE}/runtime-images/ /opt/app-root/share/jupyter/metadata/runtime-images/
245265

246266
WORKDIR /opt/app-root/src
247-

runtimes/pytorch+llmcompressor/ubi9-python-3.11/Dockerfile.cuda

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ RUN curl -L https://mirror.openshift.com/pub/openshift-v4/$(uname -m)/clients/oc
2828
####################
2929
FROM base AS cuda-base
3030

31+
ARG TARGETARCH
32+
3133
ARG CUDA_SOURCE_CODE=cuda
3234

3335
# Install CUDA base from:
@@ -39,16 +41,14 @@ ENV NVARCH=x86_64
3941
ENV NVIDIA_REQUIRE_CUDA "cuda>=12.4 brand=tesla,driver>=470,driver<471 brand=unknown,driver>=470,driver<471 brand=nvidia,driver>=470,driver<471 brand=nvidiartx,driver>=470,driver<471 brand=geforce,driver>=470,driver<471 brand=geforcertx,driver>=470,driver<471 brand=quadro,driver>=470,driver<471 brand=quadrortx,driver>=470,driver<471 brand=titan,driver>=470,driver<471 brand=titanrtx,driver>=470,driver<471 brand=tesla,driver>=525,driver<526 brand=unknown,driver>=525,driver<526 brand=nvidia,driver>=525,driver<526 brand=nvidiartx,driver>=525,driver<526 brand=geforce,driver>=525,driver<526 brand=geforcertx,driver>=525,driver<526 brand=quadro,driver>=525,driver<526 brand=quadrortx,driver>=525,driver<526 brand=titan,driver>=525,driver<526 brand=titanrtx,driver>=525,driver<526 brand=tesla,driver>=535,driver<536 brand=unknown,driver>=535,driver<536 brand=nvidia,driver>=535,driver<536 brand=nvidiartx,driver>=535,driver<536 brand=geforce,driver>=535,driver<536 brand=geforcertx,driver>=535,driver<536 brand=quadro,driver>=535,driver<536 brand=quadrortx,driver>=535,driver<536 brand=titan,driver>=535,driver<536 brand=titanrtx,driver>=535,driver<536"
4042
ENV NV_CUDA_CUDART_VERSION 12.4.127-1
4143

42-
COPY ${CUDA_SOURCE_CODE}/cuda.repo-x86_64 /etc/yum.repos.d/cuda.repo
44+
COPY ${CUDA_SOURCE_CODE}/cuda.repo-${TARGETARCH} /etc/yum.repos.d/cuda.repo
4345
COPY ${CUDA_SOURCE_CODE}/NGC-DL-CONTAINER-LICENSE /
4446

4547
RUN NVIDIA_GPGKEY_SUM=d0664fbbdb8c32356d45de36c5984617217b2d0bef41b93ccecd326ba3b80c87 && \
4648
curl -fsSL https://developer.download.nvidia.com/compute/cuda/repos/rhel9/${NVARCH}/D42D0685.pub | sed '/^Version/d' > /etc/pki/rpm-gpg/RPM-GPG-KEY-NVIDIA && \
4749
echo "$NVIDIA_GPGKEY_SUM /etc/pki/rpm-gpg/RPM-GPG-KEY-NVIDIA" | sha256sum -c --strict -
4850

49-
50-
ENV CUDA_VERSION 12.4.
51-
51+
ENV CUDA_VERSION 12.4.1
5252

5353
# For libraries in the cuda-compat-* package: https://docs.nvidia.com/cuda/eula/index.html#attachment-a
5454
RUN yum upgrade -y && yum install -y \
@@ -137,7 +137,7 @@ RUN yum install -y \
137137
# ${NV_CUDNN_PACKAGE_DEV} \
138138
# && yum clean all \
139139
# && rm -rf /var/cache/yum/*
140-
140+
141141
# # Set this flag so that libraries can find the location of CUDA
142142
# ENV XLA_FLAGS=--xla_gpu_cuda_data_dir=/usr/local/cuda
143143

0 commit comments

Comments
 (0)