{"id":51308195,"url":"https://github.com/bolu-atx/cuda-dojo","last_synced_at":"2026-07-01T01:32:44.270Z","repository":{"id":367820764,"uuid":"1282445516","full_name":"bolu-atx/cuda-dojo","owner":"bolu-atx","description":"Level up your CUDA skills - RPG style. Do or do not, there is no try.","archived":false,"fork":false,"pushed_at":"2026-06-27T21:14:13.000Z","size":1406,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-27T21:15:00.645Z","etag":null,"topics":["cuda","examples","learning","tutorial"],"latest_commit_sha":null,"homepage":"","language":"Cuda","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bolu-atx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-06-27T19:27:52.000Z","updated_at":"2026-06-27T20:09:54.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/bolu-atx/cuda-dojo","commit_stats":null,"previous_names":["bolu-atx/cuda-dojo"],"tags_count":null,"template":true,"template_full_name":null,"purl":"pkg:github/bolu-atx/cuda-dojo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bolu-atx%2Fcuda-dojo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bolu-atx%2Fcuda-dojo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bolu-atx%2Fcuda-dojo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bolu-atx%2Fcuda-dojo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bolu-atx","download_url":"https://codeload.github.com/bolu-atx/cuda-dojo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bolu-atx%2Fcuda-dojo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34989787,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-30T02:00:05.919Z","response_time":92,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cuda","examples","learning","tutorial"],"created_at":"2026-07-01T01:32:43.100Z","updated_at":"2026-07-01T01:32:44.247Z","avatar_url":"https://github.com/bolu-atx.png","language":"Cuda","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"docs/assets/dojo-logo.webp\" alt=\"CUDA Dojo Logo\" width=\"300\" /\u003e\n\u003c/p\u003e\n\n# CUDA Dojo\n\nA level-by-level CUDA learning project, structured as a skill tree rather than a\ntextbook. Each level unlocks one mental model and one production skill. Host code\nis **C++23**, device code is **C++20** (the highest CUDA reliably supports for\n`__device__` code today).\n\n\u003e **Hardware:** CUDA requires an NVIDIA GPU. macOS/Apple Silicon cannot build or\n\u003e run this — develop on a Linux/Windows box with the CUDA Toolkit installed.\n\n## How to use this\n\nCUDA Dojo is a hands-on **learning template**, not a library to depend on. The\nintended loop is: get your own copy, work a level until you can *explain* it, then\nclimb the tree. The [interactive guide](https://bolu.dev/cuda-dojo/) teaches the\nmental model; the `levels/` code is where you prove you have it.\n\n1. **Get your own copy.** Click **Use this template** on GitHub (or fork) to start\n   a personal repo you can commit your solutions into, then clone it:\n   ```bash\n   git clone https://github.com/\u003cyou\u003e/cuda-dojo.git\n   cd cuda-dojo\n   make dep-check        # confirm your CUDA toolchain is ready\n   ```\n2. **Read the level, then the code.** Open the matching page in the\n   [interactive guide](https://bolu.dev/cuda-dojo/) (or `make docs-serve` for a\n   local copy), play with the widgets until the concept clicks, then read the\n   kernels in `levels/levelNN_\u003ctopic\u003e/`.\n3. **Build and prove it.** `make levelNN-test` compiles the level and runs it\n   against a CPU reference. A green test is the *floor*, not the goal — make sure\n   you can predict the numbers (transactions, bandwidth, occupancy), not just pass.\n4. **Extend, then continue.** Each level ends with \"your reps\" — small variations\n   to implement yourself. Scaffold a new level with `add_dojo_level(...)` (see\n   [Anatomy of a level](#anatomy-of-a-level)) and work up the\n   [skill tree](#the-skill-tree).\n\n## Build \u0026 test\n\nThe `Makefile` is the front door — it wraps CMake/CTest and auto-discovers levels\nfrom `levels/`, so per-level targets appear automatically as levels are added.\n\n```bash\nmake dep-check        # verify toolchain (nvcc, cmake, generator, profilers)\nmake                  # configure + build everything\nmake test             # run all level tests (CTest)\n\nmake level01          # build one level's kernel lib + demo\nmake level01-test     # build + run just that level's tests\nmake help             # list every target, including per-level ones\nmake clean            # remove ./build (distclean also drops ./out, ./.venv)\n```\n\nPrefer raw CMake? It works the same:\n\n```bash\ncmake -B build -G Ninja                        # configure (targets local GPU arch)\ncmake --build build -j                          # build everything\nctest --test-dir build --output-on-failure      # run all tests\n./build/levels/level01_vector_add/level01_demo   # run a level's demo\n```\n\nPin specific architectures instead of autodetecting (required when building\nwithout a GPU present, e.g. in CI or a container):\n\n```bash\ncmake -B build -DCMAKE_CUDA_ARCHITECTURES=\"80;86;90\"   # or: all-major\n```\n\n## Docker (self-contained toolchain)\n\nThe image encapsulates the **entire CUDA toolkit** (nvcc, cuBLAS, cuFFT, …) plus\nbuild deps — no host CUDA install needed. The one thing it can't contain is the\nNVIDIA **kernel driver**: that stays on the host and is bridged in at runtime by\nthe [NVIDIA Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html)\n(`--gpus all`). So *compiling* needs no GPU, but *running kernels* needs a GPU host.\n\n```bash\nmake docker-build     # build the toolchain image\nmake docker-compile   # compile in-container WITHOUT a GPU (all-major) — CI/Mac friendly\nmake docker-test      # build + test in-container (needs a GPU host + --gpus all)\nmake docker-shell     # interactive shell, repo bind-mounted, --gpus all\n```\n\nVS Code users: **Reopen in Container** uses `.devcontainer/` (GPU optional, so it\nopens and compiles even on machines without an NVIDIA GPU).\n\n## Project layout\n\n```\ncommon/dojo/cuda_utils.cuh   CUDA_CHECK, GpuTimer, bandwidth/FLOP helpers, device info\ncommon/dojo/test.hpp         zero-dependency micro test harness (CTest-backed)\ncmake/Dojo.cmake             add_dojo_level() — one helper builds lib + demo + test\nlevels/levelNN_\u003ctopic\u003e/      each level: kernels (.cu), a demo, and a test\n```\n\n### Anatomy of a level\n\nKernels live in a small static library that **both** the demo and the test link\nagainst, so the canonical host+kernel code is written once and exercised two\nways. Add a new level by creating `levels/levelNN_\u003ctopic\u003e/` with a\n`CMakeLists.txt` calling `add_dojo_level(...)`, then `add_subdirectory(...)` it\nfrom the top-level `CMakeLists.txt`.\n\n## The skill tree\n\nThe numbering matches the [interactive guide](https://bolu.dev/cuda-dojo/). Status\nreflects the **code** under `levels/`: ✅ implemented, ⬜ planned, 📖 guide-only\n(conceptual, no kernel to write).\n\n| Level | The one idea | Project | Status |\n|------:|--------------|---------|:------:|\n| 0 | A GPU trades latency for throughput | GPU mental model | 📖 |\n| 1 | A kernel is one function run by a grid of threads | vector add / SAXPY / reduction | ✅ |\n| 2 | You design the thread→data mapping | invert / threshold / crop | ✅ |\n| 3 | CUDA has a logical machine and a physical machine | scope-mapping drills (grid/block/thread → SM/warp/lane) | ✅ |\n| 4 | Where data lives dominates speed | tiled transpose | ✅ |\n| 5 | Every kernel is memory- or compute-bound | optimize blur / Sobel (roofline) | ✅ |\n| 6 | A block is a team with a shared scratchpad | box filter / separable blur | ✅ |\n| 7 | Warp lanes cooperate through masks and registers | warp reduction / histogram | ✅ |\n| 8 | Synchronization is a scope decision | warp / block / stream idioms | ⬜ |\n| 9 | Don't hand-roll GEMM or FFT | cuBLAS / cuFFT pipeline | ⬜ |\n| 10 | Overlap copy and compute | video pipeline (streams) | ⬜ |\n| 11 | Real programs are kernel graphs | GEMM (multi-kernel) | ⬜ |\n| 12 | Nsight tells you the truth | profile a kernel: 20 ms → 1 ms | ⬜ |\n| 13 | Compose work into pipelines with streams, events, graphs | producer/consumer pipeline | ⬜ |\n| 14 | Production = pools + graphs + streams | end-to-end image pipeline | ⬜ |\n| 15 | Reformulate the algorithm for the hardware | your own | ⬜ |\n| 16 | Pipeline tiles inside one kernel | `cp.async` GEMM tile loop | ⬜ |\n\nGiven an HPC/SIMD/OpenMP background, levels 0–2 should go fast; the real payoff\nis levels 4–10 (memory hierarchy, warp programming, Nsight-driven perf analysis,\nand stream/graph pipelines).\n\nThe docs also include three advanced tracks that stay in the same Feynman style:\narchitecture (now also covering multi-GPU scaling — NCCL/NVSHMEM, MIG), libraries,\nand imaging/CV. Each one is built around prediction, interactive widgets, and concrete\nCUDA reps rather than reference-manual lists.\n\n## Profiling (from Level 5 onward)\n\nRelease builds compile with `-lineinfo` so the profilers map SASS back to source:\n\n```bash\nnsys profile ./build/levels/.../levelNN_demo     # timeline: transfers, kernels, gaps\nncu --set full ./build/levels/.../levelNN_demo    # per-kernel: occupancy, memory, roofline\n```\n\n## Interactive guide (docs)\n\nA Feynman-style, level-by-level companion site with **interactive canvas widgets**\n(thread indexing, SIMT divergence, coalescing, roofline, reduction, streams …)\nlives in `docs/`, built with MkDocs Material.\n\n```bash\nmake docs-serve       # live preview at http://127.0.0.1:9090\nmake docs             # build static site into ./out/docs\n```\n\n## Cheatsheets\n\nTo help with learning CUDA concepts (these are designed to be printed on standard Letter-sized paper):\n\n![CUDA Cheatsheet](docs/assets/cuda-cheatsheet.png)\n![CUDA Cheatsheet Page 2](docs/assets/cuda-cheatsheet-2.png)\n\n## License\n\nBSD 3-Clause. Redistribution must retain the copyright notice, license terms,\nand disclaimer; see [LICENSE](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbolu-atx%2Fcuda-dojo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbolu-atx%2Fcuda-dojo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbolu-atx%2Fcuda-dojo/lists"}