Since I was a kid, I always loved nice puzzles! I remember learning PHP doing Euler Project (the answer was more often than not Catalan numbers!). For a couple of years now, I play along the Advent of Code, with 2 computing puzzles every day. Not always, not the whole season (life gets harder).

This year I'm using it to practice GPU programming, after reading a couple of chapters from "Programming Massively Parallel Processors". GPUs are quite distinct from CPUs, forcing interesting constraints while unlocking other approaches.

If you're joining this year's Advent of Code, ping me! I always like to compare solutions.

My solutions are published here: git.sitegui.dev/sitegui/advent-of-code-2026. Please be aware of bad GPU code, these are my first-steps 😁

I've spent my first day just deciding what to use and working out how to install the requirements. There are multiple options up and down the chain, organized in mainly two axis:

  • computation model:

    • graphics pipeline: operate on geometry, fragments and pixels. Ideal for shaders, but not necessarily for the puzzles I would solve.
    • tensors: operate with multidimensional grid of numbers. Ideal for matrix calculations, but I had already learned numpy and tensorflow, I would not force me down their square hole this December!
    • single-instruction multiple-threads (SIMT): imperative unrestricted access to all the sweet multiprocessors 👍
  • programming language:

    • C++
    • Python
    • Rust 🦀
    • OpenCL

I've decided for SIMT in Rust, using the rather recently announced rust-cuda crate. Unfortunately, it's a Cuda compiler, so only compatible with Nvidia hardware... But I'm not aiming to learn framework, instead I'm focusing on fundamentals.

Expect some small drops of GPU fun in the next weeks.