Skip to content

Latest commit

 

History

History

jax-profiling

README.md

JAX Profiling Tutorials

Tutorial notebooks for profiling JAX programs on NVIDIA GPUs.

Prerequisites

  • A Linux GPU host with an NVIDIA Ampere or newer GPU (compute capability 8.0+) and a driver compatible with the CUDA version you use.
  • CUDA 12.9+, JAX 0.8.1+, and CUTLASS DSL 4.4+ for the CuTe DSL integration.
  • NVIDIA Nsight Systems (nsys), Nsight Compute 2026.2.1+ (ncu), and Nsight Python 1.0+. The nsys and ncu executables must be on PATH.
  • Permission to access GPU performance counters. If profiling reports ERR_NVGPUCTRPERM, see NVIDIA's permissions guide.

Run in a container

The NVIDIA NGC JAX container is recommended, but not required. The example below uses 26.10-py3; see its release notes for driver requirements. CUDA and JAX are provided inside the container.

For this workflow, install Docker and the NVIDIA Container Toolkit on the GPU host. From the repository root, run:

docker run --rm -it \
  --gpus all \
  --cap-add=SYS_ADMIN \
  -p 127.0.0.1:8888:8888 \
  -v "$PWD/tutorials/jax-profiling:/tutorial" \
  -w /tutorial \
  nvcr.io/nvidia/jax:26.10-py3 bash

--cap-add=SYS_ADMIN grants profiling access inside the container. The directory mount keeps notebooks and generated reports on the host.

Inside the container, install the Python dependencies and start JupyterLab:

python -m pip install jupyterlab ipykernel "nsight-python>=1.0" "nvidia-cutlass-dsl>=4.4" nvtx
python -m jupyterlab --ip=0.0.0.0 --port=8888 --no-browser --allow-root

Open http://localhost:8888/lab using the token printed in the terminal. For a remote GPU host, forward the port from your local machine with ssh -L 8888:localhost:8888 user@gpu-host.

Generated scripts and reports are written to profile_artifacts/.

Use another environment

You can use another compatible container or a Linux Python environment that meets the prerequisites above. For a local installation, follow the JAX GPU installation instructions, install the Python dependencies listed above, and make nsys and ncu available on PATH.

Start JupyterLab from tutorials/jax-profiling/ with python -m jupyterlab --no-browser. Docker and the NVIDIA Container Toolkit are only needed for the container workflow.