Course 2 — Programming Foundations: Modern Embedded C, Modern C++ & CUDA, and NumPy & PyTorch
The programming prerequisite for the labs, delivered as three 100-exercise repositories on GitHub — one self-contained file per exercise that states a problem and tests the answer, a next command that runs the first unfinished exercise, and a reference solution to diff against
This is the programming course beside Course 3 — Embedded DSP and Course 4 — Real-Time Rendering & GPU Engineering. It is not taught on this site: the course is three exercise repositories on GitHub, each in the format of Mainmatter’s 100 exercises to learn Rust — one self-contained file per exercise that states a problem and checks your answer, a next command that runs the first unfinished exercise, and a reference solution to diff against once you have a failing attempt of your own. You edit the code, run the tests, and move on when they pass; there is no lecture to sit through and nothing to read that is not next to the code it is about.
Each repository maps to the track that spends it: modern embedded C is the C the Course 3 firmware labs are written in; modern C++ and CUDA is the language of Course 4’s engine and kernels; NumPy and PyTorch is the Python every lab in both tracks prototypes in.
Note on AI use: unlike everything else on this site, the exercises in these three repositories — the exercise files, starters, tests, and reference solutions — were drafted with AI assistance from the books and documentation each README lists. I am working through them one at a time by hand, fixing what I find, and each README opens with a dated status note saying exactly how much has been through my own hands.
100 exercises to learn modern embedded C
Modern C — C17, the C of shipping firmware — in 100 host exercises across fifteen chapters, then 15 more on the bare metal of the NUCLEO-L476RG: objects and types; integers and bits — promotions, signed/unsigned, overflow, endianness, fixed-point; pointers and arrays; strings and memory; structs, unions, padding, and lawful type punning; storage duration, linkage, and which section every byte lands in; the preprocessor; memory without malloc — object pools, arenas, ring buffers, stack discipline; errors and APIs; modules and test doubles; volatile and memory-mapped I/O; interrupts and C11 atomics; state machines and time; and a capstone assembling CRC-16, a framed wire protocol, a fixed-point filter, and a command station. Everything runs on the Mac under the sanitizers with an MCU’s budgets; the NUCLEO track (linker script, startup code, SysTick, EXTI, interrupt-driven UART, ADC, DMA, a watchdog soak test) cross-compiles with the GNU Arm toolchain. This is the C that Course 3’s firmware assumes. CMake and Ninja; K&R assumed read.
→ github.com/diivanand/100-exercises-to-learn-modern-embedded-c
100 exercises to learn modern C++
C++20 in 100 exercises across thirteen chapters, then 25 more on modern CUDA C++: types and initialization; functions and control flow; values, ownership, and RAII; classes and polymorphism; errors, optional, and variant; containers and strings; algorithms and ranges; templates and concepts; lambdas; concurrency with jthread, atomics, and memory ordering; coroutines; the modern standard library (format, chrono, filesystem, <bit>); and a capstone metrics store. The CUDA track covers kernels and launches, streams and events, coalescing, shared-memory tiling, warp shuffles, occupancy, unified and pinned memory, Thrust, CUB, libcu++, cooperative groups, CUDA graphs, and profiling with Nsight Systems and Nsight Compute, written on the Mac and built on the RTX 4090 Linux desktop that Course 4 uses. Some exercises start as a compile error, and the lifetime exercises are meant to be re-run under the sanitizers. CMake and Ninja, doctest vendored, CI on macOS.
100 exercises to learn modern NumPy and PyTorch
NumPy 2 and PyTorch 2 in 100 exercises across fourteen chapters, the Python counterpart to the C++ repository: arrays and dtypes; broadcasting and vectorisation; views, memory, and performance; linear algebra and random numbers (solve not inv, least squares, eigh and the SVD, default_rng); structured data and I/O; NumPy idioms and the 1.x to 2.x migration; tensors and the NumPy bridge; autograd, custom autograd.Function, gradcheck, and torch.func; modules and the training loop; datasets and loaders; modern PyTorch (torch.compile, autocast, scaled dot-product attention, the profiler, torch.export); debugging and testing; and a capstone character-level transformer. Every test runs on the CPU. Python 3.12 or 3.13 with uv, pytest, and ruff.
→ github.com/diivanand/100-exercises-to-learn-modern-numpy-and-pytorch