Skip to content

Commit 24fc358

Browse files
committed
Tutorials/CUDA C++: Rebase on to CUDA 13.1 container.
1 parent 1f614a8 commit 24fc358

File tree

4 files changed

+67
-34
lines changed

4 files changed

+67
-34
lines changed

.github/workflows/mirror-base-images.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@ jobs:
2121
strategy:
2222
matrix:
2323
image:
24-
- source: rapidsai/devcontainers:25.08-cpp-cuda12.8
25-
target_name: rapidsai-devcontainers-25.08-cpp-cuda12.8
26-
- source: rapidsai/devcontainers:25.10-cpp-cuda12.9
27-
target_name: rapidsai-devcontainers-25.10-cpp-cuda12.9
2824
- source: pytorch/pytorch:2.9.0-cuda12.8-cudnn9-runtime
2925
target_name: pytorch-2.9.0-cuda12.8-cudnn9-runtime
3026
- source: nvcr.io/nvidia/cuda:13.1.0-devel-ubuntu22.04

tutorials/accelerated-python/brev/dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ RUN python -m venv ${ACH_RAPIDS_VENV} \
120120

121121
COPY . /accelerated-computing-hub
122122

123-
# Ensure accelerated-computing-hub directory is writable by any user
123+
# Ensure accelerated-computing-hub directory is writable by any user.
124124
RUN chmod -R a+rwX /accelerated-computing-hub
125125

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

tutorials/cuda-cpp/brev/dockerfile

Lines changed: 51 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,54 @@
1-
FROM ghcr.io/nvidia/mirrors/rapidsai-devcontainers-25.10-cpp-cuda12.9
1+
FROM ghcr.io/nvidia/mirrors/nvidia-cuda-13.1.0-devel-ubuntu22.04
22

33
ENV ACH_TUTORIAL=cuda-cpp \
4-
ACH_NSYS_PATH=/usr/local/cuda-12.9/bin/nsys \
5-
ACH_NCU_PATH=/usr/local/cuda-12.9/bin/ncu \
6-
PATH=/accelerated-computing-hub/brev/wrappers:${PATH} \
4+
PYTHON_VERSION=3.12 \
5+
ACH_NSYS_PATH=/usr/local/cuda/bin/nsys \
6+
ACH_NCU_PATH=/usr/local/cuda/bin/ncu \
77
PIP_ROOT_USER_ACTION=ignore \
8+
PIP_DISABLE_PIP_VERSION_CHECK=1 \
89
CUPY_CACHE_DIR=/tmp/cupy_cache \
9-
MPLCONFIGDIR=/tmp/matplotlib_cache
10+
MPLCONFIGDIR=/tmp/matplotlib_cache \
11+
VIRTUAL_ENV_DISABLE_PROMPT=1 \
12+
PATH=/accelerated-computing-hub/brev/wrappers:/usr/local/nvidia/bin:/usr/local/cuda/bin:${PATH}
1013

11-
# Copy only requirements.txt first for better Docker layer caching.
12-
COPY tutorials/${ACH_TUTORIAL}/brev/requirements.txt /opt/requirements.txt
13-
14-
RUN set -ex \
15-
&& `# Install Python packages` \
16-
&& pip install --no-cache-dir --root-user-action=ignore -r /opt/requirements.txt \
17-
&& rm -f /opt/requirements.txt \
18-
&& `# Install system packages` \
19-
&& apt-get update -y \
20-
&& apt-get install -y --no-install-recommends ffmpeg git-lfs gosu sudo \
21-
&& apt-get clean -y \
22-
&& rm -rf /var/lib/apt/lists/*
23-
24-
# Disable unnecessary default Jupyter extensions.
25-
RUN python -m jupyter labextension disable "@jupyterlab/apputils-extension:announcements" \
26-
&& python -m jupyter labextension disable "@jupyterlab/console-extension:tracker"
27-
28-
# Enable passwordless sudo for all users and pass through environment and path
29-
RUN echo 'ALL ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers \
30-
&& sed -i -e 's/^Defaults\s*env_reset/Defaults !env_reset/' -e 's/^Defaults\s*secure_path=/#&/' /etc/sudoers
31-
32-
# Install Docker
14+
# Install system packages (needed before pip install for git-based packages)
3315
RUN apt-get update -y \
3416
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
17+
git \
18+
git-lfs \
3519
apt-transport-https \
3620
ca-certificates \
3721
curl \
3822
gnupg \
3923
lsb-release \
40-
&& mkdir -p /etc/apt/keyrings \
24+
gosu \
25+
libglib2.0-0 \
26+
sudo \
27+
ffmpeg \
28+
&& apt-get clean -y \
29+
&& rm -rf /var/lib/apt/lists/*
30+
31+
# Enable passwordless sudo for all users and pass through environment and path
32+
RUN echo 'ALL ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers \
33+
&& sed -i -e 's/^Defaults\s*env_reset/Defaults !env_reset/' -e 's/^Defaults\s*secure_path=/#&/' /etc/sudoers
34+
35+
# Install Python
36+
RUN curl -fsSL https://keyserver.ubuntu.com/pks/lookup?op=get\&search=0xBA6932366A755776 | gpg --dearmor -o /usr/share/keyrings/deadsnakes.gpg \
37+
&& echo "deb [signed-by=/usr/share/keyrings/deadsnakes.gpg] http://ppa.launchpad.net/deadsnakes/ppa/ubuntu jammy main" > /etc/apt/sources.list.d/deadsnakes-ppa.list \
38+
&& apt-get update -y \
39+
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
40+
python${PYTHON_VERSION} \
41+
python${PYTHON_VERSION}-dev \
42+
python${PYTHON_VERSION}-venv \
43+
&& curl -sS https://bootstrap.pypa.io/get-pip.py | python${PYTHON_VERSION} \
44+
&& ln -sf /usr/bin/python${PYTHON_VERSION} /usr/bin/python3 \
45+
&& ln -sf /usr/bin/python3 /usr/bin/python \
46+
&& ln -s /usr/local/bin/pip /usr/bin/pip \
47+
&& rm -f /usr/lib/python3.*/EXTERNALLY-MANAGED \
48+
&& rm -rf /var/lib/apt/lists/*
49+
50+
# Install Docker
51+
RUN mkdir -p /etc/apt/keyrings \
4152
&& curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg \
4253
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null \
4354
&& apt-get update -y \
@@ -50,9 +61,20 @@ RUN apt-get update -y \
5061
&& apt-get clean -y \
5162
&& rm -rf /var/lib/apt/lists/*
5263

64+
# Copy only requirements.txt first for better Docker layer caching.
65+
COPY tutorials/${ACH_TUTORIAL}/brev/requirements.txt /opt/requirements.txt
66+
67+
# Install Python packages.
68+
RUN pip install --no-cache-dir --root-user-action=ignore -r /opt/requirements.txt \
69+
&& rm -f /opt/requirements.txt
70+
71+
# Disable unnecessary default Jupyter extensions.
72+
RUN python -m jupyter labextension disable "@jupyterlab/apputils-extension:announcements" \
73+
&& python -m jupyter labextension disable "@jupyterlab/console-extension:tracker"
74+
5375
COPY . /accelerated-computing-hub
5476

55-
# Ensure accelerated-computing-hub directory is writable by any user
77+
# Ensure accelerated-computing-hub directory is writable by any user.
5678
RUN chmod -R a+rwX /accelerated-computing-hub
5779

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

tutorials/cuda-cpp/brev/test.bash

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
TUTORIAL_ROOT=/accelerated-computing-hub/tutorials/cuda-cpp
1111

12+
START_TIME=$(date +%s.%N)
13+
1214
nvidia-smi
1315

1416
if [ $# -gt 0 ]; then
@@ -21,3 +23,16 @@ if [ $# -gt 0 ]; then
2123
fi
2224
exit $?
2325
fi
26+
27+
END_TIME=$(date +%s.%N)
28+
ELAPSED=$(awk "BEGIN {print $END_TIME - $START_TIME}")
29+
30+
echo ""
31+
awk -v elapsed="$ELAPSED" 'BEGIN {
32+
hours = int(elapsed / 3600)
33+
minutes = int((elapsed % 3600) / 60)
34+
seconds = elapsed % 60
35+
printf "Elapsed time: %dh %dm %.3fs\n", hours, minutes, seconds
36+
}'
37+
38+
exit 0

0 commit comments

Comments
 (0)