Diagram deck

Nvidia CUDA in 100 Seconds

Channel Fireship

1. Why GPUs Win at Parallel Work

From Section 2, "Why GPUs Are Built for Parallel Work": when one operation must run on millions of pixels at once, thousands of simple GPU cores beat a handful of powerful CPU cores.

The problem

A 1080p frame holds over 2 million pixels, and at 60 FPS each one is recomputed every frame. Graphics, matrix math, and AI training all share this shape: the same operation, repeated enormously.

Generalist

CPU

Intel Core i9

24

cores

  • Each core is large and powerful.
  • Very different tasks, handled one at a time.
  • Versatile: runs whatever you throw at it.
Specialist

GPU

NVIDIA RTX 4090

16,000+

cores

  • Thousands of small, simple cores.
  • The same math, executed on every pixel at once.
  • Throughput measured in teraflops.
Takeaway

A GPU is not one faster brain; it is thousands of tiny ones working together. CUDA is the tool that points all that parallelism at real computing problems.

2. Host and Device: The Five-Step CUDA Flow

From Section 3, "How CUDA Works: Host, Device, and Execution": every CUDA program is a handshake across the CPU-GPU boundary - kernel first, data over, launch, execute, results back. Step through it below.

Legend: Host · CPU Device · GPU Crosses the boundary
Step 1 of 5

Click any step to jump to it. Steps before the current one are complete.

3. Grid, Blocks, and Threads: Inside a Kernel Launch

From Section 4, "Building Your First CUDA Application": how the launch add<<<1, 256>>> maps 256 threads onto the grid, and why every thread computes its own index before touching data.

Host code add<<<1, 256>>>(A, B, C); one block, 256 threads
Grid The full launch - one block in this demo; grids can hold many blocks and reach into multiple dimensions.
Block 0 256 threads, all running the same kernel
0 1 2 3 255

Every thread works out which element it owns:

index = blockIdx.x × blockDim.x + threadIdx.x
blockIdx.x

Which block the thread lives in. The demo launches one block, so this is 0.

blockDim.x

How many threads each block holds. The launch asks for 256.

threadIdx.x

The thread's position inside its block: 0 to 255.

Each thread C[index] = A[index] + B[index];

256 threads, each adding the pair of elements at its own index - 256 additions in parallel. Afterwards, cudaDeviceSynchronize() pauses the host until every thread has finished.