Skip to content

Commit e9c4ba4

Browse files
Merge pull request opendatahub-io#424 from jstourac/fixRstudio
[RHOAIENG-14585] Add rhel9 based CUDA Python 3.11 image dockerfile
2 parents f48ecee + 2b96633 commit e9c4ba4

File tree

5 files changed

+395
-4
lines changed

5 files changed

+395
-4
lines changed

cuda/rhel9-python-3.11/Dockerfile

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
ARG BASE_IMAGE
2+
FROM ${BASE_IMAGE}
3+
4+
# Access the client's secret for the subscription manager from the environment variable
5+
ARG SECRET_DIR=/opt/app-root/src/.sec
6+
ARG SERVERURL_DEFAULT=""
7+
ARG BASEURL_DEFAULT=""
8+
9+
LABEL name="odh-notebook-cuda-rhel9-python-3.11" \
10+
summary="CUDA Python 3.11 base image for ODH notebooks" \
11+
description="CUDA Python 3.11 builder image based on RHEL9 for ODH notebooks" \
12+
io.k8s.display-name="CUDA Python 3.11 base image for ODH notebooks" \
13+
io.k8s.description="CUDA Python 3.11 builder image based on RHEL9 for ODH notebooks" \
14+
authoritative-source-url="https://github.com/opendatahub-io/notebooks" \
15+
io.openshift.build.commit.ref="main" \
16+
io.openshift.build.source-location="https://github.com/opendatahub-io/notebooks/tree/main/cuda/rhel9-python-3.11" \
17+
io.openshift.build.image="quay.io/opendatahub/workbench-images:cuda-rhel9-python-3.11"
18+
19+
# Install CUDA base from:
20+
# https://gitlab.com/nvidia/container-images/cuda/-/tree/master/dist/12.4.1/ubi9/base
21+
USER 0
22+
WORKDIR /opt/app-root/bin
23+
24+
# Run the subscription manager command using the provided credentials. Only include --serverurl and --baseurl if they are provided
25+
RUN SERVERURL=$(cat ${SECRET_DIR}/SERVERURL 2>/dev/null || echo ${SERVERURL_DEFAULT}) && \
26+
BASEURL=$(cat ${SECRET_DIR}/BASEURL 2>/dev/null || echo ${BASEURL_DEFAULT}) && \
27+
USERNAME=$(cat ${SECRET_DIR}/USERNAME) && \
28+
PASSWORD=$(cat ${SECRET_DIR}/PASSWORD) && \
29+
subscription-manager register \
30+
${SERVERURL:+--serverurl=$SERVERURL} \
31+
${BASEURL:+--baseurl=$BASEURL} \
32+
--username=$USERNAME \
33+
--password=$PASSWORD \
34+
--force \
35+
--auto-attach
36+
37+
ENV NVARCH x86_64
38+
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"
39+
ENV NV_CUDA_CUDART_VERSION 12.4.127-1
40+
41+
COPY cuda/rhel9-python-3.11/cuda.repo-x86_64 /etc/yum.repos.d/cuda.repo
42+
43+
RUN NVIDIA_GPGKEY_SUM=d0664fbbdb8c32356d45de36c5984617217b2d0bef41b93ccecd326ba3b80c87 && \
44+
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 && \
45+
echo "$NVIDIA_GPGKEY_SUM /etc/pki/rpm-gpg/RPM-GPG-KEY-NVIDIA" | sha256sum -c --strict -
46+
47+
ENV CUDA_VERSION 12.4.1
48+
49+
# For libraries in the cuda-compat-* package: https://docs.nvidia.com/cuda/eula/index.html#attachment-a
50+
RUN yum upgrade -y && yum install -y \
51+
cuda-cudart-12-4-${NV_CUDA_CUDART_VERSION} \
52+
cuda-compat-12-4 \
53+
&& yum clean all \
54+
&& rm -rf /var/cache/yum/*
55+
56+
# nvidia-docker 1.0
57+
RUN echo "/usr/local/nvidia/lib" >> /etc/ld.so.conf.d/nvidia.conf && \
58+
echo "/usr/local/nvidia/lib64" >> /etc/ld.so.conf.d/nvidia.conf
59+
60+
ENV PATH /usr/local/nvidia/bin:/usr/local/cuda/bin:${PATH}
61+
ENV LD_LIBRARY_PATH /usr/local/nvidia/lib:/usr/local/nvidia/lib64
62+
63+
COPY cuda/rhel9-python-3.11/NGC-DL-CONTAINER-LICENSE /
64+
65+
# nvidia-container-runtime
66+
ENV NVIDIA_VISIBLE_DEVICES all
67+
ENV NVIDIA_DRIVER_CAPABILITIES compute,utility
68+
69+
# Install CUDA runtime from:
70+
# https://gitlab.com/nvidia/container-images/cuda/-/blob/master/dist/12.4.1/ubi9/runtime/Dockerfile
71+
ENV NV_CUDA_LIB_VERSION 12.4.1-1
72+
ENV NV_NVTX_VERSION 12.4.127-1
73+
ENV NV_LIBNPP_VERSION 12.2.5.30-1
74+
ENV NV_LIBNPP_PACKAGE libnpp-12-4-${NV_LIBNPP_VERSION}
75+
ENV NV_LIBCUBLAS_VERSION 12.4.5.8-1
76+
ENV NV_LIBNCCL_PACKAGE_NAME libnccl
77+
ENV NV_LIBNCCL_PACKAGE_VERSION 2.21.5-1
78+
ENV NV_LIBNCCL_VERSION 2.21.5
79+
ENV NCCL_VERSION 2.21.5
80+
ENV NV_LIBNCCL_PACKAGE ${NV_LIBNCCL_PACKAGE_NAME}-${NV_LIBNCCL_PACKAGE_VERSION}+cuda12.4
81+
82+
RUN yum install -y \
83+
cuda-libraries-12-4-${NV_CUDA_LIB_VERSION} \
84+
cuda-nvtx-12-4-${NV_NVTX_VERSION} \
85+
${NV_LIBNPP_PACKAGE} \
86+
libcublas-12-4-${NV_LIBCUBLAS_VERSION} \
87+
${NV_LIBNCCL_PACKAGE} \
88+
&& yum clean all \
89+
&& rm -rf /var/cache/yum/*
90+
91+
# Set this flag so that libraries can find the location of CUDA
92+
ENV XLA_FLAGS=--xla_gpu_cuda_data_dir=/usr/local/cuda
93+
94+
# Install CUDA devel from:
95+
# https://gitlab.com/nvidia/container-images/cuda/-/blob/master/dist/12.4.1/ubi9/devel/Dockerfile
96+
ENV NV_CUDA_LIB_VERSION 12.4.1-1
97+
ENV NV_NVPROF_VERSION 12.4.127-1
98+
ENV NV_NVPROF_DEV_PACKAGE cuda-nvprof-12-4-${NV_NVPROF_VERSION}
99+
ENV NV_CUDA_CUDART_DEV_VERSION 12.4.127-1
100+
ENV NV_NVML_DEV_VERSION 12.4.127-1
101+
ENV NV_LIBCUBLAS_DEV_VERSION 12.4.5.8-1
102+
ENV NV_LIBNPP_DEV_VERSION 12.2.5.30-1
103+
ENV NV_LIBNPP_DEV_PACKAGE libnpp-devel-12-4-${NV_LIBNPP_DEV_VERSION}
104+
ENV NV_LIBNCCL_DEV_PACKAGE_NAME libnccl-devel
105+
ENV NV_LIBNCCL_DEV_PACKAGE_VERSION 2.21.5-1
106+
ENV NCCL_VERSION 2.21.5
107+
ENV NV_LIBNCCL_DEV_PACKAGE ${NV_LIBNCCL_DEV_PACKAGE_NAME}-${NV_LIBNCCL_DEV_PACKAGE_VERSION}+cuda12.4
108+
ENV NV_CUDA_NSIGHT_COMPUTE_VERSION 12.4.1-1
109+
ENV NV_CUDA_NSIGHT_COMPUTE_DEV_PACKAGE cuda-nsight-compute-12-4-${NV_CUDA_NSIGHT_COMPUTE_VERSION}
110+
111+
RUN yum install -y \
112+
make \
113+
findutils \
114+
cuda-command-line-tools-12-4-${NV_CUDA_LIB_VERSION} \
115+
cuda-libraries-devel-12-4-${NV_CUDA_LIB_VERSION} \
116+
cuda-minimal-build-12-4-${NV_CUDA_LIB_VERSION} \
117+
cuda-cudart-devel-12-4-${NV_CUDA_CUDART_DEV_VERSION} \
118+
${NV_NVPROF_DEV_PACKAGE} \
119+
cuda-nvml-devel-12-4-${NV_NVML_DEV_VERSION} \
120+
libcublas-devel-12-4-${NV_LIBCUBLAS_DEV_VERSION} \
121+
${NV_LIBNPP_DEV_PACKAGE} \
122+
${NV_LIBNCCL_DEV_PACKAGE} \
123+
${NV_CUDA_NSIGHT_COMPUTE_DEV_PACKAGE} \
124+
&& yum clean all \
125+
&& rm -rf /var/cache/yum/*
126+
127+
ENV LIBRARY_PATH /usr/local/cuda/lib64/stubs
128+
129+
# Install CUDA devel cudnn8 from:
130+
# hhttps://gitlab.com/nvidia/container-images/cuda/-/blob/master/dist/12.4.1/ubi9/devel/cudnn/Dockerfile
131+
ENV NV_CUDNN_VERSION 9.1.0.70-1
132+
ENV NV_CUDNN_PACKAGE libcudnn9-cuda-12-${NV_CUDNN_VERSION}
133+
ENV NV_CUDNN_PACKAGE_DEV libcudnn9-devel-cuda-12-${NV_CUDNN_VERSION}
134+
135+
LABEL com.nvidia.cudnn.version="${NV_CUDNN_VERSION}"
136+
137+
RUN yum install -y \
138+
${NV_CUDNN_PACKAGE} \
139+
${NV_CUDNN_PACKAGE_DEV} \
140+
&& yum clean all \
141+
&& rm -rf /var/cache/yum/*
142+
143+
# Install CUDA toolkit 12.4
144+
RUN yum -y install cuda-toolkit-12-4 && \
145+
yum -y clean all --enablerepo="*"
146+
147+
# Set this flag so that libraries can find the location of CUDA
148+
ENV XLA_FLAGS=--xla_gpu_cuda_data_dir=/usr/local/cuda
149+
150+
# Unregister the system
151+
RUN subscription-manager remove --all && subscription-manager unregister && subscription-manager clean
152+
153+
# Restore notebook user workspace
154+
USER 1001
155+
WORKDIR /opt/app-root/src

0 commit comments

Comments
 (0)