Evolve cosmic structure on GPUs
Evolve particles with GPU-resident CUDA TreePM and generate halo catalogs, merger trees and lightcones in the same engine.
- SWIFT · 256 CPU threads
- 796.4 s
- gravityCU · 4 × RTX A6000
- 17.5 s
Measured Benchmarks: GPU Engine vs. CPU SWIFT
Paper Figures & Benchmarks (7 Figures)
Validation records
Compare optimization modes, conservation checks, cross-code energy measurements and release validation.
256³ Optimization Progression (a = 0.855 → 0.920, 320 steps)
| Configuration | Evolution Time | vs. 256T CPU | Tree Time | Max Pδ(k) Dev |
|---|---|---|---|---|
| 256-Thread CPU SWIFT (native-092) | 796.4 s | 1.0× | — | Reference |
| 1× A6000 Initial Baseline | 126.8 s | 6.3× | — | 0.0006% |
| 1× A6000 12-Slab Pre-Opt | 87.2 s | 9.1× | 10.09 s | — |
| 1× A6000 + Opt1–3 (1D Full) | 52.4 s | 15.2× | 1.60 s | — |
| 1× A6000 + Opt4B (3D Hilbert) | 47.4 s | 16.8× | 1.30 s | — |
| 4× A6000 3D Hilbert Eager | 19.1 s | 41.8× | 1.82 s | 0.0011% |
| 4× A6000 Final Opt4B (3D Hilbert Full) | 17.5 s | 45.4× | 0.38 s | 0.0387% |
Conservation & Full-History Verification
| Physics Gate | Runtime / Steps | Energy Residual | Momentum Drift | Spectra / Halo Parity |
|---|---|---|---|---|
| 256³ Full History z=200→0 (4× A6000 3D) | 526.6 s · 9,257 steps | 0.0307% (L-I) | 3.72 × 10−5 | Pδ 0.123% · N≥10k: 89/89 |
| 256³ Late 0054→0056 (4× A6000 Eager) | 47.3 s · 914 steps | 0.0159% (L-I) | 2.34 × 10−5 | Pδ 0.066% · N≥300: 1944/1944 |
| 32K Isolated Plummer Sphere (t=0→4.0) | 2.59 s · 33 checks | 1.15 × 10−5 (|ΔE/E0|) | 6.38 × 10−6 | Virial 2T/|U| = 0.996–0.999 |
| 64³ Zel'dovich Plane Wave (EdS, a=0.02→0.50) | 6.71 s · 513 steps | Δx/L = 4.41 × 10−4 | Δv/vpk = 0.592% | Transverse vRMS = 0.070 km/s |
| Exact Periodic Ewald θ-Sweep (64³, 4,096 tgt) | θ = 0.9 → 0.3 | Short 8.48e-3 → 1.14e-4 | Tot 1.98e-3 @θ=0.7 | Tot 1.03e-3 @θ=0.3 (PM floor) |
| 4-GPU 3D vs 1-GPU 1D Step-0 Force | 16.78M particles | Pot med 8.88 × 10−6 | Face med 1.15 × 10−4 | Force med 1.03 × 10−4 |
Cross-Code Runtime, NVML Energy & Accuracy Comparison (256³, a = 0.855 → 0.920)
| Code & Hardware | Wall / Evo Time | Measured GPU Power / Wh | Modeled Node Wh | Pδ(k) Dev · HMF |
|---|---|---|---|---|
| PKDGRAV3 3.5.1 (1× A6000 · GPU FMM) | 2043.2 s / 1926.3 s | 67.9 W · 38.57 Wh | 106.68 Wh | 0.150% · 91/92, 17/17 |
| PKDGRAV3 3.5.1 (2× A6000 MPI) | 1333.2 s / 1223.6 s | 136.2 W · 50.45 Wh | 94.89 Wh | 0.150% · 91/92, 17/17 |
| GADGET-4 (128 EPYC cores · TreePM) | 883.2 s / 857.7 s | — | 110.70 Wh (700W: 171.7 Wh) | 0.187% · 92/92, 17/17 |
| CPU SWIFT (256T EPYC baseline) | 816.0 s / 796.4 s | — | 136.16 Wh (700W: 158.7 Wh) | Reference · 92, 17 |
| gravityCU 1× A6000 (3D Hilbert Lazy) | 58.09 s / 50.03 s | 241.3 W · 3.93 Wh | 5.86 Wh (23.2× savings) | 0.0387% · 92/92, 17/17 |
| gravityCU 2× A6000 (3D Hilbert Lazy) | 33.11 s / 28.66 s | 448.1 W · 4.17 Wh | 5.27 Wh (25.8× savings) | 0.0387% · 92/92, 17/17 |
| gravityCU 4× A6000 (3D Hilbert Eager) | 30.21 s / 21.07 s | 635.2 W · 5.38 Wh | 6.39 Wh (21.3× savings) | 0.00106% · 92/92, 17/17 |
| gravityCU 4× A6000 (3D Hilbert Lazy) | 28.26 s / 18.99 s | 662.7 W · 5.25 Wh | 6.19 Wh (22.0–25.6× savings) | 0.0387% · 92/92, 17/17 |
Note: Same a9 node (2× EPYC 9754 + RTX A6000) and matched accuracy settings (θ=0.70, ηG=0.025 / PKDGRAV3 dEta=0.2236). GPU energy is integrated from 200 ms nvidia-smi NVML telemetry; since unprivileged RAPL is unavailable on a9, CPU/host power is modeled transparently (utilization-scaled 120–800 W plus flat 700 W CPU reference). At 256³, PKDGRAV3 is dominated by 67 host domain decompositions (279–426 s) and 245 CPU tree builds (146–522 s), leaving average GPU utilization at 3–6%.
v2.0 Precision, Multi-Physics & Multi-Node MPI Gates RTX 4090 (b4/b6) · All Gates Verified
| Milestone / Module | Capabilities | Verified RTX 4090 Metrics | Status |
|---|---|---|---|
| P1 High-Order PM & ICs | CIC/TSC/PCS + Interlacing + -ik + monofonIC/MUSIC |
Ewald 5.58e-5 (18.5×), 2N MPI PM 3.89e-16 |
Passed |
| P2 High-Precision Mode | GRAV_PRECISION_MODE=high (rcut=5.5, exact erfc/exp, mac=1e-4) |
Ewald 1.014e-5 (102×) · Zel'dovich 0.0382% (14.5×) |
Passed |
| P3 Adaptive Symplectic | Dynamical τ_dyn + softening-crossing + GRAV_SYNC_STEP=1 |
32K Plummer energy drift 7.64e-7 (15.1×) |
Passed |
| B1 Massive Neutrinos | Zero-VRAM k-space linear response + Komatsu+2011 H(a) + CLASS/CAMB |
3-scale suppression vs. exact ODE 0.009%–0.028% |
Passed |
| B2 Dark Sector (SIDM + f(R)) | Race-free leaf GPU MC-SIDM + Hu–Sawicki n=1 f(R) chameleon |
SIDM 107k scatters (9.35e-12 ΔE) · f(R) 0.0001%–0.179% |
Passed |
| B3 Multi-Mass Zoom-in | 9-level 4096³-equiv + per-particle GRAV_SOFT_IN + audit |
16.78M× mass ratio · 0 LR in R200c/2R200c · 35 subhalos |
Passed |
| B4 Full-GPU Hydro + Cosmo | 3D Wendland C2 SPH + cooling + Schmidt SF + coupled PM+SPH | Sod 2.28% · Sedov 0.67% · K-H 516× · Cool 2.44e-15 · 221K box WHIM 23.3% |
8/8 Passed |
| Phase 2 Cross-Node MPI | True 2-node b[4,6] (2N×1G) 3D Hilbert grav_mpi |
64³ parity pos_rms/L = 2.59e-6 · 256³ (16.78M) zero-error |
Passed |
v3.0 Full Baryon Physics, Nonlinear f(R), Online Analysis & E1–E6 Architecture Colab Tesla T4 (CUDA 13.0) · 11/11 Gates Verified
| Milestone / Module | Capabilities | Verified Metrics (Tesla T4 / CUDA 13.0) | Status |
|---|---|---|---|
| v3.1 Plugins + CHIMES/PS20 | C-ABI dlopen PhysicsStage + 64×64 GPU metal cooling / UVB / self-shielding |
IGM equil 1.2e4 K · metal T_max 4.58× lower · stellar +2.05% · mass err 0.0 |
Passed |
| v3.2 Stochastic SN + Enrichment | Dalla Vecchia & Schaye (2012) 107.5 K + SNII/SNIa/AGB enrichment-coupled cooling |
SF regulation -32.2% · p99 density 3.46× lower · 1.77e7 K outflows · 5.82× Z boost |
Passed |
| v3.3 SMBH + Dual-Mode AGN | Race-free atomicCAS seeding + Eddington Bondi accretion + quasar / radio jet |
17 SMBHs 11.07× · total SF quench -48.7% · CGM 2.51e7 K · ΔM 6.59e-10 |
Passed |
| v3.4 Nonlinear f(R) Multigrid | 4-level 3D GPU Red–Black Newton–GS FAS solver with Oyaizu expm1 |
F6 δ=2000 residual 2.23e-16 · Chameleon 42,845× · 7-digit Yukawa match |
Passed |
| v3.5 GPU 6D Subhalos + tSZ/X-ray | ROCKSTAR-style 6D phase-space union-find + 256×256 Compton-y / X-ray projection |
32.49 ms overlap de-blending (500/500) · 2.02 ms map flux err ≤ 4.23e-15 |
Passed |
| v3.6 (E4) Zero-Dep + CUDA 13.0 | MIT native grav_fmm_native.cuh (Dehnen C2 + erfc + 4th-order FMM) + Thrust |
Zero KERNEL_BUILD_DIR make engine && make smoke passed (2.237 s, 16 halos) |
Passed |
| v3.7 (E5) FP64 Short-Range P2P | iact_grav_pp_truncated_fp64 wired into GRAV_PRECISION_MODE=high |
Exact 3D Ewald median err 4.29e-7 (2.60× over FP32) · 512 steps bad=0 |
Passed |
| v3.8 (E1) GPU LET Wire Pruning | GPU parallel BFS Locally Essential Tree + 152 B wire packet + remote M2P |
64³ 0.40 ms prune · 4.38× wire compression · remote force median 2.31e-3 |
Passed |
| v3.9 (E2) 32-Bit Compact Coords | 3×32-bit periodic fixed-point coords + mass in 16 B uint4 + branchless diff |
VRAM 2.50× smaller · quant 1.16e-8 Mpc · P2P err 7.60e-9 (186× vs FP32) |
Passed |
| v3.10 (E3) Unified Engine Core | GravSimulationEngine / GravDomainBackend + multi_gpu_slab GRAV_PLUGINS |
3-backend parity 0.00e+00 · drift 2.71e-7 · live 64³ run 2.34 s (65/65 hooks) |
Passed |
| v3.11 (E6) Async Delta + HDF5 I/O | GCKP + FNV-1a + atomic rename + async thread + optional -DGRAV_ENABLE_HDF5 |
100K delta ratio 8.571× · submit 7.47 ms · 0 bit errors · h5py verified |
Passed |
Reproduce the benchmarks
Run the domain, halo and engine smoke tests, then render the comparison figures.
make standalone test-domain3d && make test-fof
make engine && make smoke
python3 scripts/make_opt_comparison_figures.py && python3 scripts/make_code_energy_figure.py
Start with the 16³ CUDA example
The CU-Suite ecosystem
- CU-SuiteTop-level orchestrator, unified TOML schema & Spec C baryon calibration loop.
- CosmoCUC++20 Einstein–Boltzmann spectra, HMcode/BCM & 10D forward-mode AD.
- ICULow-VRAM GPU/CPU/MPI 1LPT/2LPT/3LPT initial conditions with in-situ device handoff.
- 21cmCUNative C/CUDA + cuFFT 21cm reionization & Bayesian inference engine.
- ObsCUDecoupled forward modeling (weak lensing, HOD/SHAM galaxies, Lyα, tSZ/kSZ & SBI).