Skip to content

Commit 89ea94a

Browse files
committed
reduce docker image size
1 parent 2d1b79f commit 89ea94a

File tree

3 files changed

+50
-62
lines changed

3 files changed

+50
-62
lines changed

tutorials/floating-point-emulation/brev/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: &tutorial-name floating-point-emulation
22

33
x-config:
44
dockerfile: &dockerfile tutorials/floating-point-emulation/brev/dockerfile
5-
image: &image ghcr.io/nvidia/floating-point-emulation-tutorial:brev-reorg-latest
5+
image: &image ghcr.io/nvidia/floating-point-emulation-tutorial:latest
66
working-dir: &working-dir /accelerated-computing-hub/tutorials/floating-point-emulation/notebooks
77
large: &large true
88
gpu-config: &gpu-config
Lines changed: 46 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,63 @@
1-
FROM ghcr.io/pytorch/pytorch:2.9.1-cuda13.0-cudnn9-runtime
1+
FROM ubuntu:24.04 AS artifacts
22

3-
ENV PIP_ROOT_USER_ACTION=ignore \
4-
ACH_TUTORIAL=floating-point-emulation
3+
COPY . /accelerated-computing-hub
4+
RUN find /accelerated-computing-hub/tutorials \
5+
-mindepth 1 -maxdepth 1 -type d -not -name "floating-point-emulation" \
6+
-exec rm -rf {} +
7+
RUN rm -rf /accelerated-computing-hub/.git
8+
9+
FROM nvidia/cuda:13.1.0-base-ubuntu24.04
10+
11+
# Install CUDA Toolkit + build tools
12+
RUN apt update -y \
13+
&& apt install -y wget \
14+
&& wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null \
15+
&& echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ noble main' | tee /etc/apt/sources.list.d/kitware.list >/dev/null \
16+
&& apt update -y \
17+
&& apt install -y cuda-nvrtc-13-1 cuda-cccl-13-1 libcublas-dev-13-1 \
18+
libnvjitlink-13-1 cuda-cudart-13-1 cuda-nvcc-13-1 libnvvm-13-1 \
19+
python-is-python3 python3-venv \
20+
build-essential cmake \
21+
&& apt-get clean -y
22+
23+
# Install MathDx
24+
RUN wget https://developer.nvidia.com/downloads/compute/cublasdx/redist/cublasdx/cuda13/nvidia-mathdx-25.12.1-cuda13.tar.gz \
25+
&& tar -xvf nvidia-mathdx-25.12.1-cuda13.tar.gz \
26+
&& rm nvidia-mathdx-25.12.1-cuda13.tar.gz \
27+
&& mkdir -p /opt/nvidia \
28+
&& mv nvidia-mathdx-25.12.1-cuda13/nvidia/mathdx /opt/nvidia/mathdx \
29+
&& rm -rf nvidia-mathdx-25.12.1-cuda13
30+
31+
# Install libmathdx
32+
RUN wget https://developer.nvidia.com/downloads/compute/cublasdx/redist/cublasdx/cuda13/libmathdx-Linux-x86_64-0.3.1-cuda13.0.tar.gz \
33+
&& mkdir -p /opt/nvidia/libmathdx \
34+
&& tar -xvf libmathdx-Linux-x86_64-0.3.1-cuda13.0.tar.gz -C /opt/nvidia/libmathdx \
35+
&& rm libmathdx-Linux-x86_64-0.3.1-cuda13.0.tar.gz
36+
37+
# Install python
38+
RUN python -m venv /opt/venv
39+
ENV ACH_TUTORIAL=floating-point-emulation \
40+
CUDA_PATH=/usr/local/cuda-13.1 \
41+
PATH="/opt/venv/bin:$PATH" \
42+
LD_LIBRARY_PATH="/opt/nvidia/libmathdx/lib:$LD_LIBRARY_PATH"
543

6-
# Copy only requirements.txt first for better Docker layer caching.
744
COPY tutorials/${ACH_TUTORIAL}/brev/requirements.txt /opt/requirements.txt
845

946
RUN set -ex \
1047
&& `# Install Python packages` \
11-
&& pip install --no-cache-dir --root-user-action=ignore -r /opt/requirements.txt \
12-
&& rm -f /opt/requirements.txt \
13-
&& `# Install system packages` \
14-
&& apt-get update -y \
15-
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends git-lfs \
16-
&& apt-get clean -y \
17-
&& rm -rf /var/lib/apt/lists/* \
18-
&& `# Setup Bash` \
19-
&& mkdir -p ~/.local/state/._bash_history \
48+
&& pip install --no-cache-dir -r /opt/requirements.txt \
49+
&& rm /opt/requirements.txt
50+
51+
RUN set -ex \
2052
&& `# Setup JupyterLab` \
2153
&& mkdir -p ~/.jupyter \
2254
&& ln -fs /accelerated-computing-hub/brev/jupyter-server-config.py ~/.jupyter/jupyter_server_config.py \
2355
&& mkdir -p ~/.ipython/profile_default/startup \
2456
&& ln -fs /accelerated-computing-hub/brev/ipython-startup-add-cwd-to-path.py ~/.ipython/profile_default/startup/00-add-cwd-to-path.py \
2557
&& python -m jupyter labextension disable "@jupyterlab/apputils-extension:announcements"
2658

27-
# Install Docker
28-
RUN apt-get update -y \
29-
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
30-
apt-transport-https \
31-
ca-certificates \
32-
curl \
33-
gnupg \
34-
lsb-release \
35-
&& mkdir -p /etc/apt/keyrings \
36-
&& curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg \
37-
&& 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 \
38-
&& apt-get update -y \
39-
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
40-
docker-ce \
41-
docker-ce-cli \
42-
containerd.io \
43-
docker-buildx-plugin \
44-
docker-compose-plugin \
45-
&& apt-get clean -y \
46-
&& rm -rf /var/lib/apt/lists/*
47-
48-
# Install CUDA Toolkit
49-
RUN apt-get update -y \
50-
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
51-
build-essential \
52-
wget \
53-
&& wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb \
54-
&& dpkg -i cuda-keyring_1.1-1_all.deb \
55-
&& rm cuda-keyring_1.1-1_all.deb \
56-
&& apt-get update \
57-
&& DEBIAN_FRONTEND=noninteractive apt-get -y install cuda-toolkit-13-1
58-
59-
# Install MathDx
60-
RUN wget https://developer.nvidia.com/downloads/compute/cublasdx/redist/cublasdx/cuda13/nvidia-mathdx-25.12.1-cuda13.tar.gz \
61-
&& tar -xvf nvidia-mathdx-25.12.1-cuda13.tar.gz \
62-
&& rm nvidia-mathdx-25.12.1-cuda13.tar.gz \
63-
&& mv nvidia-mathdx-25.12.1-cuda13/nvidia/mathdx /opt/nvidia \
64-
&& rm -rf nvidia-mathdx-25.12.1-cuda13
65-
66-
COPY . /accelerated-computing-hub
59+
COPY --from=artifacts /accelerated-computing-hub /accelerated-computing-hub
6760

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

70-
RUN `# Setup Git` \
71-
&& git config --unset-all "http.https://github.com/.extraheader" || { code=$?; [ "$code" = 5 ] || exit "$code"; } \
72-
&& git config --global --add safe.directory "/accelerated-computing-hub"
73-
7463
ENTRYPOINT ["/accelerated-computing-hub/brev/jupyter-start.bash"]

tutorials/floating-point-emulation/brev/requirements.txt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
# NVMATH + CTK 13.1 + CCCL + cublas
22
nvmath-python[dx]==0.8.*
3-
cuda-core[cu13]
4-
cuda-toolkit[cccl,nvrtc,cublas]==13.1.*
5-
nvidia-libmathdx-cu13 >=0.3.1,<0.4.0
6-
cuda-cccl[cu13]
3+
cuda-core
4+
cuda-bindings==13.1.*
5+
cuda-cccl
76

87
# Scientific
98
numpy

0 commit comments

Comments
 (0)