|
1 | | -FROM ghcr.io/pytorch/pytorch:2.9.1-cuda13.0-cudnn9-runtime |
| 1 | +FROM ubuntu:24.04 AS artifacts |
2 | 2 |
|
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" |
5 | 43 |
|
6 | | -# Copy only requirements.txt first for better Docker layer caching. |
7 | 44 | COPY tutorials/${ACH_TUTORIAL}/brev/requirements.txt /opt/requirements.txt |
8 | 45 |
|
9 | 46 | RUN set -ex \ |
10 | 47 | && `# 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 \ |
20 | 52 | && `# Setup JupyterLab` \ |
21 | 53 | && mkdir -p ~/.jupyter \ |
22 | 54 | && ln -fs /accelerated-computing-hub/brev/jupyter-server-config.py ~/.jupyter/jupyter_server_config.py \ |
23 | 55 | && mkdir -p ~/.ipython/profile_default/startup \ |
24 | 56 | && ln -fs /accelerated-computing-hub/brev/ipython-startup-add-cwd-to-path.py ~/.ipython/profile_default/startup/00-add-cwd-to-path.py \ |
25 | 57 | && python -m jupyter labextension disable "@jupyterlab/apputils-extension:announcements" |
26 | 58 |
|
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 |
67 | 60 |
|
68 | 61 | WORKDIR /accelerated-computing-hub/tutorials/${ACH_TUTORIAL}/notebooks |
69 | 62 |
|
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 | | - |
74 | 63 | ENTRYPOINT ["/accelerated-computing-hub/brev/jupyter-start.bash"] |
0 commit comments