nvidia-smi -L: List GPUs and UUIDs
nvidia-smi -L prints one line per GPU with its index, product name, and stable UUID.
When a box has several GPUs, -L is how you learn which index maps to which physical card, and how to pin work with a UUID that survives reordering.
What it does
nvidia-smi -L enumerates every GPU the driver sees and prints "GPU <index>: <name> (UUID: GPU-xxxxxxxx-...)". The UUID is stable across reboots and enumeration order, unlike the numeric index.
Common usage
nvidia-smi -L
# example output:
# GPU 0: NVIDIA A100-SXM4-40GB (UUID: GPU-1a2b3c4d-...)
# pin a job to one GPU by UUID
CUDA_VISIBLE_DEVICES=GPU-1a2b3c4d-... python train.pyOptions
| Flag / var | What it does |
|---|---|
| -L | List GPUs with index, name, and UUID |
| CUDA_VISIBLE_DEVICES | Restrict which GPUs a process sees (by index or UUID) |
| -i <id> | Scope other nvidia-smi output to one GPU |
In CI
Prefer a UUID over a numeric index when pinning jobs; indices can reorder between runners while UUIDs do not. Setting CUDA_VISIBLE_DEVICES to a UUID from -L isolates a test to a known card even on a shared multi-GPU host.
Common errors in CI
An empty list (no GPU lines) from an otherwise-working nvidia-smi means CUDA_VISIBLE_DEVICES is set to an empty string or an invalid index, hiding all devices from the process. "No devices were found" means the driver sees no GPU at all, typically a container launched without GPU access or a passthrough/driver issue.