Overview • Why Mojo • Getting Started • Development • Community
"For the things we have to learn before we can do them, we learn by doing them." — Aristotle, (Nicomachean Ethics)
Welcome to Mojo🔥 GPU Puzzles — an interactive approach to learning GPU programming through hands-on puzzle solving. Instead of traditional textbook learning, you'll immediately dive into writing real GPU code and seeing the results.
Start Learning Now 👉 https://builds.modular.com/puzzles
📬 Subscribe to updates to get notified when new puzzles are released!
Mojo represents a revolutionary approach to GPU programming, making massive parallelism accessible while maintaining systems-level performance:
- 🐍 Python-like Syntax with systems programming capabilities
- ⚡ Zero-cost Abstractions that compile to efficient machine code
- 🛡️ Strong Type System catching errors at compile time
- 📊 Built-in Tensor Support with hardware-aware optimizations
- 🔧 Direct Hardware Access to CPU and GPU intrinsics
- 🔄 Cross-Hardware Portability for CPUs and GPUs
- 🎯 Ergonomic Improvements over traditional C/C++
You'll need a compatible GPU to run the examples.
-
Clone this repository
git clone https://github.com/modular/mojo-gpu-puzzles cd mojo-gpu-puzzles
-
Install a package manager to run the Mojo🔥 programs:
Option 1:
uv
(recommended for users)Install:
curl -fsSL https://astral.sh/uv/install.sh | sh
Update:
uv self update
Create a virtual environment:
uv venv && source .venv/bin/activate
Option 2: pixi (recommended for contributors)
Install:
curl -fsSL https://pixi.sh/install.sh | sh
Update:
pixi self-update
-
Start solving puzzles!
We use pixi
for development as it includes uv
and also supports conda packages (like mdbook
from the conda-forge
channel) needed for development workflows.
# Build and serve the book
pixi run book
# Test solutions on GPU
pixi run tests
# Run GPU sanitizers for debugging on NVIDIA GPUs using `compute-sanitizer`
pixi run memcheck # Detect memory errors
pixi run racecheck # Detect race conditions
pixi run synccheck # Detect synchronization errors
pixi run initcheck # Detect uninitialized memory access
# Format code
pixi run format
We welcome contributions! Whether it's:
- 📝 Improving explanations
- 🐛 Fixing bugs (report bug)
- 💡 Suggesting improvements (request feature)
Please feel free to:
- Fork the repository
- Create your feature branch
- Submit a pull request
Join our vibrant community to discuss GPU programming, share solutions, and get help!
- Thanks to all our contributors
- Initial puzzles are heavily inspired by GPU Puzzles
- Built with mdBook
This project is licensed under the LLVM License - see the LICENSE file for details.
Built with ❤️ by the Modular team