← all repositories
srush/GPU-Puzzles

Why read about CUDA when you can break it instead?

An interactive notebook that teaches CUDA by making you write and debug real GPU kernels in Python-shaped puzzles.

12.3k stars Jupyter Notebook Learning
GPU-Puzzles
Not currently ranked — collecting fresh signals.
star history

What it does GPU-Puzzles is a single Jupyter notebook of coding exercises that walks you from basic thread indexing to shared memory and pooling kernels. You write functions in Numba’s CUDA Python dialect—which looks like Python but compiles to low-level GPU code—and a custom checker verifies your output against a spec. Each puzzle also scores your memory usage and renders a diagram of the thread layout.

The interesting bit The pedagogical trick is deliberate restriction: you cannot use list comprehensions, numpy shape queries, or anything “Pythonic.” You are effectively writing C-like CUDA with Python indentation, and the immediate feedback loop of failing tests and memory-score tables makes the abstract thread/block model concrete.

Key highlights

  • Covers thread indexing, 2D blocks, guards, broadcasting, shared memory, and synchronization.
  • Uses Numba to compile Python syntax directly to CUDA kernels without leaving the notebook.
  • Each puzzle includes a visual diagram and a per-thread memory-access scoreboard.
  • Designed to run in a GPU-enabled notebook environment like Colab.
  • Claims to get you from zero to understanding the kernels behind “99% of deep learning” in a few hours.

Caveats

  • The README warns that this is not standard Python: Numba restrictions mean many familiar Python constructs will crash or confuse the compiler.
  • Requires a GPU runtime to execute and verify kernels.
  • Depends on a custom helper library and a patched graphics package for its visual diagrams.

Verdict Worth an afternoon if you are an ML practitioner who has been treating the GPU as a black box. Skip it if you are already comfortable writing raw CUDA or expect a gentle high-level API tutorial.

Frequently asked

What is srush/GPU-Puzzles?
An interactive notebook that teaches CUDA by making you write and debug real GPU kernels in Python-shaped puzzles.
Is GPU-Puzzles open source?
Yes — srush/GPU-Puzzles is open source, released under the MIT license.
What language is GPU-Puzzles written in?
srush/GPU-Puzzles is primarily written in Jupyter Notebook.
How popular is GPU-Puzzles?
srush/GPU-Puzzles has 12.3k stars on GitHub.
Where can I find GPU-Puzzles?
srush/GPU-Puzzles is on GitHub at https://github.com/srush/GPU-Puzzles.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.