CUDA development

Write, build and run CUDA code on a real NVIDIA card, with CUDA 13 and newer, from your Mac's Terminal.

CUDA versions

Install CUDA toolkits from the app's Software pane: CUDA 13.0 and newer, up to what the card's driver runs, several side by side. One of them is the default; change it with Make Default.

CUDA 12? Programs built with CUDA 12 run on the GPU: the driver runs them. PyTorch's CUDA 12 builds and Docker images based on CUDA 12 bring their own CUDA libraries and work as they are. Compiling with a CUDA 12 toolkit is not available yet; inside a CUDA 12 Docker image, it is.

PathWhat
/Volumes/Jacket/usr/local/cudaThe default toolkit
/Volumes/Jacket/usr/local/cuda-x.yA specific version

Build with nvcc

$ cd ~/projects/kernels
$ /Volumes/Jacket/usr/local/cuda/bin/nvcc -O2 saxpy.cu -o saxpy

The program is written to your project folder. It's a Linux program for the GPU, so start it through the Jacket disk:

$ /Volumes/Jacket/usr/bin/env ./saxpy

Pick a version per project

A project uses a version by its path. For example, in a Makefile:

CUDA ?= /Volumes/Jacket/usr/local/cuda-13.0
NVCC := $(CUDA)/bin/nvcc

saxpy: saxpy.cu
	$(NVCC) -O2 $< -o $@

CMake, Rust and other build tools

Build tools that run on the GPU side can be installed into the GPU machine and started the same way, through the Jacket disk. See Development tools.

Libraries

cuDNN and NCCL can be added to any toolkit from the Software pane. They're installed into that toolkit's folder, next to its own libraries.

In a project

In a project, nvcc and nvidia-smi work by name, and programs you build run directly: nvcc kernel.cu -o kernel && ./kernel in a jacket shell. Anywhere else, jacket nvcc … and jacket ./kernel.