PantheonSim / GitHub Actions

CUDA and HIP tests in GitHub Actions, without a GPU

PantheonSim, the GPU simulator for CUDA and ROCm, ships a GitHub Action for a problem GPU teams know: GitHub’s hosted runners have no GPU, so GPU code usually goes untested until someone has a card free. The action gives a job simulated NVIDIA or AMD GPUs: CUDA and HIP code compiles, and its tests run, on every push and pull request.

Add it to a workflow

One step, after checkout. Everything after it in the job sees the GPUs you asked for.

# .github/workflows/cuda.yml
name: CUDA tests
on: [push, pull_request]

jobs:
  cuda-tests:
    runs-on: ubuntu-24.04
    steps:
      - uses: actions/checkout@v4
      - uses: pantheongpu/pantheonsim@main
        with:
          gpu: nvidia/h100
          count: 2
      - run: |
          nvidia-smi -L
          nvcc -arch=compute_90 my_test.cu -o my_test
          vgpu run ./my_test

AMD and HIP

Name an Instinct profile and the action installs ROCm’s own hipcc instead of the CUDA toolkit. It installs only the compiler: the simulator is the HIP runtime, so no driver or ROCm runtime comes with it.

      - uses: pantheongpu/pantheonsim@main
        with:
          gpu: amd/mi300x
          count: 2
      - run: |
          rocm-smi
          hipcc --offload-arch=gfx942 my_test.hip -o my_test
          ./my_test

A program hipcc built runs directly, as above, or under vgpu run: the action points ROCm’s libamdhip64 at the simulator, so ctest and test scripts work unchanged. rocm_agent_enumerator reports the simulated cards, so hipcc with no --offload-arch builds for them, as it would on a real machine.

CUDA and ROCm versions

By default an NVIDIA job gets Ubuntu’s CUDA toolkit (CUDA 12.0 on ubuntu-24.04) and an AMD job gets ROCm 7.1. Name a version to get that one instead, from NVIDIA’s or AMD’s own repository:

      - uses: pantheongpu/pantheonsim@main
        with:
          gpu: nvidia/h100
          cuda-toolkit: '12.6'     # or '13.0'

What it does

  1. Installs CMake, Ninja and a C++ compiler, then the compiler for the GPU: Ubuntu’s CUDA toolkit with the GCC 12 its nvcc needs, the nvcc of the CUDA version you named, or, for an AMD GPU, ROCm’s hipcc.
  2. Builds the simulator at the ref the job named, and caches the build against a hash of its source and the toolkit version, so later runs skip it.
  3. Puts the simulator’s tools (nvidia-smi, rocm-smi, amd-smi, rocm_agent_enumerator, vgpu) first on PATH and sets VGPU_GPU, VGPU_DEVICE_COUNT and VGPU_SHIM_DIR for the rest of the job (and, with the apt toolkit, NVCC_PREPEND_FLAGS=-ccbin g++-12).

After it, nvidia-smi or rocm-smi reports the GPUs you asked for, nvcc is the real compiler with -cudart shared added (so unmodified build systems link the runtime the simulator stands in for), and vgpu run ./program runs a program on the simulated GPUs.

Inputs

InputDefaultMeaning
gpunvidia/t4The profile to simulate, such as nvidia/h100 or amd/mi300x. vgpu list-gpus lists them; see the GPU index.
count1How many GPUs.
cuda-toolkitapt for NVIDIA, none for AMDapt installs Ubuntu’s toolkit; a version such as 12.6 or 13.0 installs that nvcc from NVIDIA; none uses one the job already installed.
rocm7.1 for AMD, none for NVIDIAThe ROCm version whose hipcc to install from AMD: 6.4, 7.0, 7.1 and 7.2 are the releases whose programs are checked on the simulator; none uses one the job already installed.
library-pathtruePuts the simulator’s libraries on LD_LIBRARY_PATH, so programs run directly (ctest, scripts) as well as under vgpu run. Set false when the build links the toolkit’s own vendor libraries such as cuBLAS, and run the tests under vgpu run.

Outputs

OutputMeaning
build-dirWhere the simulator was built.
shim-dirIts CUDA and HIP libraries, for LD_LIBRARY_PATH when not using vgpu run.

Testing on every GPU

A result that depends on the card is the bug CI on one GPU never finds. vgpu test --matrix runs the same binary on every measured NVIDIA profile and compares the outputs; it exits 3 when a profile differs and 4 when the program did not run at all. Build it for the oldest architecture you support:

      - run: |
          nvcc -arch=compute_75 vectoradd.cu -o vectoradd
          vgpu test --matrix ./vectoradd | tee matrix.txt
          grep -q ' 0 different' matrix.txt

Things to know

Related: run CUDA without a GPU, run ROCm and HIP without an AMD GPU and what “no CUDA-capable device” means. The GPU index lists every profile the gpu input accepts, and the comparison says where physical GPU runners still fit.

Want to try it before wiring up a workflow? The playground gives you the same tools in a browser terminal.