No description
Find a file
2026-12-04 16:55:00 +01:00
.cargo First commit with devcontainer 2026-12-02 13:26:03 +01:00
src Solve day 4 o/ 2026-12-04 16:55:00 +01:00
.gitignore Solve day 1 o/ 2026-12-02 16:43:45 +01:00
Cargo.lock Solve day 1 o/ 2026-12-02 16:43:45 +01:00
Cargo.toml Solve day 1 o/ 2026-12-02 16:43:45 +01:00
README.md Give up on devcontainers 2026-12-02 14:52:37 +01:00
rust-toolchain.toml First commit with devcontainer 2026-12-02 13:26:03 +01:00

Advent of Code 2026

This year, I'll be playing with GPUs o/

My first approach is to use the rather new cuda-oxide to write Rust code that gets compiled to the GPU.

Installing

I'm following the official docs to install it: https://nvidia.github.io/cuda-rust/cuda-oxide/getting-started/installation.html. I have an NVIDIA GeForce GTX 1660 Ti with CUDA 13.2 a driver 595.99.02.

Although the recommended installation method is using dev containers, I could make it work well with IntelliJ, so I gave up and installed all the necessary dependencies on my machine directly:

  1. Install Docker
  2. Install the container toolkit as explained in this guide:
sudo apt-get update && sudo apt-get install -y --no-install-recommends \
   ca-certificates \
   curl \
   gnupg2
   
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
  && curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
    sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
    sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
    
sudo apt-get update

export NVIDIA_CONTAINER_TOOLKIT_VERSION=1.20.2-1
  sudo apt-get install -y \
      nvidia-container-toolkit=${NVIDIA_CONTAINER_TOOLKIT_VERSION} \
      nvidia-container-toolkit-base=${NVIDIA_CONTAINER_TOOLKIT_VERSION} \
      libnvidia-container-tools=${NVIDIA_CONTAINER_TOOLKIT_VERSION} \
      libnvidia-container1=${NVIDIA_CONTAINER_TOOLKIT_VERSION}

sudo nvidia-ctk runtime configure --runtime=docker

sudo systemctl restart docker
  1. Install the necessary system dependencies:
sudo apt-get update

sudo apt-get install -y --no-install-recommends ca-certificates curl g++ gcc git gnupg libc6-dev make pkg-config \
    python3 python3-pip python3-venv xz-utils
  1. Install LLVM dependencies:
curl -fsSL https://apt.llvm.org/llvm-snapshot.gpg.key | sudo gpg --dearmor -o /usr/share/keyrings/apt.llvm.org.gpg
sudo tee /etc/apt/sources.list.d/llvm-toolchain-noble-21.list <<< "deb [signed-by=/usr/share/keyrings/apt.llvm.org.gpg] https://apt.llvm.org/noble/ llvm-toolchain-noble-21 main"

sudo apt-get update

sudo apt-get install -y --no-install-recommends clang-21 libclang-common-21-dev lld-21 llvm-21 llvm-21-dev
  1. Install Cuda toolkit:

Instructions from https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&Distribution=Ubuntu&target_version=26.04&target_type=deb_network

wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2604/x86_64/cuda-keyring_1.1-1_all.deb
sudo dpkg -i cuda-keyring_1.1-1_all.deb
sudo apt-get update
sudo apt-get -y install cuda-toolkit-13-5
  1. Install Oxide
cargo +1.99.1 install --git https://github.com/NVIDIA/cuda-rust.git cargo-oxide
  1. Check your installation with
cargo oxide doctor

Fix anything doctor reports before building.

Run

cargo oxide run