Before you start: words you need#
| Word | Plain meaning |
|---|---|
| Driver | The operating-system component that owns the GPU hardware. One version per machine. |
| CUDA | NVIDIA’s platform for running general computation on its GPUs: a language extension, a compiler (nvcc), and runtime libraries. |
| CUDA toolkit / runtime | The compiler, headers and libcudart that an application is built against. Versioned separately from the driver (CUDA 13.x in 2026). |
| Kernel library | A collection of hand-tuned GPU kernels for common jobs, such as matrix multiply (cuBLAS). |
| Framework | A higher-level system that decides which kernels to run: PyTorch, vLLM, llama.cpp. |
| NVML | NVIDIA Management Library: reads GPU temperature, memory use, errors. nvidia-smi is built on it. |
| Container | A packaged application with its own libraries, sharing the host’s operating-system kernel (3.j). |
1. What is it?#
Between an inference server and the GPU’s transistors sit several layers. Knowing them is how you fix the most common GPU errors — “CUDA driver version is insufficient”, “no CUDA-capable device”, “no kernel image is available for execution on the device” — because each message comes from one specific layer.
flowchart TB
APP["Your application<br/>inference service, script"]
SRV["Engine or framework<br/>vLLM, SGLang, PyTorch, llama.cpp"]
KDSL["Kernel languages<br/>Triton, CUTLASS / CuTe DSL"]
LIB["Kernel libraries<br/>cuBLAS, cuDNN, FlashInfer, NCCL"]
RT["CUDA runtime<br/>libcudart, nvcc"]
DRV["NVIDIA driver<br/>kernel module + libcuda, libnvidia-ml"]
HW[("GPU hardware")]
APP --> SRV --> LIB --> RT --> DRV --> HW
SRV --> KDSL --> RT
NVML["NVML<br/>nvidia-smi, DCGM, go-nvml"] --> DRV
class APP,SRV compute
class LIB,RT,KDSL io
class DRV,NVML neutral
class HW memory2. Why does it exist?#
No one writes every GPU operation by hand. Each layer packages work so the one above can reuse it: the driver hides the hardware, CUDA gives a programming model, libraries provide fast kernels for common maths, and frameworks pick and sequence kernels for a whole model. The layering is also what lets you upgrade the parts independently — if you respect one compatibility rule (section 5).
3. Simple analogy#
A restaurant: the driver is the building’s gas and electricity, the CUDA runtime is the standard kitchen equipment, kernel libraries are pre-made sauces from expert suppliers, the framework is the head chef deciding which dishes to cook in which order, and your application is the menu. If the gas is too old for the new oven, nothing cooks — which is exactly the driver/runtime rule below.
4. Tiny example#
Read GPU state from a program. Tools that watch or schedule GPUs (Kubernetes device plugins, DCGM,
autoscalers) all start like this. This version shells out to nvidia-smi’s machine-readable
output, so it needs no libraries:
// gpus.go — list GPUs using nvidia-smi's CSV output.
package main
import (
"encoding/csv"
"fmt"
"os/exec"
"strings"
)
type GPU struct {
Index, Name, Driver string
MemUsedMiB, MemTotalMiB, UtilPct string
TempC, PowerW string
}
func List() ([]GPU, error) {
out, err := exec.Command("nvidia-smi",
"--query-gpu=index,name,driver_version,memory.used,memory.total,utilization.gpu,temperature.gpu,power.draw",
"--format=csv,noheader,nounits").Output()
if err != nil {
return nil, fmt.Errorf("nvidia-smi not available: %w", err)
}
rows, err := csv.NewReader(strings.NewReader(string(out))).ReadAll()
if err != nil {
return nil, err
}
var gpus []GPU
for _, r := range rows {
for i := range r {
r[i] = strings.TrimSpace(r[i])
}
gpus = append(gpus, GPU{r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7]})
}
return gpus, nil
}
func main() {
gpus, err := List()
if err != nil {
fmt.Println(err)
fmt.Println("(no NVIDIA GPU here — that is fine; read the code and move on)")
return
}
for _, g := range gpus {
fmt.Printf("GPU %s %-24s driver %s %s/%s MiB util %s%% %s C %s W\n",
g.Index, g.Name, g.Driver, g.MemUsedMiB, g.MemTotalMiB, g.UtilPct, g.TempC, g.PowerW)
}
}The same in Python is pynvml (or nvidia-ml-py); production tools use NVML directly through
go-nvml or DCGM.
5. Technical explanation#
The layers, bottom up#
| Layer | What it is | Where it lives |
|---|---|---|
| Driver | Kernel module that owns the hardware, plus user-space libcuda and libnvidia-ml | On the host; one version per machine |
| CUDA toolkit / runtime | libcudart, the nvcc compiler, headers, PTX tools | With the application (usually inside the container) |
| Kernel libraries | cuBLAS/cuBLASLt (matrix maths), cuDNN (neural-net layers), NCCL (multi-GPU communication, 9.f), FlashInfer and FlashAttention (attention, 13.l), TensorRT (optimising compiler, 15.c) | With the application |
| Kernel languages | Ways to write new kernels without raw CUDA C++: Triton (6.e), CUTLASS and its Python CuTe DSL, CUDA Python | With the application |
| Framework / engine | Chooses and sequences kernels: PyTorch, vLLM, SGLang, TensorRT-LLM, llama.cpp | With the application |
The one compatibility rule#
The driver must be at least as new as the CUDA version the application needs. Drivers are backward compatible: a new driver runs old CUDA applications. An old driver cannot run a newer CUDA runtime, and fails with “CUDA driver version is insufficient for CUDA runtime version”.
Each CUDA major version names a minimum driver branch — for example CUDA 13.0 with the R580 branch — and within a major version, applications built with a newer minor release generally run on the older driver of that major version (“minor version compatibility”), with some features unavailable. Data-center GPUs can also use NVIDIA’s forward compatibility package to run a newer CUDA on an older driver.
The practical rule: keep host drivers current; let each application bring its own CUDA runtime and libraries. That is exactly how containers are used.
Compiled for which GPU?#
Kernels are compiled for specific compute capabilities (4.a): sm_90 for Hopper, sm_100 for
B200, sm_103 for B300, sm_120 for RTX 50-series and RTX PRO Blackwell. A library built without
your GPU’s target fails with “no kernel image is available” — or falls back to slower generic
code. CUDA 13 also dropped compiler support for the oldest architectures (Maxwell, Pascal and
Volta), so very old GPUs stay on CUDA 12.
This is why engine releases list supported GPUs, and why “works on H100” does not mean “fast on B200”: the fast Blackwell paths are separate kernels (4.f).
GPUs in containers#
A container shares the host’s kernel, so it must use the host’s driver — but carries its own CUDA libraries. The NVIDIA Container Toolkit handles the split: when a container starts, it injects the host’s driver libraries and GPU device files. The image supplies everything above the driver. In Kubernetes, the NVIDIA GPU Operator installs the driver, the toolkit and the device plugin on each node (21.c).
docker run --rm --gpus all nvidia/cuda:13.0.0-base-ubuntu24.04 nvidia-smiIf that prints the GPU table, the stack is healthy up to the driver.
Two APIs, two purposes#
- CUDA — compute: allocate memory, copy data, launch kernels.
- NVML — management: temperature, utilisation, memory use, processes, errors.
nvidia-smiand DCGM are built on it; Kubernetes GPU components use it throughgo-nvml.
Beyond NVIDIA#
| Vendor | Compute platform | Notes |
|---|---|---|
| NVIDIA | CUDA | Largest library ecosystem; the default in AI |
| AMD | ROCm, HIP (a CUDA-like language) | Supported by PyTorch, vLLM, SGLang; kernels via Triton, Composable Kernel, AITER (7.h) |
| XLA, JAX, Pallas | For TPUs; vLLM has a TPU backend (7.i) | |
| AWS | Neuron SDK, NKI | For Trainium and Inferentia (7.j) |
| Intel | oneAPI, SYCL | GPUs and Gaudi |
| Apple | Metal, MLX | Unified memory on M-series chips (15.e) |
The concepts in this module — kernels, device memory, queues, synchronisation — carry to all of them under different names. Writing kernels in a portable layer such as Triton is one way engines support several vendors.
6. Under the hood#
What happens when an engine starts on a GPU:
1. The process loads libcuda (from the host driver, injected into the container).
2. The CUDA runtime creates a context on the device — a few hundred MB of GPU memory
and a second or more of setup.
3. Libraries load their kernels; any kernel compiled only as PTX (portable intermediate code)
is JIT-compiled for this GPU and cached on disk.
4. Frameworks may autotune or compile kernels (torch.compile, Triton, FlashInfer autotuning),
which can take minutes on first start — another cold-start cost (20.g).7. Performance implications#
- Library versions are performance versions. A newer cuBLAS, FlashInfer or engine release often adds the fast kernels for the newest GPU. Upgrading the container can be worth more than any tuning.
- JIT compilation and autotuning add start-up time; cache them on persistent disk or bake them into the image.
- The driver rarely affects speed directly, but very old drivers can block a newer CUDA and therefore newer kernels.
8. Production implications#
- Pin the full stack per release: driver branch on hosts; CUDA, libraries and engine in the image.
- Upgrade drivers fleet-wide on a schedule, ahead of the CUDA versions your images need.
- Use the official engine images for your hardware (CUDA vs ROCm builds), not hand-built ones.
- Monitor through NVML/DCGM, not by parsing
nvidia-smitext in production.
9. Common mistakes#
- Installing CUDA inside the container and also expecting to update the driver there. The driver always comes from the host.
- Upgrading the image’s CUDA past what the host driver supports.
- Assuming an image built for Hopper is fast on Blackwell without checking it includes
sm_100/sm_103kernels. - Confusing
nvidia-smi’s “CUDA Version” (the newest CUDA the driver supports) with the CUDA version your application uses.
10. Hands-on exercise#
- Run
gpus.go(or its Python equivalent). On a machine without a GPU, confirm it fails cleanly. - Extend it into a loop that prints one line per second, like a tiny
nvidia-smi dmon. - On a GPU machine, compare the “CUDA Version” printed by
nvidia-smiwithpython -c "import torch; print(torch.version.cuda)". Explain both numbers. - An image built for CUDA 13 fails on a host whose driver is from 2023. Which layer do you upgrade, and why not the other one?
11. Interview questions#
- State the driver/runtime compatibility rule.
- What does the NVIDIA Container Toolkit inject into a container, and what must the image bring?
- What is the difference between CUDA and NVML?
- What does “no kernel image is available for execution on the device” mean, and how do you fix it?
- Why can upgrading an engine image speed up inference on new GPUs without any config change?
12. Further reading#
Checked on 11 November 2026. CUDA 13.5 was released in early November 2026 (Vera Rubin support generally available).
- [REFERENCE] CUDA Toolkit release notes and CUDA compatibility guide
- [REFERENCE] NVIDIA Container Toolkit and GPU Operator
- [REFERENCE] NVML API and go-nvml
- [REFERENCE] CUTLASS 4 and the CuTe DSL
- [REFERENCE] AMD ROCm documentation