Learn / Lessons

CUDA and the software stack

Ever had AI software fail with a version error? Let's make sense of that. We're near the bottom, where the maths happens.

Chapters

  1. 0:00Introduction
  2. 0:06Where this fits: The AI stack
  3. 0:10From the bottom: Stacked up
  4. 0:22The framework: What is PyTorch?
  5. 0:47Versions: They must match
  6. 0:59Speed: CUDA graphs
  7. 1:08Your first check: Can it see the GPU?
  8. 1:22When it breaks: Check from the bottom
  9. 1:32Wrap up
Read the transcript

Introduction

Ever had AI software fail with a version error? Let's make sense of that.

Where this fits: The AI stack

We're near the bottom, where the maths happens.

From the bottom: Stacked up

At the bottom: the GPU and its driver. Above that, CUDA lets programs use the chip. Frameworks like PyTorch build on CUDA. And on top, model software runs your model.

The framework: What is PyTorch?

PyTorch is a free, open-source library for deep learning, used from Python. Its building block is the tensor: a block of numbers that can sit on the GPU, so the maths runs there. For training, it works out for you how the model's weights should change. It also runs trained models on new input. So you can build and run models in Python, with the heavy maths on the GPU.

Versions: They must match

PyTorch packages are built for particular CUDA versions. A newer driver generally still runs older CUDA programs. Going the other way, newer CUDA needs a minimum driver.

Speed: CUDA graphs

Normally each piece of GPU work is launched separately. A CUDA graph records the steps and launches them together, cutting launch overhead.

Your first check: Can it see the GPU?

A Terminal is a window where you type commands. On your Spark, open one. Type nvidia-smi, and press Enter. A table naming the GPU and its driver means the system can see it.

nvidia-smi

When it breaks: Check from the bottom

When it breaks, check upwards. Can the system see the GPU? Is the driver new enough? Do the CUDA builds match? Only then, blame the model.

Wrap up

Know your layers, and those errors start to make sense.

Sources

More lessons