Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions tutorials/cutile-python/brev/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: &tutorial-name cutile-python

x-config:
dockerfile: &dockerfile tutorials/cutile-python/brev/dockerfile
image: &image ghcr.io/nvidia/cutile-python-tutorial:latest
working-dir: &working-dir /accelerated-computing-hub/tutorials/cutile-python/notebooks
default-jupyter-url: &default-jupyter-url
gpu-config: &gpu-config
privileged: true
ulimits:
memlock: -1
stack: 67108864
shm_size: 1g
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu]
common-service: &common-service
pull_policy: missing
volumes:
- accelerated-computing-hub:/accelerated-computing-hub
- /var/run/docker.sock:/var/run/docker.sock
environment:
BREV_ENV_ID: ${BREV_ENV_ID:-}
ACH_TUTORIAL: *tutorial-name
ACH_RUN_TESTS: ${ACH_RUN_TESTS:-}
user: root
working_dir: *working-dir
persistent-service: &persistent-service
depends_on:
base:
condition: service_completed_successfully
restart: unless-stopped

services:
base:
<<: [*gpu-config, *common-service]
image: *image
entrypoint: ["/accelerated-computing-hub/brev/base-start.bash"]
build:
context: ../../..
dockerfile: *dockerfile
restart: "no"
jupyter:
<<: [*gpu-config, *common-service, *persistent-service]
image: *image
command: *default-jupyter-url
ports:
- "0.0.0.0:8888:8888" # JupyterLab
nsight:
<<: [*gpu-config, *common-service, *persistent-service]
image: nvcr.io/nvidia/devtools/nsight-streamer-nsys:2025.3.1
entrypoint: ["/accelerated-computing-hub/brev/nsight-start.bash"]
ports:
- "0.0.0.0:8080:8080" # HTTP
- "0.0.0.0:3478:3478" # TURN

volumes:
accelerated-computing-hub:
91 changes: 91 additions & 0 deletions tutorials/cutile-python/brev/dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
FROM ghcr.io/nvidia/mirrors/nvidia-cuda-13.0.2-base-ubuntu22.04

ENV PYTHON_VERSION=3.12 \
PIP_ROOT_USER_ACTION=ignore \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
VIRTUAL_ENV_DISABLE_PROMPT=1 \
OMPI_ALLOW_RUN_AS_ROOT=1 \
OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 \
ACH_RAPIDS_VENV=/opt/venvs/rapids \
ACH_TUTORIAL=accelerated-python

# Install system packages (needed before pip install for git-based packages)
RUN apt-get update -y \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
git \
git-lfs \
apt-transport-https \
ca-certificates \
curl \
gnupg \
lsb-release \
libglib2.0-0 \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*

# Install CUDA
RUN REPO_URL="https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64" \
&& curl -L -O ${REPO_URL}/cuda-keyring_1.1-1_all.deb \
&& dpkg -i cuda-keyring_1.1-1_all.deb \
&& echo "deb [signed-by=/usr/share/keyrings/cuda-archive-keyring.gpg] ${REPO_URL} /" > /etc/apt/sources.list.d/cuda.list \
&& apt-get update -y \
&& apt-get install -y --no-install-recommends \
cuda-tileiras-13.1 \
cuda-compiler-13.1 \
cuda-libraries-13.1 \
&& rm -rf /var/lib/apt/lists/*

# Install Python
RUN curl -fsSL https://keyserver.ubuntu.com/pks/lookup?op=get\&search=0xBA6932366A755776 | gpg --dearmor -o /usr/share/keyrings/deadsnakes.gpg \
&& 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 \
&& apt-get update -y \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
python${PYTHON_VERSION} \
python${PYTHON_VERSION}-dev \
&& curl -sS https://bootstrap.pypa.io/get-pip.py | python${PYTHON_VERSION} \
&& ln -sf /usr/bin/python${PYTHON_VERSION} /usr/bin/python3 \
&& ln -sf /usr/bin/python3 /usr/bin/python \
&& ln -s /usr/local/bin/pip /usr/bin/pip \
&& rm -rf /var/lib/apt/lists/*

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

# Remove externally managed flag and install Python packages.
RUN rm -f /usr/lib/python3.*/EXTERNALLY-MANAGED \
&& pip install --no-cache-dir --root-user-action=ignore -r /opt/requirements.txt \
&& rm -f /opt/requirements.txt

# Install Nsight Systems and Nsight Compute.
RUN curl -L -O https://developer.nvidia.com/downloads/assets/tools/secure/nsight-systems/2025_3/NsightSystems-linux-cli-public-2025.3.1.90-3582212.deb \
&& dpkg -i NsightSystems-linux-cli-public-2025.3.1.90-3582212.deb \
&& rm -f NsightSystems-linux-cli-public-2025.3.1.90-3582212.deb \
&& curl -L -O https://developer.download.nvidia.com/compute/cuda/repos/debian12/x86_64/nsight-compute-2025.2.1_2025.2.1.3-1_amd64.deb \
&& dpkg -i nsight-compute-2025.2.1_2025.2.1.3-1_amd64.deb \
&& rm -f nsight-compute-2025.2.1_2025.2.1.3-1_amd64.deb \
&& mkdir -p /usr/local/nvidia/bin \
&& ln -s /opt/nvidia/nsight-systems-cli/2025.3.1/bin/nsys /usr/local/nvidia/bin/nsys \
&& ln -s /opt/nvidia/nsight-compute/2025.2.1/ncu /usr/local/nvidia/bin/ncu

# Install PyTorch with CUDA 12.8 support.
RUN pip install --no-cache-dir --root-user-action=ignore \
--index-url https://download.pytorch.org/whl/cu129 \
torch==2.8.0

# Setup Bash & JupyterLab.
RUN mkdir -p ~/.local/state/._bash_history \
&& mkdir -p ~/.jupyter \
&& ln -fs /accelerated-computing-hub/brev/jupyter-server-config.py ~/.jupyter/jupyter_server_config.py \
&& mkdir -p ~/.ipython/profile_default/startup \
&& ln -fs /accelerated-computing-hub/brev/ipython-startup-add-cwd-to-path.py ~/.ipython/profile_default/startup/00-add-cwd-to-path.py \
&& python -m jupyter labextension disable "@jupyterlab/apputils-extension:announcements"

COPY . /accelerated-computing-hub

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

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

ENTRYPOINT ["/accelerated-computing-hub/brev/jupyter-start.bash"]
1 change: 1 addition & 0 deletions tutorials/cutile-python/brev/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cuda-tile
29 changes: 29 additions & 0 deletions tutorials/cutile-python/notebooks/start.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "b692e38e",
"metadata": {},
"source": [
"## cuTile Python Tutorial\n",
"\n"
]
}
],
"metadata": {
"colab": {
"gpuType": "T4",
"provenance": []
},
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"name": "python"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading