This is the Volume 18 capstone. You can size Tiers 1–5 and still lose a week to torch.cuda.is_available() == False. Module 18.3 CUDA introduced driver vs toolkit vs wheel; this lecture is the compatibility matrix across OS, NVIDIA driver, CUDA runtime, cuDNN, PyTorch/TensorRT/ORT, and WSL2. Storage was bytes; this is boot-to-kernel truth.
Volume 19 Accuracy assumes a stack that actually runs. Pin versions in Docker (18.2) the same way you pin model dtypes (Vol. 06) and engines (Vol. 12 FlashAttention builds).
Learning Objectives
By the end of this lesson, students should be able to:
- State the compatibility inequality: driver CUDA max ≥ wheel/runtime CUDA ≥ libraries you compile.
- Pick an OS posture per tier: Windows/macOS Tier 1, Linux (+optional WSL2) for CUDA Tiers 2–5.
- Diagnose common failures: CPU wheel, WDDM vs TCC, WSL driver, mismatched TensorRT, old driver on Hopper.
- Write a one-page pin list (OS, kernel, driver, CUDA, torch, TRT) for a Docker image.
- Know when Apple MPS/MLX or CPU ORT is the correct “compatibility” answer (skip CUDA).
- Hand off Vol. 18 hardware to Vol. 19 evaluation without a flaky environment.
OS / CUDA / driver compatibility is the constraint that the operating system kernel module (NVIDIA driver), the CUDA user-mode runtime bundled with your framework, compiled libraries (cuDNN, NCCL, TensorRT, FlashAttention), and the GPU compute capability must agree. The driver defines the maximum CUDA runtime it will load. A newer toolkit or wheel than the driver supports fails. A GPU newer than the driver (e.g. Hopper on a stale datacenter image) fails. OS choice matters because Windows WDDM, Linux TCC/HPC drivers, and WSL2 each expose CUDA differently—and macOS has no CUDA at all.
The Inequality (memorize this)
| Piece | Must satisfy | Check |
|---|---|---|
| NVIDIA driver | New enough for GPU SKU + desired CUDA runtime | nvidia-smi Driver + CUDA Version header |
| Framework wheel | Runtime ≤ driver max; matches libc/OS | torch.version.cuda, is_available() |
| Toolkit / nvcc | Only if you compile FA/TRT plugins | nvcc --version |
| TensorRT / ORT CUDA EP | Exact CUDA + driver table from vendor docs | TRT version in image tag |
| Compute capability | Kernels built for this SM (8.6 / 8.9 / 9.0…) | get_device_capability() |
| OS | Supported kernel + driver package | Ubuntu LTS vs Win + WSL vs macOS (no CUDA) |
OS Posture by Tier
Tier 1
- Any OS: Win/macOS/Linux
- Python + SDK; no driver matrix
- Still pin TLS, SDK versions
Tiers 2–3 (desktop GPU)
- Linux native = fewest surprises
- Win + Studio/Game Ready driver works
- WSL2: install NVIDIA WSL CUDA support
- macOS: MPS/MLX, not CUDA
Tiers 4–5
- Linux only in production (Ubuntu LTS / RHEL)
- HPC datacenter drivers, not Game Ready
- NGC / distro CUDA containers
- Never mix random pip TRT on the host
Capstone Inventory Script
Run this on every box before you blame the model. Paste the output into the Docker tag comment.
Failure Catalog (read before Slack)
Fixable mismatches
- CPU-only torch → install CUDA wheel
- Driver older than wheel → upgrade driver (or older wheel)
- WSL: Windows GPU driver outdated
- Container CUDA > host driver max
- TRT engine built on CC 8.9 run on 8.0
Wrong tool entirely
- macOS + CUDA expectation → MPS or Tier 1
- AMD GPU + CUDA wheel → ROCm build
- Tier 1 product + week of driver yak → stop, use the API
- Game Ready on a K8s node → datacenter driver
Related Lectures (Vol. 18 map)
| Lecture | Why the capstone points back |
|---|---|
| 18.3 CUDA / GPU | Layers + CC you just pinned |
| TensorRT / ONNX | EP/engine version lock |
| Tier 1 … Tier 5 | OS posture changes with silicon |
| Vol. 06 CUDA Cores | What the driver is talking to |
| Vol. 12 FlashAttention | Often the first compile that breaks pins |
| Vol. 19 Accuracy | Next volume: measure quality on a stack that boots |
“nvidia-smi CUDA 12.6 means my PyTorch is 12.6.” That header is driver max; the wheel may be 12.1 and that is fine. Second: “Installing the full CUDA toolkit fixes CPU torch.” It does not replace a CPU wheel. Third: “Windows is unsupported for learning.” Tier 1 and many Tier 2 chat setups work; production train/serve still prefers Linux. Fourth: “Compatibility is optional if the GPU is expensive.” H100s with the wrong driver are paperweights.
Knowledge Check
- Short Answer: State the driver vs wheel CUDA inequality. Answer: Driver-supported CUDA max must be ≥ the framework wheel/runtime CUDA.
- True/False: The CUDA Version line in nvidia-smi is always the nvcc toolkit you compiled with. Answer: False—it is the driver’s maximum supported runtime.
- Multiple Choice: macOS CUDA story: (a) install nvidia-smi, (b) no CUDA—use MPS/MLX or Tier 1 API, (c) InfiniBand. Answer: (b).
- Short Answer: Why can a CUDA 12.4 container fail on a host whose nvidia-smi reports CUDA 11.8? Answer: Host driver max is 11.8; it cannot load a 12.4 runtime.
- True/False: A CPU-only PyTorch wheel will see the GPU after you install nvcc. Answer: False—you need a CUDA-built wheel (and a working driver).
- Multiple Choice: Production Tier 5 OS: (a) gaming Windows + Game Ready, (b) Linux LTS + datacenter driver + pinned NGC/CUDA image, (c) iOS. Answer: (b).
- Short Answer: Name one WSL2-specific failure. Answer: Outdated Windows NVIDIA driver / missing WSL CUDA user-mode libs (or GPU not passed through).
- True/False: TensorRT engines are portable across compute capabilities. Answer: False—rebuild per CC / TRT version.
- Multiple Choice: If the product is Tier 1 API-only and CUDA is broken: (a) block the course for two weeks, (b) proceed on SDKs and skip local GPU, (c) buy IB. Answer: (b).
- Short Answer: What Volume 19 lecture does this capstone hand off to? Answer: Vol. 19 Accuracy (module 19.1).
Key Takeaways
- Vol. 18 capstone: pin OS + driver + CUDA runtime + wheel + CC + TRT/ORT together.
- Driver max ≥ wheel; nvidia-smi is not nvcc; CPU torch never “sees” CUDA.
- Tier 1 can skip the matrix; Tiers 4–5 cannot.
- Linux + NGC images for serious GPU; macOS is MPS or API.
- Hardware without eval is unfinished—continue to Vol. 19 Accuracy.
Lab (capstone): Each student fills a compatibility card for their machine (or a cloud VM): OS, driver, nvidia-smi CUDA max, torch wheel CUDA, CC, VRAM, tier they actually qualify for (1–5). Deliberately break a venv with CPU torch and repair it. Optional: write a 15-line Dockerfile FROM an official CUDA runtime that installs the matching torch extra-index wheel.
Discussion: Recap the whole volume: when should this class stay on API keys vs buy a 3060 vs rent A100s? Force storage + driver + eval (Vol. 19) into the answer, not just TFLOPS.
Recap: Volume 18 closes on OS/CUDA/driver pins so hardware tiers actually boot. Continue with Volume 19 Accuracy.