Skip to content

Commit d9d5617

Browse files
committed
Accelerated Python/Docker: Migrate to a PyTorch base image, install cuDF and cuML from pip, and move to CUDA 12.8 so we can hopefully have everything in a single Python environment and avoid using special kernels.
1 parent 60dce59 commit d9d5617

File tree

2 files changed

+41
-39
lines changed

2 files changed

+41
-39
lines changed
Lines changed: 38 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,55 @@
1-
FROM rapidsai/devcontainers:25.10-cpp-cuda12.9
1+
FROM pytorch/pytorch:2.9.0-cuda12.8-cudnn9-runtime
22

33
ARG GIT_BRANCH_NAME
44

55
ENV GIT_BRANCH_NAME=${GIT_BRANCH_NAME} \
66
PIP_ROOT_USER_ACTION=ignore \
7-
ACH_TUTORIAL=accelerated-python \
8-
ACH_CUDF_VENV=/opt/venvs/cudf
7+
ACH_TUTORIAL=accelerated-python
8+
9+
# Install system packages (needed before pip install for git-based packages)
10+
RUN apt-get update -y \
11+
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
12+
git \
13+
git-lfs \
14+
&& apt-get clean -y \
15+
&& rm -rf /var/lib/apt/lists/*
916

1017
# Copy only requirements.txt first for better Docker layer caching.
1118
COPY tutorials/${ACH_TUTORIAL}/brev/requirements.txt /opt/requirements.txt
1219

13-
RUN set -ex \
14-
&& `# Install Python packages` \
15-
&& pip install --no-cache-dir --root-user-action=ignore -r /opt/requirements.txt \
16-
&& rm -f /opt/requirements.txt \
17-
&& `# Install system packages` \
18-
&& apt-get update -y \
19-
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
20-
git-lfs \
21-
openmpi-bin \
22-
libopenmpi-dev \
23-
&& apt-get clean -y \
24-
&& rm -rf /var/lib/apt/lists/* \
25-
&& `# Setup Bash` \
26-
&& mkdir -p ~/.local/state/._bash_history \
27-
&& `# Setup JupyterLab` \
28-
&& mkdir -p ~/.jupyter \
29-
&& ln -fs /accelerated-computing-hub/brev/jupyter-server-config.py ~/.jupyter/jupyter_server_config.py \
30-
&& mkdir -p ~/.ipython/profile_default/startup \
31-
&& ln -fs /accelerated-computing-hub/brev/ipython-startup-add-cwd-to-path.py ~/.ipython/profile_default/startup/00-add-cwd-to-path.py \
32-
&& python -m jupyter labextension disable "@jupyterlab/apputils-extension:announcements" \
33-
&& `# Create an isolated Python venv with cuDF and register it as a Jupyter kernel` \
34-
&& python -m venv ${ACH_CUDF_VENV} \
35-
&& ${ACH_CUDF_VENV}/bin/python -m pip install --upgrade pip \
36-
&& ${ACH_CUDF_VENV}/bin/pip install \
37-
--extra-index-url=https://pypi.nvidia.com \
38-
"cudf-cu12==25.8.*" \
39-
ipykernel \
40-
&& ${ACH_CUDF_VENV}/bin/python -m ipykernel install \
41-
--name=python3-cudf25.8-cu12 \
42-
--display-name="Python 3 (cuDF 25.8)" \
43-
--prefix=/usr/local
20+
# Install Python packages.
21+
RUN pip install --no-cache-dir --root-user-action=ignore -r /opt/requirements.txt \
22+
&& rm -f /opt/requirements.txt
23+
24+
# Install MPI.
25+
RUN apt-get update -y \
26+
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
27+
openmpi-bin \
28+
libopenmpi-dev \
29+
&& apt-get clean -y \
30+
&& rm -rf /var/lib/apt/lists/*
31+
32+
# Install RAPIDS packages from NVIDIA PyPI.
33+
RUN pip install --no-cache-dir --root-user-action=ignore \
34+
--extra-index-url=https://pypi.nvidia.com \
35+
"cudf-cu12==25.10.*" \
36+
"cuml-cu12==25.10.*"
37+
38+
# Setup Bash & JupyterLab.
39+
RUN mkdir -p ~/.local/state/._bash_history \
40+
&& mkdir -p ~/.jupyter \
41+
&& ln -fs /accelerated-computing-hub/brev/jupyter-server-config.py ~/.jupyter/jupyter_server_config.py \
42+
&& mkdir -p ~/.ipython/profile_default/startup \
43+
&& ln -fs /accelerated-computing-hub/brev/ipython-startup-add-cwd-to-path.py ~/.ipython/profile_default/startup/00-add-cwd-to-path.py \
44+
&& python -m jupyter labextension disable "@jupyterlab/apputils-extension:announcements"
4445

4546
COPY . /accelerated-computing-hub
4647
COPY brev/update-git-branch.bash /opt/update-git-branch.bash
4748

4849
WORKDIR /accelerated-computing-hub/tutorials/${ACH_TUTORIAL}/notebooks
4950

50-
RUN `# Setup Git` \
51-
&& git config --unset-all "http.https://github.com/.extraheader" || { code=$?; [ "$code" = 5 ] || exit "$code"; } \
52-
&& git config --global --add safe.directory "/accelerated-computing-hub"
51+
# Setup Git.
52+
RUN git config --unset-all "http.https://github.com/.extraheader" || { code=$?; [ "$code" = 5 ] || exit "$code"; } \
53+
&& git config --global --add safe.directory "/accelerated-computing-hub"
5354

5455
ENTRYPOINT ["/accelerated-computing-hub/brev/jupyter-start.bash"]

tutorials/accelerated-python/brev/requirements.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@ opencv-python-headless
88

99
# Jupyter
1010
jupyter
11+
jupyterlab
1112
jupyterlab-nvidia-nsight
1213

1314
# CUDA
14-
cuda-python == 12.9.1 # cuda.{core, bindings}, numba.cuda
15+
cuda-python # cuda.{core, bindings}
16+
numba-cuda
1517
nvmath-python[cu12]
1618
cupy-cuda12x
1719
cuda-cccl[test-cu12]
18-
numba-cuda
1920

2021
# NVIDIA devtools
2122
nvtx

0 commit comments

Comments
 (0)