
GPU Puzzles
A set of interactive Python-style puzzles that teach beginner GPU programming with CUDA via Numba.
- Stars
- 12.6k
- Forks
- 965
- Licence
- MIT
- Language
- Jupyter Notebook
- Last update
- 2.2 years ago
- Type
- Learning resource
No commits in over a year — check for forks or alternatives before adopting.
What it is
GPU Puzzles is a notebook of exercises where you write small GPU functions (kernels) and run them against tests. Instead of reading long explanations, you fill in short code blocks and check your answers. It uses Numba, which lets you write Python-looking code that maps closely to low-level CUDA.
- Work through the Map, Zip, Guard, and 2D puzzles to learn how threads index into arrays
- Learn how blocks and threads per block divide up work in the Blocks puzzles
- Run each puzzle in Colab and use problem.check() to test your kernel against the spec
- Follow the linked walkthrough video alongside the notebook
Great for
- Developers who want hands-on intuition for how GPU code is organized
- Machine learning practitioners who have never written GPU code
- Students who learn better by coding than by reading
- People who want a short, practical introduction to threads and blocks
Not ideal for
- People who need to write production GPU code, since the puzzles cover basics only and the README says the code is basically low-level CUDA
- People without access to a GPU, because the README recommends Colab with GPU mode turned on
- Readers who want a conceptual text-based course rather than coding exercises
How to get it
- 1
Use it in the browser (or self-host)
You'll need: A Google account for Colab (recommended by the README) · Python knowledge is helpful
Open in Colab (recommended by the README)
https://colab.research.google.com/github/srush/GPU-Puzzles/blob/main/GPU_puzzlers.ipynbClone the repository
git clone https://github.com/srush/GPU-Puzzles - 2
Run it
- Open the Colab badge link and make your own copy of the notebook
- Turn on GPU mode via Runtime / Change runtime type, setting Hardware accelerator to GPU
- Run the setup cells to install dependencies and download the helper files
- Fill in the FILL ME IN section of Puzzle 1 and run problem.check()
- 3
Get the most out of it
- Read the linked NUMBA CUDA Guide for the manual-level details the puzzles point to
- Watch the linked walkthrough video if you get stuck
- Try the author's related Tensor Puzzles repository for PyTorch-style practice
- Use problem.show() to see the score table for reads and writes after each attempt
Downloads
Strengths
- Interactive: you write code and get immediate test feedback
- Runs in Google Colab with the Colab badge, so little local setup is needed
- MIT licensed and free to use
Trade-offs
- The README's puzzle set shown here is truncated, so the full scope is not visible from this text
- Requires a GPU, so it is not usable on a CPU-only machine as described
- Covers introductory material; the README says the intent is basics, not advanced optimization
How it compares
| Project | Stars | Type | Level | Updated | Best for |
|---|---|---|---|---|---|
| GPU-Puzzles (this) | 12.6k | Learning resource | beginner | 2.2 years ago | Developers who want hands-on intuition for how GPU code is organized |
| ML-For-Beginners | 91.9k | Learning resource | beginner | 5 days ago | Beginners who want a structured, self-paced introduction to machine learning |
| ai-engineering-from-scratch | 76.3k | Learning resource | intermediate | 4 days ago | Students who want to understand how LLMs, retrieval, and agents work internally |
| AI-For-Beginners | 70.5k | Learning resource | beginner | 13 days ago | Beginners who want a structured, self-paced introduction to AI |
| annotated_deep_learning_paper_implementations | 67.6k | Learning resource | intermediate | 4 days ago | Students learning how transformers, GANs, or optimizers work internally |
| Made-With-ML | 49.9k | Learning resource | intermediate | 8 months ago | Software engineers who want to learn how ML models get deployed and maintained |
Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.