Hands-on tutorials for GPU programming in Mojo π₯ | Learn kernels, threads, blocks, memory layouts, and LayoutTensor with practical examples | Write once, run on NVIDIA, AMD, or Apple Silicon
| # | Topic | MDX | Colab | Video |
|---|---|---|---|---|
| 001 | GPU Introduction & Basics | π MDX | ||
| 002 | Memory Layout & LayoutTensor | π MDX | ||
| 003 | Vector Addition | π MDX | ||
| 004 | Thread Management | π MDX | ||
| 005 | Shared Memory | π MDX | ||
| 006 | Pooling Operations | π MDX | ||
| 007 | Convolution | π MDX | ||
| 008 | MAX Graph Introduction | - | ||
| 009 | Matrix Multiplication | π MDX | ||
| 010 | Functional Programming in Mojo | π MDX | ||
| 011 | Warp-Level Programming | π MDX | ||
| 012 | MAX Ecosystem | - | ||
| 013 | Block Level Programming | - |
All tutorials include embedded interactive visualizers to help you understand GPU concepts visually!
π‘ Colab Users: Visualizations are embedded directly in the notebooks - no downloads needed! Just run and interact.
π₯οΈ MDX Users: Use VS Code's Live Preview extension to view visualizations locally. Right-click any HTML file in
visualize/folder β Show Preview.
- Click any Colab badge from the tutorials table above
- Enable GPU: Runtime β Change runtime type β T4 GPU
- Run cells and explore embedded visualizations! π₯
π Note: Mojo code in Colab must be in a single block with a
main()function.
For a full notebook experience with code split across cells:
Setup:
git clone https://github.com/abhisheksreesaila/mojo-gpu-tutorials.git
cd mojo-gpu-tutorials
curl -fsSL https://pixi.sh/install.sh | sh # Install Pixi
pixi add mojo # Install Mojo
pixi shell # Activate environment
code . # Open in VS CodeInstall Extensions:
- Markdown Lab - for running
.mdxnotebooks - Live Preview - for viewing HTML visualizations (right-click HTML files β Show Preview)
Requirements: VS Code, Linux/macOS (Windows: WSL2), GPU optional
The code examples and implementations in these tutorials are adapted from Modular's GPU Puzzles and the official Mojo documentation. These materials have been reorganized and enhanced with detailed explanations to make GPU programming concepts more accessible to learners.
Special thanks to the Modular team for their excellent documentation and examples.
- π Mojo Notebook Setup
- π Mojo Installation Instructions
- π‘ Google Colab Guide
Happy GPU Programming! π₯π