Skip to content

About

PantheonSim: GPU simulator for CUDA and ROCm. Run CUDA and HIP programs unmodified on a CPU, no GPU needed: simulated NVIDIA and AMD GPUs for development, teaching and CI.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

58 stars

Watchers

0 watching

Forks

Latest commit

 

History

1,717 Commits

Folders and files

PantheonSim

CI

PantheonSim runs CUDA and HIP programs on a CPU, with no GPU. It supplies fake driver, runtime and library files and a profile for each GPU model (T4, H100, MI300X and 45 more), so a program built with the real nvcc or hipcc runs against it. It checks what a program computes. It does not model how fast a GPU would run it.

Limits

  • There is no timing. Timings mean nothing, and %clock and %globaltimer count instructions (a read of %globaltimer also costs 64 ns of it, so a busy-wait on it does not run out of steps). It is also much slower than a GPU.
  • CUDA programs must be built with nvcc -cudart shared. Static cudart (CuPy, for example) does not work.
  • Kernels run to completion inside the launch call, so an event recorded behind a kernel is complete at once (#523); cudaLaunchHostFunc and cuLaunchHostFunc are asynchronous (#487).
  • The v0.2.0 release has two bugs, both fixed in v0.2.1: shfl.sync returned 0 for a lane still in a long loop, with no error (#488), and a kernel could not read another simulated GPU's memory after cudaDeviceEnablePeerAccess (#598). Use v0.2.1 or later.
  • OptiX and NVIDIA's Nsight tools are not supported.
  • 31 of the 48 GPU profiles come from public documents, not from a card. The 17 that were read from one (14 NVIDIA, 3 AMD) are listed in status and limits; for NVIDIA parts the check is 512 values of two conformance programs diffed against the card.

See status and limits.

Quickstart

With Docker (no GPU or driver needed):

docker run --rm ghcr.io/pantheongpu/pantheonsim:latest vgpu list-gpus
docker run --rm -e VGPU_GPU=nvidia/h100 -e VGPU_DEVICE_COUNT=2 ghcr.io/pantheongpu/pantheonsim:latest nvidia-smi

The image has no nvcc or hipcc; see docs/docker.md to build a program in a container.

From source, on Linux (WSL works) with CMake and a C++20 compiler:

make     # builds (offers to install missing tools first)
./run    # starts a simulated GPU machine; type exit to leave

./run reads pantheonsim.yaml and writes one on the first run. make doctor lists missing tools. make demo runs a vectorAdd kernel on a simulated H100 and ends with PASS, make run APP=./my_app runs one program, and make test runs the tests. make help lists every target. To compile your own programs you need nvcc or hipcc installed (docs/toolchains.md).

Settings

build/vgpu list-gpus prints the GPU ids. Put settings in a file and run ./run my.yaml; pantheonsim.example.yaml is a sample. For example:

gpu: nvidia/h100
count: 8
strict: true   # refuse undefined behaviour, such as dividing by zero

All settings:

Key Values Default What it does
gpu an id from list-gpus, such as nvidia/h100 nvidia/h100 The GPU model to present
count 1 to 16 1 How many identical devices
vram_mb MiB, at least 1 the profile's own Memory per device
cuda_version major.minor, such as 13.0 this build's The CUDA version nvidia-smi and NVML report
driver_version such as 580.65.06 this build's The NVIDIA driver version reported
rocm_version such as 6.4.0 6.2.0 in the machine shell The ROCm version amd-smi version reports
os ubuntu, rocky or debian, with a version (ubuntu:24.04) ubuntu:22.04 The operating system the machine presents
ram_mb MiB, at least 1 unlimited Host RAM device memory may use before it spills to memory_dir
memory_dir a directory never spill Where device memory past ram_mb goes (runs at disk speed)
host_reserve_mb MiB, 0 or more 6% of the limit, 1 to 4 GiB Memory the guard leaves to the rest of your machine
host_guard true or false true false turns the host-memory guard off
threads 1 to 65536 one per core (half under make run and ./run) Host threads that run blocks
max_steps 0 or more built in Per-thread instruction budget against a kernel that never ends; 0 removes it
sass auto, off or only auto The engine for NVIDIA kernels: SASS when the binary has it, or force PTX, or insist on SASS
simd auto, base, avx2 or off auto Caps the vector instruction set; off is scalar code
scheduler deterministic, random or adversarial deterministic Warp scheduling order, to find order-dependent bugs (set sass: off with the last two)
scheduler_seed 0 or more 0 Seed for random and adversarial; the same seed replays the same run
hiprtc_cache disk, mem or off disk What is kept of AMD run-time compiles (hiprtc, done by ROCm's compiler): in memory and files, in memory, or nothing
strict true or false false Refuse undefined behaviour, such as integer division by zero
race off, on or all off Report unordered shared-memory access between warps
counters true or false false Print exact per-launch performance counters
quiet true or false false Silence every simulator message on stderr
trace true or false false Log every runtime and driver entry point

Each setting is described in docs/config.md. It also runs in a browser, in CI and in Docker.

How PantheonSim is developed

PantheonSim is developed by a small maintainer team. Most of its code, tests and documentation were written with AI coding assistants (Anthropic's Claude), directed and reviewed by the maintainers, and pull requests here have no second reviewer. What it is checked against, and what is not checked, is in CONTRIBUTING.md, "How PantheonSim is developed"; what does not work is in status and limits.

More

All docs, Getting started, the machine, commands, status and limits, architecture, contributing, governance, security, code of conduct. Questions go in Discussions, bugs in issues.

Apache-2.0. CUDA is a trademark of NVIDIA. This project is not affiliated with NVIDIA or AMD.

About

PantheonSim: GPU simulator for CUDA and ROCm. Run CUDA and HIP programs unmodified on a CPU, no GPU needed: simulated NVIDIA and AMD GPUs for development, teaching and CI.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

58 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Contributors

Languages