CUDA, Drivers, PyTorch & GPU Compatibility

Between a rented GPU and a working model run sit four layers of software, each shipped by someone different, and most setup failures in this field are two of those layers disagreeing. This lesson gives you the map of the layers, the readout and the checks that diagnose them, and the proof that a box is ready before you spend an hour debugging a model that was never going to load.

For standard PyTorch you install almost none of this yourself; the work is knowing which layer to read when something refuses to run.

The four layers

At the bottom is the silicon. Above it, the NVIDIA kernel driver, a module installed into the operating system and usually preinstalled on any cloud GPU image. Above that, the CUDA libraries that programs use to talk to the driver. At the top, your PyTorch build, which brings its own copy of the CUDA runtime with the pip install.

That bundling is the fact that untangles most confusion. A standard pip install of a CUDA-enabled torch wheel brings the runtime with it, so you never install a system-wide CUDA toolkit for this course's work; the only requirement the box must meet is a kernel driver new enough for the wheel's bundled runtime.

So "CUDA version" means three different things, and conversations go wrong when they are conflated: the newest CUDA the driver can support; the version of a system-wide toolkit, if one is installed (for this course, usually none); and the runtime your PyTorch build bundles. When someone asks "what CUDA are you on," the useful answer names which of the three.

Reading nvidia-smi

nvidia-smi is the driver's own report, and its header holds the first of the three versions. A representative readout from an H100 box (illustrative; your numbers will differ):

The header earns a careful read twice over. The CUDA Version it prints is the driver's maximum supported version, not anything installed: a fresh box with no toolkit and no PyTorch still prints it. And the memory column is in MiB, the binary units the lesson on memory and throughput arithmetic warned about: 81,559 MiB is 79.7 GiB, the "80 GB" of the spec sheet, which counts in binary here. The bigger-looking number is a unit change, not extra memory.

The checks from Python

Three lines from Python settle whether the stack actually works:

The output above is real, from this course's CPU-only verification environment, and it shows the most common failure exactly: is_available() is False and torch.version.cuda is None. On a healthy GPU box the three lines print a version, True, and the bundled runtime version, and torch.cuda.get_device_name(0) names the card.

False has a short decision tree. If torch.version.cuda is None, the wheel is CPU-only: reinstall the right build, nothing on the box is at fault. If it prints a version but is_available() is still False, the box side is the problem: no driver, or a driver too old for the wheel's runtime, and nvidia-smi failing outright confirms the problem is the box's driver.

Choosing the wheel

The CPU-only trap comes from installation defaults, which differ by platform and change over time. The reliable form names the runtime explicitly through PyTorch's index URLs:

The tag cu126 names a bundled CUDA 12.6 runtime, one current example as of August 2026. On Linux the plain pip install torch typically resolves to a CUDA build on its own; the trap lives on other platforms and in older instructions. Whatever you run, the verification is the same one line: torch.version.cuda prints a version, not None.

The install selector

PyTorch's get-started page is a matrix: pick OS, package manager, and compute platform, and it emits the exact install command, kept current as wheel tags change. Use it instead of memorizing index URLs.

Compute capability

One layer of compatibility lives in the silicon itself. Every NVIDIA generation carries a compute capability number naming its instruction set: the H100 is capability 9.0 (the sm_90 you will see in build logs), the consumer RTX 4090 is 8.9. Compiled GPU code targets a set of capabilities, and a build that does not include your card's fails at runtime; the classic symptom is an error saying no kernel image is available for the device.

Capability also gates formats. BF16, the format this course's canon assumes since the precision table from memory and throughput arithmetic, is supported from capability 8.0 (the Ampere generation) upward; on older cards, BF16 models fall back or fail, which is a hardware fact no reinstall fixes. Checking a card's capability before renting it is a one-line lookup in NVIDIA's published table, and torch.cuda.get_device_capability() reads it from Python.

Pinning the box

The environment habit from Python and PyTorch setup extends one level down. Alongside requirements.txt, record the box: driver version and GPU name from nvidia-smi, plus torch.__version__ and torch.version.cuda. Four lines in a README turn "it worked on the rented box" into a claim the next machine can check.

The prerequisites end here. The lab that closes this module assembles them into one verified setup, the artifact running your first LLM assumes on day one.