dustpy-gpu is a GPU-enabled fork of DustPy, a Python package for simulating gas and dust evolution in protoplanetary disks.
Designed as a drop-in replacement, it retains the upstream dustpy import name and original API, so migrating existing scripts requires minimal changes (mainly backend selection, see below).
To avoid package conflicts, please install this drop-in replacement in a fresh virtual environment:
python -m venv .venv && source .venv/bin/activate
python -m pip install --upgrade pip
# For GPU runs: Install CuPy matching your CUDA version (e.g., CUDA 13)
python -m pip install cupy-cuda13x
# Install dustpy-gpu (automatically installs the required simframe-gpu fork)
# Alternatively: python -m pip install dustpy-gpu
python -m pip install git+https://github.com/astroboylrx/dustpy-gpu.gitSelect your backend when initializing a simulation:
import dustpy
sim_cpu = dustpy.Simulation(backend="numpy") # Default (preserves upstream behavior)
sim_gpu = dustpy.Simulation(backend="cupy")
sim_auto = dustpy.Simulation(backend="auto") # Uses CuPy if available, else NumPyWhen using the cupy backend, remember to convert CuPy arrays back to NumPy with cupy.asnumpy() for plotting or analysis. For those new to CuPy, we recommend checking out the Basics of CuPy.
Multiple backends can be used together in a single script if run sequentially, but concurrent execution is not supported due to process-global bindings.
The DustPy-GPU documentation covers installation, backend behavior, GPU-adapted examples, numerical parity, and performance. Refer to the upstream DustPy documentation for the complete physics and standard API reference.
Users should expect numerical and scientific parity, though not strictly identical arrays across long or repeated GPU runs.
- NumPy Backend: Reproduces upstream
DustPyresults bitwise. - CuPy Backend: Agrees with NumPy to strict FP64 tolerances initially. Long-run differences remain quite small and non-accumulating. Official examples (ice lines, planetary gaps, planetesimal formation, etc.) are visually indistinguishable.
- GPU Determinism: CuPy runs are not bitwise deterministic. The use of an iterative solver (sparse GMRES) — necessitated because CuPy's direct sparse solver API currently falls back to the CPU — combined with parallel GPU accumulation, can produce tiny run-to-run differences.
For detailed comparisons and performance results, see the backend parity and performance documentation. Modern HPC GPUs can deliver >10x speedups for typical research workloads (e.g., 14x at Nr=200 and 25x at Nr=300 in our benchmarks).
Please cite Stammler & Birnstiel (2022) for DustPy and Li & Chiang (2026) for DustPy-GPU.