Skip to content
HainaHuang729Public

About

gravityCU: Multi-GPU VRAM-Resident CUDA TreePM & Full-GPU FoF Cosmological N-Body Engine (up to 1024^3 particles)

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

gravityCU: Multi-GPU VRAM-Resident CUDA TreePM + Full-GPU FoF Engine

Documentation · Function Wiki · Basic examples

License: MIT Roadmap Wiki & Tutorials

gravityCU is a multi-GPU CUDA TreePM cosmological gravity, lightcone, and Full-GPU Friends-of-Friends (FoF / Catalog / Spherical Overdensity) solver designed to evolve from $64^3$ smoke tests up to $1024^3$ (1,073,741,824) particles 100% resident inside GPU VRAM (4× NVIDIA RTX A6000, 4 × 48 GiB) without host-device swapping.


Architecture Highlights (Priorities 1–5)

  1. Lazy Tree & Async Device Pipeline: GRAV_LAZY_TREE=1 refits persistent octree nodes across active sub-steps (256^3: tree time 9.96 s → 1.58 s), paired with asynchronous host lightcone writes and CUB migrant compaction.
  2. Split-Force Kernel Decomposition (GRAV_SPLIT_FORCE=1): Separates tree traversal, M2P tensor accumulation, grouped M2L, and warp-tiled P2P into distinct low-register, zero-spill kernels (0 stack frame, 0 spill).
  3. Pure-CUDA Distributed PM (GRAV_PM_DIST=1): Multi-GPU distributed FFT long-range Poisson solver (cudaMalloc / can_peer P2P + pinned bounce staging, zero NCCL dependency).
  4. 3D 12×12×12 Top-Cell Domain Decomposition (GRAV_DOMAIN_MODE=auto): Hilbert (3d_hilbert, default when GRAV_NUM_GPUS > 1) and ORB (3d_orb) topological partitioning with NVLink owner remapping, interior-first slot layout, full-duplex chunked ghost exchange, dynamic rebalancing, and compute/communication overlap (256^3, 4× RTX A6000: 17.525 s total / 15.729 s compute+PM without export I/O, 2.99× vs. 1× GPU 52.443 s).
  5. Full-GPU FoF / Catalog / SO & Multi-GPU FoF (src/grav_cuda_fof.cu):
    • Single-GPU zero-upload whole_fof_device and multi-GPU arbitrary-3D-domain whole_fof_multigpu (called directly by the 3D engine on resident d_x buffers).
    • Full-GPU whole_fof_slabbed cross-slab GPU Union-Find merge & CUB relabeling (0 ID mismatches out of 16.78M particles across S=4/8 and G=1/2/4 3D decompositions).
    • Full-GPU compute_fof_catalog (12.48× vs. CPU, max_rel <= 1.16e-13) and GPU segmented-sort compute_fof_so (M200c/R200c, M200m/R200m, 15.33× uniform / 5.37× non-uniform vs. 8-thread OpenMP CPU, max_rel <= 3.67e-15), exposed through an unchanged C ABI (ctypes-compatible with scripts/to-hdf5-from-source.py).

Verified $1024^3$ Scientific Fidelity (4× RTX A6000 vs. 256-Core CPU SWIFT)

  • Late-time ($z = 0.063 \to 0$): 4,388.62 s (73m 09s) on dual-NVLink 4× RTX A6000 — 2.40× vs. 1× A6000 (10,540.44 s) and 7.26× vs. 256-core CPU (31,878.77 s).
  • Mid-redshift ($z = 2.033 \to 1.758$): 3,510.98 s (58m 31s idle node) — 9.27× vs. 256-core CPU (9.64× incl. dump step).
  • Matter Power Spectrum $P_\delta(k)$: 0.00453% max deviation at $z=0$ and 0.01019% at $z=1.758$.
  • Full-History Projection ($z = 200 \to 0$): 34.6–35.8 h pure evolution (8.50–8.80× speedup) and ~86% whole-node energy reduction (28.3–29.2 kWh vs. 213.1 kWh).

Speed & Accuracy vs. CPU SWIFT

Benchmark / Subsystem CPU Reference Optimized GPU (Opt1–5) Speedup Accuracy vs. CPU / Reference
$256^3$ Evolution ($a=0.855\to0.92$, 320 steps) 796.36 s (256T CPU SWIFT) 17.53 s (4× A6000 3D Hilbert) 45.4× (50.6× no-IO) $P_\delta(k)$ max 0.0011% (eager) / 0.0387% (lazy), $\min r &gt; 0.99999993$
$1024^3$ Evolution ($z=2.03\to1.76$, 910 steps) 32,538 s (256c CHPC CPU) 3,511 s (4× A6000 NVLink) 9.27× $P_\delta(k)$ max 0.01019%, $P_\theta(k)$ max 0.01112%
$1024^3$ Evolution ($z=0.06\to0$, 513 steps) 31,879 s (256c CHPC CPU) 4,389 s (4× A6000 NVLink) 7.26× $P_\delta(k)$ max 0.00453%, aligned $P_\theta(k)$ max 0.0405%
$1024^3$ Full Cosmic History ($z=200\to0$) 304.48 h / 213.1 kWh 34.6–35.8 h / 28.3–29.2 kWh 8.50–8.80× Energy reduced by ~86%
FoF Catalog / SO ($256^3$, $15{,}206$ halos) 0.835 s Cat / 1.908 s SO (8T) 0.0669 s Cat / 0.1245 s SO 12.48× / 15.33× Catalog <= 1.16e-13, SO <= 3.67e-15, FoF 0 mismatches

Speedup vs CPU

Accuracy vs CPU


Cross-Code Runtime, Energy Cost & Accuracy ($256^3$, $a = 0.855 \to 0.92$)

All codes below were benchmarked on the same phy-gpus node a9 (2× AMD EPYC 9754 256 cores, 5× NVIDIA RTX A6000) from the exact same 16,777,216-particle L = 25 Mpc/h snapshot with matched opening angle ($\theta = 0.70$), comoving softening ($\epsilon = 0.001953125\ \text{Mpc}/h$), and timestep factor ($\eta_G = 0.025$ / PKDGRAV3 dEta = 0.2236068). GPU power is directly measured via 200 ms nvidia-smi NVML polling; because a9 lacks unprivileged RAPL powercap, host/CPU energy is reported transparently as modeled whole-node power (+120 W base host for GPU runs; utilization-scaled 120–800 W and flat 700 W reference for dual-socket EPYC CPU runs). Full telemetry is saved in reports/code-energy-comparison.json.

Code & Configuration Wall / Evo Time Throughput (M/s) Measured GPU (Wh) Whole-Node (Wh) J / M-step (GPU / Node) Max $P_\delta(k)$ & HMF
PKDGRAV3 3.5.1 (1× A6000, -np 1 -sz 16) 2043.2 s / 1926.3 s 0.252 (0.252/GPU) 38.57 (67.9 W) 106.68 285.9 / 790.8 0.150% (91/92, 17/17)
PKDGRAV3 3.5.1 (2× A6000 MPI, -np 2 -sz 16) 1333.2 s / 1223.6 s 0.397 (0.198/GPU) 50.45 (136.2 W) 94.89 374.0 / 703.4 0.150% (91/92, 17/17)
GADGET-4 (128 EPYC cores MPI TreePM) 883.2 s / 857.7 s 1.206 — 110.70 (700W: 171.7) — / 385.3 (597.8) 0.187% (92/92, 17/17)
CPU SWIFT (256T EPYC FMM+PM baseline) 816.0 s / 796.4 s 1.184 — 136.16 (700W: 158.7) — / 519.9 (605.9) Reference (92, 17)
gravityCU 1× A6000 (3D Hilbert Lazy) 58.09 s / 50.03 s 18.84 (18.84/GPU) 3.93 (241.3 W) 5.86 (23.2×) 15.01 / 22.40 0.0387% (92/92, 17/17)
gravityCU 2× A6000 (3D Hilbert Lazy) 33.11 s / 28.66 s 32.88 (16.44/GPU) 4.17 (448.1 W) 5.27 (25.8×) 15.93 / 20.15 0.0387% (92/92, 17/17)
gravityCU 4× A6000 (3D Hilbert Eager) 30.21 s / 21.07 s 44.74 (11.19/GPU) 5.38 (635.2 W) 6.39 (21.3×) 20.54 / 24.39 0.00106% (92/92, 17/17)
gravityCU 4× A6000 (3D Hilbert Lazy) 28.26 s / 18.99 s 49.62 (12.41/GPU) 5.25 (662.7 W) 6.19 (22.0–25.6×) 20.05 / 23.64 0.0387% (92/92, 17/17)

Why PKDGRAV3 spends more wall time than gravityCU at $256^3$: PKDGRAV3 offloads FMM+Ewald gravity tiles to GPUs while rebuilding domain decompositions (67×, 425.95 s on 1G / 278.91 s on 2G-MPI) and CPU trees (245×, 522.19 s / 145.87 s) on host threads across 244 adaptive substeps (3.3–5.6% mean GPU utilization). Keeping all 16.78M particles GPU-resident with TreePM + lazy Hilbert octree refits (42.7–73.6% GPU utilization) yields 29× faster wall time and 18–26× lower whole-node energy. On $1024^3$ full-history ($z=200\to0$), live 4× A6000 power measures 657.1–735.9 W, reducing full-run node energy from 213.1 kWh to 28.3–29.5 kWh (-86%).

Cross-Code Runtime, Energy & Accuracy

To regenerate all CPU-vs-GPU and cross-code comparison figures from reports/:

python3 scripts/make_opt_comparison_figures.py
python3 scripts/make_code_energy_figure.py
python3 scripts/make_figures.py

Documentation & Tutorials (Wiki)

Full step-by-step guides live in docs/README.md and are mirrored on the GitHub Wiki:


Quick Start

Prerequisites

  • CUDA Toolkit >= 12.x (tested on CUDA 12.6 & 13.0) (nvcc + libcufft), g++ (C++17 + OpenMP), make, and Python 3 with numpy (+ h5py for HDF5 conversion).
  • 100% Zero External Dependencies (v3.6 / E4): All targets (make engine, make smoke, make pm, make pm-mpi, make fof, make hydro, make cosmo-hydro, make plugins) now build completely standalone using the MIT-licensed native FMM/softening header src/grav_fmm_native.cuh with no KERNEL_BUILD_DIR required (passing KERNEL_BUILD_DIR=/path/to/swiftsim remains supported as an optional override).

Option A: Zero-Dependency Standalone Build & FoF GPU Smoke Test

# 1. Build standalone FoF shared lib & C99 CIC helper + run CPU 3D-domain unit test
make standalone test-domain3d

# 2. Run synthetic 200K-particle GPU FoF + Catalog + SO ctypes verification
make test-fof

Expected output: DOMAIN3D_SMOKE_PASSED and FOF_SMOKE_PASSED.

Option B: Full Gravity Engine Build & Synthetic $64^3$ Multi-GPU Smoke Run

# Override CUDA_ARCH (default sm_86), CUDA_HOME (auto-detected), CXX (default g++) if needed
make engine KERNEL_BUILD_DIR=/path/to/swiftsim CUDA_ARCH=sm_86 CXX=g++
make smoke  KERNEL_BUILD_DIR=/path/to/swiftsim CUDA_ARCH=sm_86 CXX=g++

This generates build/smoke_64.bin (64^3 clustered periodic box), evolves a = 0.85 -> 0.92 on all visible GPUs using 3d_hilbert (or 1d_slab on 1 GPU) with inline multi-GPU FoF, and runs compute_fof_catalog + compute_fof_so via build/grav_cuda_fof.so, printing ALL_SMOKE_TESTS_PASSED.

Option C: SWIFT, monofonIC, or MUSIC HDF5 IC Workflow

# 1. Convert SWIFT / monofonIC / MUSIC / Gadget HDF5 (single or multi-shard) into dense binary
#    Auto-converts kpc/h & Mpc/h -> Mpc, Gadget u=v/sqrt(a) -> v_pec, MassTable fallback, Zoom-in PartTypes
python3 scripts/prepare_input.py input_snap.hdf5 input.bin --cosmo-env input.cosmo.env

# 2. Run multi-GPU VRAM-resident TreePM + inline FoF to final scale factor a_end=1.0
source input.cosmo.env
GRAV_NUM_GPUS=4 GRAV_DOMAIN_MODE=auto GRAV_DYNAMIC_PM=1 GRAV_PM_DIST=1 \
GRAV_SPLIT_FORCE=1 GRAV_LAZY_TREE=1 GRAV_P2P_MODE=nvlink \
GRAV_RUN_FOF=1 GRAV_FOF_LINK_RATIO=0.2 GRAV_FOF_MIN_SIZE=32 \
  ./build/multi_gpu_slab input.bin evolved.bin 1.0

# 3. Export SWIFT HDF5 snapshot + Full-GPU FOFGroups (CentresOfMass, M200c/R200c, M200m/R200m)
python3 scripts/to-hdf5-from-source.py input_snap.hdf5 evolved.bin output_snap.hdf5 \
  --fof-bin evolved.bin.fof.bin --fof-lib build/grav_cuda_fof.so

Ready-to-use monofonIC (2LPT/3LPT) and MUSIC (Zoom-in multi-mass) templates live in configs/ic/, verified via make test-ic. Note: prepare_input.py works for any $N$ (64^3–1024^3); scripts/prepare_1024_input.py is kept specifically for reproducing the original $1024^3$ scripts.


Runtime Configuration (--config INI File or GRAV_* Env Vars)

All drivers (multi_gpu_slab, grav_mpi, grav_hydro, grav_cosmo_hydro) accept a clean INI/TOML-style parameter file via --config configs/run_example.ini (or GRAV_CONFIG=...); explicit GRAV_* environment variables always override file values for effortless Slurm sweeps.

Variable Default Description & Notes
GRAV_NUM_GPUS all visible GPUs Number of GPUs (1..12, up to visible CUDA devices)
GRAV_DOMAIN_MODE auto auto selects 3d_hilbert when G > 1 (1d_slab when G = 1); also accepts 1d_slab, 3d_hilbert, 3d_orb
GRAV_P2P_MODE nvlink nvlink (recommended on EPYC multi-root PCIe to avoid cross-root NODE P2P stalls), all, or off
GRAV_DYNAMIC_PM unset (0) Set GRAV_DYNAMIC_PM=1 for periodic cosmological PM step scaling (16 PM intervals)
GRAV_PM_DIST 1 (when G > 1) Distributed multi-GPU FFT PM solver (0 disables)
GRAV_PM_GRID 128 PM FFT grid size (power of 2 in 32..1024)
GRAV_PM_ORDER 2 (cic) PM mass-assignment / interpolation order: 2 (cic), 3 (tsc), or 4 (pcs) with matched $\text{sinc}^{-2p}$ deconvolution
GRAV_PM_INTERLACE 0 Set 1 for symmetric half-cell interlaced PM (cancels odd aliases while preserving zero self-force & momentum conservation)
GRAV_PM_GRAD fd4 PM force gradient operator: fd4 (4th-order finite difference, SWIFT default) or ik (exact $-i\mathbf{k}$ spectral gradient)
GRAV_PM_ASMTH 1.25 TreePM split scale ratio $r_s/\Delta x$ (default 1.25 matches SWIFT; also scales short-range cutoff GRAV_PM_RCUT * r_s)
GRAV_PM_RCUT 4.5 (5.5 in high) Short-range TreePM cutoff ratio $r_{\rm cut}/r_s$ (default 4.5; 5.5 under GRAV_PRECISION_MODE=high)
GRAV_PRECISION_MODE standard Set high to enable high-precision gravity (PCS + Interlacing + -ik, rcut=5.5, exact erfc/exp, mac=1e-4, theta=0.25, no lazy tree; achieves 1.01e-5 Ewald median force error and 0.038% Zel'dovich RMS)
GRAV_NU_MASS_EV 0.0 Total neutrino mass $\sum m_\nu$ in eV (> 0 activates $k$-space linear-response neutrino boost $W_\nu(k,a)$ & Komatsu+2011 Fermi–Dirac background $H(a)$ with zero extra VRAM)
GRAV_NU_NSPECIES 3 Number of degenerate massive neutrino species when GRAV_NU_MASS_EV > 0
GRAV_NU_TABLE unset Optional 2D (a, k [1/Mpc], R_nu) ASCII/CSV transfer table from CLASS/CAMB (resampled to 256 log-$k$ GPU bins per step)
GRAV_TIDAL_TIMESTEP / GRAV_SYNC_STEP 0 (1 in high) / 0 P3 dynamical/tidal + softening-crossing timestepping (GRAV_TIDAL_ETA=0.05, GRAV_VEL_ETA=0.25) and synchronous global-rung symplectic mode (7.64e-7 Plummer drift)
GRAV_SIDM_SIGMA_M / GRAV_SIDM_W0 0.0 / 0.0 B2-a GPU-native octree-leaf MC-SIDM elastic cross section $\sigma_0/m$ ($\text{cm}^2/\text{g}$, or GRAV_SIDM_SIGMA_INTERNAL in code units) and optional velocity scale $w_0$ (km/s), search radius GRAV_SIDM_HS
GRAV_FR0 / GRAV_FR_SCREENING 0.0 / 1 B2-b Hu–Sawicki $n=1$ $f(R)$ modified gravity amplitude $
GRAV_SPLIT_FORCE 1 (periodic) Split traversal / M2P / M2L / P2P kernels (required for 3D domain modes)
GRAV_LAZY_TREE 1 (periodic) Lazy node refit across active sub-steps
GRAV_REBALANCE_INTERVAL 8 Rebalance cadence in steps for 3D domains (0 disables live rebalancing)
GRAV_REBALANCE_MIN_GAIN 0.02 Minimum predicted imbalance improvement to commit rebalance
GRAV_RUN_FOF 0 Set 1 to compute inline FoF (*.fof.bin) at snapshot/final outputs via whole_fof_multigpu
GRAV_ENERGY_LOG 0 Set 1 to log per-PM-step kinetic/potential energy ($T, U, E$), momentum ($\mathbf{P}, \mathbf{L}$), and Layzer–Irvine checks
GRAV_FOF_LINK_RATIO / _MIN_SIZE 0.2 / 32 Linking length ratio $b$ (in mean interparticle spacing) and minimum halo size; set GRAV_FOF_LINK_MPC to override linking length directly in Mpc for multi-mass Zoom-in runs
GRAV_SOFT_IN unset Path to per-particle float32 Plummer softening file (*.soft.bin, N floats) for multi-mass Zoom-in runs (scripts/zoomin_pipeline.py)
GRAV_G 43.0092 Gravitational constant in internal units (Mpc, 10^10 Msun, km/s)
GRAV_COSMO_H0 / OMEGA_M / OMEGA_DE 67.36 / 0.3153 / 0.6847 Cosmological parameters

Slurm Templates

Ready-to-customize Slurm scripts live in slurm/:

All templates read KERNEL_BUILD_DIR, DATA_DIR, CUDA_HOME, CXX_BIN, and PYTHON_BIN from environment variables (with no hardcoded user home paths).


Repository Structure

gravityCU/
├── Makefile                       # Turnkey build & smoke targets (fof, pm, pm-mpi, engine, mpi-engine, smoke)
├── ROADMAP.md                     # Precision (P1-P3), Physics Breadth (B1-B4) & Deferred Exascale schedule
├── src/
│   ├── multi_gpu_slab.cu          # Multi-GPU TreePM driver (1d_slab + 3D domain + optional MPI modes)
│   ├── slab_resident.cu           # Single-GPU 12-slab baseline driver
│   ├── grouped_force.cuh          # Morton tile grouped M2L/P2P force evaluation helpers
│   ├── grav_domain_3d.h           # 12×12×12 Hilbert / ORB partitioner & NVLink owner remapping
│   ├── grav_domain_3d_engine.cuh  # Single-node 3D domain execution engine & overlap pipeline
│   ├── grav_domain_3d_mpi.cuh     # Multi-node MPI 3D domain execution engine (compiled cleanly)
│   ├── grav_mpi_comm.h            # MPI wrapper utilities & node topology helpers
│   ├── grav_cuda_pm.cu/h          # Single-GPU cuFFT particle-mesh solver (CIC/TSC/PCS + Interlace + -ik)
│   ├── grav_cuda_pm_dist.cu/h     # Pure-CUDA single-node distributed FFT PM solver
│   ├── grav_cuda_pm_mpi.cu/h      # Multi-node MPI 1D-slab cuFFT + Alltoallv PM solver
│   ├── grav_pm_config.cuh         # Runtime PM order, interlacing, spectral gradient & high-precision config
│   ├── grav_neutrino.cuh          # B1 k-space linear-response massive neutrinos + Komatsu+2011 H(a)
│   ├── grav_timestep_p3.cuh       # P3 dynamical/tidal & softening-crossing timestep + sync symplectic mode
│   ├── grav_sidm.cuh              # B2-a GPU-native octree-leaf warp round-robin MC-SIDM scattering
│   ├── grav_fr_gravity.cuh        # B2-b Hu-Sawicki n=1 f(R) modified gravity + chameleon screening
│   ├── grav_cuda_hydro.cu/h       # B4 Full-GPU 3D Wendland C2 SPH + cooling + coupled self-gravity
│   ├── grav_hydro_driver.cu       # Standalone CLI driver (build/grav_hydro) for B4 hydro benchmarks
│   ├── grav_treepm_hydro.cuh      # Coupled all-species GPU TreePM short-range gravity & 3D Hilbert hydro partitioner (v4.3)
│   ├── grav_cosmo_hydro.cu        # Coupled comoving TreePM + GPU SPH + CHIMES/SN/AGN + GravSimulationEngine (build/grav_cosmo_hydro)
│   ├── grav_cuda_fof.cu/h         # Full-GPU FoF, slab merge, multi-GPU FoF, Catalog & SO solvers
│   ├── make-evolution.py          # Instrumented GPU octree & M2P/M2L code generator
│   └── cic_deposit.c              # Deterministic C99 CIC grid deposition helper
├── tree/                          # Project-owned octree builder sources (used by make-evolution.py)
├── m2p/                           # Project-owned M2P kernel port helpers (used by make-port.py)
├── scripts/
│   ├── prepare_input.py           # General SWIFT HDF5 -> dense binary IC/snapshot converter
│   ├── prepare_1024_input.py      # Legacy 1024^3 converter for archival scripts
│   ├── make_smoke_ic.py           # Synthetic clustered periodic DM IC generator (numpy-only)
│   ├── make_plummer_ic.py         # Equilibrium isolated Plummer sphere IC generator (energy/virial gate)
│   ├── zeldovich_benchmark.py     # 1D EdS Zel'dovich plane-wave generator & analytical verifier
│   ├── smoke_fof.py               # Standalone ctypes FoF + Catalog + SO parity smoke test
│   ├── verify_smoke_e2e.py        # End-to-end smoke output & SO verifier
│   ├── test_domain3d_smoke.cpp    # Standalone C++17 3D domain decomposition & MultiNodeCommStats unit test
│   ├── test_mpi_pm.cu             # Multi-node MPI PM FFT parity & latency benchmark
│   ├── test_pm_precision.cu       # Gate P1 PM self-force, Newton 3rd law & 3D wave accuracy tests
│   ├── test_ic_adapters.py        # monofonIC / MUSIC / SWIFT IC adapter unit tests
│   ├── test_neutrino_b1.cpp       # Gate B1 Fermi-Dirac background & k-space response unit test
│   ├── test_p3_b2.cpp             # Gate P3 timestep & Gate B2 f(R) / MC-SIDM unit test
│   ├── zoomin_pipeline.py         # Gate B3 multi-mass zoom-in IC generator & contamination/subhalo auditor
│   ├── hydro_benchmarks.py        # Gate B4 Sod, Sedov-Taylor, K-H, cooling & Santa Barbara verification suite
│   ├── to-hdf5-from-source.py     # Dense .bin + .fof.bin -> SWIFT HDF5 + FOFGroups exporter
│   ├── eval_1024_snapshot.py      # P(k), P_theta(k), halo mass function & kick-alignment analyzer
│   ├── model_1024_full_history.py # Full-history z=200->0 scaling & energy model
│   ├── make_figures.py            # Manuscript figure generator (fig1-fig4)
│   ├── make_opt_comparison_figures.py # CPU-vs-GPU speed & accuracy comparison plots (fig5-fig6)
│   └── make_code_energy_figure.py # Cross-code runtime, NVML energy & accuracy plot (fig7)
├── slurm/                         # Parameterized Slurm job templates (incl. mpi-multinode-test.sbatch)
├── reports/                       # Verified opt12..opt5, code-energy, analytical gates & mpi-multinode-bench JSONs
├── paper/                         # Physical Review D (revtex4-2) manuscript, BibTeX & figures
└── index.html / en.html           # Interactive bilingual benchmark & accuracy showcase pages

Roadmap

For the full 18-week schedule, acceptance gates, and compute/storage tiers, see ROADMAP.md.

Completed (DMO Gravity + FoF Pipeline)

  • Lazy octree refit, async lightcone host writes, and CUB migrant compaction
  • Split traversal / M2P / M2L / P2P zero-spill kernels (GRAV_SPLIT_FORCE=1)
  • Pure-CUDA distributed multi-GPU FFT PM solver (GRAV_PM_DIST=1)
  • 3D 12×12×12 Hilbert/ORB domain decomposition, dynamic rebalancing, and compute/communication overlap
  • Full-GPU FoF, cross-slab GPU merge, multi-GPU 3D inline FoF, Catalog, and SO (M200c/R200c, M200m/R200m)
  • Pre-MPI & analytical physics gates (reports/pre-mpi-physics-gate.json, reports/analytical-physics-gates.json): 1D EdS Zel'dovich collapse ($64^3$, $a=0.02\to0.50$: $\Delta x_{\rm RMS}/L = 4.41\times 10^{-4}$, $\Delta v_{\rm RMS}/v_{\rm pk} = 0.592%$), exact periodic Ewald $\theta$-convergence (short median $8.48\times 10^{-3} \to 1.14\times 10^{-4}$ across $\theta \in [0.9, 0.3]$; total median $1.98\times 10^{-3}$ at $\theta=0.7$), Layzer–Irvine energy (3.07e-4) & momentum (3.72e-5) across $z=200\to0$ ($526.6\text{ s}$, $9{,}257$ steps, $0.123%$ $P_\delta(k)$, $18/18$ massive halos), 32K Plummer virial/energy (1.15e-5), and 4-GPU boundary force parity (1.03e-4 median)

In Progress (Phase 2 Multi-Node MPI Close-Out — reports/mpi-multinode-bench.json)

  • Milestone 2A: 3D domain MPI topology & contiguous Hilbert MultiNodeCommStats (DOMAIN3D_SMOKE_PASSED)
  • Milestone 2B (np=2): MPI 1D-slab cuFFT PM verified on phy-gpus (b4, RTX 4090, np=2, side=128, N=64^3: max_rel_field=1.012e-14, max_rel_pot=3.177e-16, pm_comm_ms=90.875, MPI_PM_PASSED)
  • Milestone 2C (Build): test_mpi_pm, grav_mpi, and multi_gpu_slab compiled cleanly on phy-gpus (sm_89, OpenMPI 4.1.6 + CUDA 12.6)
  • Gates M1/M2/M3 (2N×1G on b[4,6]): Verified true cross-node MPI PM (3.89e-16, Slurm 492167), $64^3$ 2-node 3D Hilbert evolution parity vs. 1G (pos_rms/L = 2.59e-6, identical 257-step schedule, Slurm 492195), and $256^3$ (16.78M) 2-node zero-error completion (54.27 s, Slurm 492195).

Completed Priority Tracks (1–4× Lab GPUs, P1–P3 + B1–B4 All Verified on RTX 4090)

  • P1 — High-Order PM & External IC Adapters (reports/p1-pm-precision-gate.json): CIC/TSC/PCS + symmetric Interlacing + -ik spectral gradient across all 3 PM backends + monofonIC/MUSIC adapter (IC_ADAPTER_TESTS_PASSED). Ewald total-force error ($\theta=0.3$) reduced 18.5× (1.034e-3 -> 5.58e-5); 2-node cross-machine MPI PM (b[4,6]) verified to 3.89e-16.
  • P2 — High-Precision Gravity Mode (reports/b1-p2-gate.json): GRAV_PRECISION_MODE=high (PCS+Interlace+ik, rcut=5.5, exact erfc/exp, mac=1e-4) pushes Ewald total-force median error to 1.014e-5 (102× vs. baseline) and $64^3$ Zel'dovich displacement RMS to 0.0382% (14.5× vs. baseline).
  • P3 — Adaptive Tidal/Dynamical Timestep & Symplectic Sync (reports/p3-b2-gate.json): 32K isolated Plummer sphere energy drift reduced 15.1× (1.15e-5 -> 7.64e-7, beating < 1e-6).
  • B1 — $k$-Space Massive Neutrinos (reports/b1-p2-gate.json): Zero-VRAM-overhead $W_\nu(k,a)$ + Komatsu+2011 $H(a)$ + CLASS/CAMB table loader; 3-scale suppression ($\sum m_\nu=0.30\text{ eV}$) matches exact linear ODE to 0.009%–0.028%.
  • B2 — GPU MC-SIDM & $f(R)$ Modified Gravity (reports/p3-b2-gate.json): Race-free warp round-robin leaf MC-SIDM (107,365 scatters in 25 s, 9.35e-12 kinetic conservation, gravothermal core collapse +29.0% density) and Hu–Sawicki $n=1$ $f(R)$ F4 (0.0001% / 0.179% vs. exact ODE).
  • B3 — Multi-Mass Zoom-in Pipeline (reports/b3-zoomin-gate.json): 9-level 4096^3-equivalent Zoom-in (1.16M particles, 16,777,216× mass ratio, 0.61 kpc softening) with 0 LR contamination inside $R_{200c}$ and $2,R_{200c}$, 35 GPU-FoF subhalos, and 1.20% $R_{200c}$ convergence vs. 2048^3.
  • B4 — Full-GPU 3D SPH Hydrodynamics & Cooling (reports/b4-hydro-gate.json, reports/cosmo-hydro-gate.json): 5/5 isolated/periodic hydro benchmarks passed on RTX 4090 — 3D Sod (2.28% $\rho$ L1, 0.089% $\Delta E$), $48^3$ Sedov–Taylor (0.67% shock radius), Kelvin–Helmholtz (516.1× $E_{k,y}$ growth), GPU radiative cooling (2.44e-15 energy budget), and Santa Barbara cluster (13.96× monotonic entropy rise, 0.98% $\Delta E$); plus coupled comoving cosmological PM+SPH (build/grav_cosmo_hydro) verified on exact Hubble adiabatic expansion (1.78e-15), 3D Zel'dovich pancake (4.12×10^6 K accretion shock), and a full $48^3$ DM + $48^3$ Gas (221K particles) cosmological box with cooling + star formation (23.3% WHIM, $\delta_{\max}=10{,}076$, baryon mass conservation 3.23e-11).
  • v3.1 — C-ABI dlopen Physics Plugins & GPU CHIMES/PS20 Cooling Table (reports/v31-plugins-chimes-gate.json): Added src/grav_plugin.h (GRAV_PLUGIN_ABI_VERSION=1, GRAV_PLUGINS=path/to/plugin.so, plugins/example_plugin.cpp) and src/grav_chimes_table.cuh ($64\times 64$ GPU-resident chimes_ps20 metal-line cooling + Haardt–Madau UVB photoheating + Rahmati+2013 self-shielding, GRAV_COOLING_TABLE=chimes_ps20, GRAV_HYDRO_METALLICITY, GRAV_HYDRO_UVB), verified via make test-plugins (V31_PLUGINS_CHIMES_TESTS_PASSED) and Colab Tesla T4 $32^3$ DM+$32^3$ Gas cosmological runs (UVB IGM equilibrium $T_{\rm med}\approx 1.2\times 10^4,\text{K}$, 4.58× $T_{\max}$ metal-cooling suppression at $Z=1,Z_\odot$ vs. $Z=0$, +2.05% stellar mass boost, exact 0.0 baryon mass error).
  • v3.2 — Stochastic Thermal Stellar Feedback & Delayed Chemical Enrichment (reports/v32-baryon-subgrid-gate.json): Added src/grav_baryon_subgrid.cuh (Dalla Vecchia & Schaye 2012 stochastic thermal SN feedback at $\Delta T_{\rm heat}=10^{7.5},\text{K}$, Chabrier IMF delayed SNII/SNIa/AGB metal enrichment, and live per-particle metallicity $Z_i$ coupled directly into GPU GravChimesTable cooling), verified via make test-baryon (V32_BARYON_SUBGRID_TESTS_PASSED, MC unbiased expectation 0.21%, integral conservation 0.0) and Colab Tesla T4 $24^3$ DM+$24^3$ Gas cosmological FB-on vs. FB-off controls (-32.2% star-formation self-regulation, 3.46× p99 overdensity reduction, 1.77×10^7 K hot outflows, +30.3% WHIM boost, 5.82× peak metal enrichment, 5.82e-10 baryon mass conservation).
  • v3.3 — SMBH Seeding, Bondi–Hoyle Accretion & Dual-Mode AGN Feedback (reports/v33-smbh-agn-gate.json): Added src/grav_smbh_agn.cuh (race-free atomicCAS halo-core BH seeding, Eddington-capped Bondi–Hoyle accretion, Booth & Schaye 2009 $\Delta T_{\rm AGN}=10^{8.5},\text{K}$ quasar thermal bursts, and low-$f_{\rm Edd}$ bipolar radio kinetic jets), verified via make test-agn (V33_SMBH_AGN_TESTS_PASSED, Salpeter $e$-folding 2.50e-4, quasar/radio energy conservation <= 1.24e-15) and full-stack Colab Tesla T4 cosmological run (17 SMBHs grown 11.07×, additional -24.3% AGN quenching on top of SN feedback / -48.7% total vs. no-FB, 5.42× p99 overdensity reduction, 2.51×10^7 K CGM, 12.42% WHIM, 6.59e-10 (M_gas+M_star+M_BH) conservation).
  • v3.4 — Nonlinear $f(R)$ GPU FAS Multigrid Relaxation Solver (reports/v34-fr-multigrid-gate.json): Added src/grav_fr_multigrid.cuh (4-level 3D GPU FAS Multigrid Red–Black Newton–Gauss–Seidel with Oyaizu expm1 cancellation-free transform and 3D trilinear prolongation, wired into grav_cosmo_hydro via GRAV_FR_NONLINEAR=1), verified on Colab Tesla T4 (V34_FR_MULTIGRID_GPU_TESTS_PASSED): exact 7-digit Yukawa $G_{\rm eff}/G$ recovery (rel_res = 4.78e-15–1.88e-14), strong nonlinear Chameleon screening ($\delta_{\rm peak}=2000$) at FP64 machine precision (rel_res = 2.23e-16, 42,845× core suppression matching analytic deep-screening to 5.89e-7), and 50-step end-to-end nonlinear $f(R)$ cosmo-hydro evolution in 8.76 s.
  • v3.5 — On-the-Fly GPU 6D Phase-Space Subhalo Finder & tSZ/X-ray Projection (reports/v35-online-analysis-gate.json): Added src/grav_online_analysis.cuh (ROCKSTAR-style 6D GPU phase-space union-find + $256\times 256$ GPU Compton-$y$ / bolometric X-ray bremsstrahlung projection, wired into grav_cosmo_hydro via GRAV_ONLINE_ANALYSIS=1), verified on Colab Tesla T4 (V35_ONLINE_ANALYSIS_GPU_TESTS_PASSED): 32.49 ms exact de-blending of spatially overlapping host+subhalo (1,981/2,000 + 500/500, sub_vx = 450.05 km/s), 2.02 ms $256\times 256$ tSZ/X-ray projection with machine-exact flux conservation (Y_rel_err = 4.23e-15, Lx_rel_err = 1.58e-15), and end-to-end 300-step cosmological integration.
  • v3.6 (E4) — 100% Zero-External-Dependency Engine Build & CUDA 13.0 Support (reports/v36-e4-zero-dep-gate.json): Added MIT-licensed native FMM/softening header src/grav_fmm_native.cuh (Dehnen 2001 Wendland C2 softening + TreePM erfc derivatives + 4th-order Cartesian M2P/M2L) and migrated CUB iterators to Thrust for CUDA 12.x/13.x compatibility; verified make engine && make smoke with KERNEL_BUILD_DIR="" on Colab Tesla T4 (ALL_SMOKE_TESTS_PASSED, $64^3$ 2.237 s, 16 FoF halos).
  • v3.7 (E5) — FP64 Short-Range Force Accumulation (4.29e-7 Ewald Accuracy) (reports/v37-e5-fp64-ewald-gate.json): Added iact_grav_pp_truncated_fp64 in src/grav_fmm_native.cuh and wired FP64 double P2P accumulation into GRAV_PRECISION_MODE=high (eval_p2p_split_kernel); verified on Colab Tesla T4 (make test-fp64-ewald -> V37_E5_EWALD_FP64_PASSED) pushing exact 3D periodic Ewald total-force median error down to 4.29e-7 (2.60× below FP32 1.12e-6), plus 512-step $64^3$ GRAV_PRECISION_MODE=high evolution with bad_count=0.
  • v3.8 (E1) — GPU Locally Essential Tree (LET) Remote Pruning (reports/v38-e1-let-pruning-gate.json): Added src/grav_let_pruning.cuh (GPU parallel BFS LET frontier pruner + compact 152 B LetWireNode packet + remote M2P evaluator), verified on Colab Tesla T4 (make test-let -> V38_E1_LET_PRUNING_PASSED): 0.40 ms GPU pruning on $64^3$ achieving 4.38× wire-traffic compression (1724.5 KB -> 393.8 KB) with 2.31e-3 median remote force parity at $\theta=0.70$.
  • v3.9 (E2) — 32-Bit Fixed-Point Compact VRAM Coordinates & Branchless Periodic P2P (reports/v39-e2-compact-coords-gate.json): Added src/grav_compact_coords.cuh packing 32-bit periodic coordinates + float mass into a single 16 B uint4 (2.50× coordinate VRAM reduction vs. double3 + float4 = 40 B), verified on Colab Tesla T4 (make test-compact-coords -> V39_E2_COMPACT_COORDS_PASSED): 1.16e-8 Mpc max quantization error in a 100 Mpc box, 2.32e-8 Mpc wrap/drift parity, and 7.60e-9 P2P force median error (186× more accurate than float4 FP32 1.42e-6).
  • v3.10 (E3) — Unified SimulationEngine / DomainBackend Core & Main-Engine Plugin Wiring (reports/v310-e3-sim-engine-gate.json): Added src/grav_sim_engine.h (GravSimulationEngine + pluggable GravDomainBackend for 1d_slab / 3d_hilbert / 3d_mpi + PluginRegistry + unified JSON telemetry) and wired GRAV_PLUGINS directly into src/multi_gpu_slab.cu; verified make test-sim-engine (V310_E3_SIM_ENGINE_PASSED, exact 0.00e+00 3-backend energy parity, 2.71e-7 symplectic drift) and live $64^3$ GPU multi_gpu_slab run (2.34 s, bad_count=0, pre_pm=65 / post_kick=65 / snapshots=1).
  • v3.11 (E6) — Native Asynchronous Incremental Checkpoint & Direct HDF5 I/O (reports/v311-e6-checkpoint-io-gate.json): Added zero-dependency header src/grav_checkpoint_io.h (64-byte GCKP header with FNV-1a checksums, atomic temp-write + rename, GravAsyncCheckpointWriter background worker, bitwise incremental delta checkpoints, and optional -DGRAV_ENABLE_HDF5 SWIFT/Gadget-4 /Header + /PartType1/* direct I/O without intermediate .bin conversion) plus [checkpoint] / output.hdf5 config keys in src/grav_config_file.h; verified via make test-checkpoint (V311_E6_CHECKPOINT_IO_PASSED, 100K particles with 10% mutation: 4687.562 KB -> 546.938 KB = 8.571× delta compression, 7.473 ms main-thread submit / 17.587 ms async drain, 0 bit mismatches, single-byte corruption rejected) and native -DGRAV_ENABLE_HDF5 + Python h5py cross-verification (0 bit mismatches, H5PY_CROSS_VERIFY_PASSED).
  • v4.1 — Live Main-Engine E6 Async Checkpoint, Crash-Resume & Direct HDF5 I/O (reports/v41-ckpt-resume-hdf5-gate.json): Wired periodic adaptive checkpointing (GRAV_CKPT_DIR, GRAV_CKPT_INTERVAL, GRAV_CKPT_INCREMENTAL, GRAV_CKPT_ASYNC, GRAV_CKPT_STOP_AFTER), crash-safe atomic latest.txt manifests, synchronized velocity GRAV_CKPT_RESUME, and direct -DGRAV_ENABLE_HDF5 output (GRAV_IO_HDF5=1) into src/multi_gpu_slab.cu; verified on Colab Tesla T4 ($64^3$ = 262,144 particles) via preempted run stopping at step 56 (a=0.910944) and resuming to a=0.92: trajectory matches uninterrupted run to 4.21e-9 L median / 2.97e-7 L RMS (1.36e-6 $v_{\rm rms}$ diff, bad_count=0), and direct HDF5 matches .bin with 0 bit mismatches (V41_E2E_CKPT_RESUME_HDF5_PASSED).
  • v4.2 — Live E2 32-Bit Compact Coordinates & E1 GPU LET MPI Pruning (reports/v42-e2-e1-wiring-gate.json): Wired GRAV_COMPACT_COORDS=1 (16 B uint4 branchless periodic P2P / FP64 high-prec) across src/multi_gpu_slab.cu, src/grav_domain_3d_engine.cuh, and src/grav_domain_3d_mpi.cuh, and wired GPU BFS LET remote tree pruning (GRAV_MPI_LET=1, let_prune_mpi_level_kernel) into build/grav_mpi; verified on Colab Tesla T4: PM=128 high-prec Ewald median force error improves from 2.70e-6 to 2.19e-6 with bad_count=0, and 2-rank OpenMPI grav_mpi ($64^3$, 3d_hilbert, 65 steps) cuts exported ghost particles 2.47× (6.24M -> 2.53M), compresses MPI wire traffic 1.612×, cuts ghost_mpi_ms -30.2% (132.3 ms -> 92.3 ms), and matches full-ghost evolution to 1.03e-10 L median / 6.00e-8 L RMS (V42_E2_E1_MAIN_MPI_PASSED).
  • v4.3 — Coupled All-Species TreePM Hydrodynamics, 3D Hilbert Multi-GPU Fusion & Unified GravSimulationEngine (reports/v43-treepm-hydro-fusion-gate.json): Added src/grav_treepm_hydro.cuh coupling MIT 4th-order FMM M2P + Dehnen Wendland C2 softening + E2 uint4 compact coords + E5 FP64 P2P + 3D Hilbert multi-GPU/multi-domain partitioning (GRAV_HYDRO_TREEPM=1, GRAV_HYDRO_DOMAINS=K) with total baryon gravitating mass conservation (m_gas + m_star + m_bh), and refactored src/grav_cosmo_hydro.cu onto the unified E3 GravSimulationEngine / CosmoHydroBackend. Verified on Colab Tesla T4: two-species (DM+Gas) 3D Ewald force median error drops from PM-only 1.41e-1 to 5.26e-5 (FMM-4th) and 5.96e-7 (FP64) with 0.00e+00 4-domain Hilbert parity (make test-treepm-hydro -> V43_TREEPM_HYDRO_UNIT_PASSED); uniform adiabatic expansion maintains 1.78e-15; and full-stack $24^3\text{ DM}+24^3\text{ Gas}$ evolution (CHIMES/PS20 + UVB + SF + SN + enrichment + SMBH/AGN + online tSZ/X-ray + example_plugin.so) to a=0.50 sharpens peak gas overdensity 5.11× (16,296 vs. 3,189), DM peak 2.47× (891 vs. 360), and peak X-ray brightness 3.13× with 2.92e-10 baryon mass conservation and 0.0 (600 steps) / 9.78e-13 L (805 steps) 4-domain Hilbert parity.
  • v3.10 — Native On-the-Fly GPU Merger Tree, ICU Device Zero-Copy & CosmoCU dlopen Direct Bridge (reports/v310-merger-tree-gate.json): Added GPU gravitational unbinding + global-ID top-$K_{\rm core}$ extractor (src/grav_online_analysis.cuh) and weighted core-voting merger tree (src/grav_merger_tree.cuh, w(r)=(r+1)^{-1}, GRAV_MTREE_SKIP_MAX=2 flyby rescue, < 3 ms host DFS exporting LHaloTree/SubLink/GMT1), upgraded src/grav_icu_bridge.h + multi_gpu_slab.cu to true GPU zero-copy (icu_generate_to_device / _mgpu, 0 B host RAM, 0 PCIe round-trips with memfd fallback), and wired GRAV_COSMOCU_INI dlopen(libcosmocu) queries (cosmocu_H_km_s_Mpc, cosmocu_nu_ratio_grid) into src/grav_neutrino.cuh / GravPhysics. Verified across Gates 1–4 on Colab Tesla T4: test_v310_merger_tree passed 2:1 merger & 750 km/s skip-frame flyby; $64^3$ 16-snap box (5,323 nodes / 560 trees) achieved 0 cycles, 0 dangling pointers, and 0.0% MAH glitch rate; $256^3$ (16.78M) 30-snap run added only +2.57% wall time and 0.762% (23.4 MB) peak extra VRAM (0.185% MAH glitches); icu_generate_to_device matched memfd at $z=0$ to 0.0 pos/P(k) diff; and live CosmoCU dlopen agreed with reference $H(a)$ / $W_\nu(k,a)$ to 7.54e-5 / 1.09e-5.
  • v4.4 — CRK-SPH (Conservative Reproducing Kernel Hydrodynamics) (reports/v44-crk-sph-gate.json): Added src/grav_crk_sph.cuh (1st-order linearly complete reproducing kernel moments m_0, m_1, M_2 with Shepherd fallback, tensor $\nabla\mathbf{v}$, and symmetric van Leer limited pairwise artificial viscosity) wired via GRAV_HYDRO_CRK=1 / hydro.scheme=crk into both src/grav_cuda_hydro.cu and cosmological comoving src/grav_cosmo_hydro.cu (keeping traditional SPH as default). Verified across Gates 1–5 + regressions on Colab Tesla T4: 25%-jittered 3D lattice achieves 8.88e-16 0th-order and 1.02e-15 1st-order gradient reproduction (0.2329 SPH) with 1.23e-17 / 2.32e-17 pairwise momentum/energy conservation; Hydrostatic Square (alpha_cond=0) suppresses early t=0.05 spurious pressure blip 25.5× (0.358 -> 0.0140) and spurious $E_{\rm kin}$ by 2052× (4.35× lower blip and 1.000 retention at t=2.0); 3D Kelvin–Helmholtz instability (alpha_cond=0) boosts $E_{ky}$ growth 5.72× over traditional SPH (462.03× vs. 80.82×); 3D Sod (2.36% $\rho$ / 2.73% $P$ L1) and $48^3$ Sedov–Taylor (0.671% $R_{\rm shock}$ error at CFL=0.15) pass; and comoving CRK-SPH achieves 3.40e-15 Hubble adiabatic scaling and full-stack $24^3$ TreePM+CRK-SPH+CHIMES+MTree evolution with 0 baryon mass error and valid_dag=true.
  • v4.5 — COLIBRE Spinning Black Hole & Hybrid Thin/Thick Disk Jet/Wind AGN (reports/v45-spin-agn-gate.json): Upgraded src/grav_smbh_agn.cuh, src/grav_config_file.h, and src/grav_cosmo_hydro.cu (GRAV_BH_SPIN=1 / agn.spin=1, keeping GRAV_BH_SPIN=0 100% backward compatible) with Bardeen–Press–Teukolsky Kerr $r_{\rm ISCO}$ & Novikov–Thorne $\eta_{\rm NT}(a)$, Tchekhovskoy+2010 MAD Blandford–Znajek jet efficiency (up to 1.30), Narayan+2022 MAD spin-down torque, King+2005 counter-alignment flip, Bardeen–Petterson 3D alignment against local $\mathbf{L}_{\rm gas}$, and dual thermal-wind + spin-aligned bipolar jet reservoirs across Thick/Thin/Slim disks. Verified across Gates 1–4 on Colab Tesla T4: Kerr ISCO identity (1.24e-14), 4 parallel GPU tracks (thin spin-up to 0.998, $120^\circ$ counter-align flip -> 1.000000, MAD spin-down to 0.035576 with 1.000000000000 jet collinearity and 1.31e-16/5.38e-16 conservation), live $16^3$ TreePM+CRK-SPH+CHIMES cosmological A/B/C runs at matched a_end=0.2 (thin-disk spin-up to 0.9972 cutting stellar mass -6.78% vs. no-AGN; thick-disk MAD spin-down firing 5 thermal bursts + 50 jets; 9.77e-9–1.84e-8 baryon mass conservation; valid_dag=true), plus all prior unit regressions (V33_SMBH_AGN_TESTS_PASSED, CONFIG_V3_UNIT_TESTS_PASSED, V44_CRK_SPH_UNIT_PASSED, V43_TREEPM_HYDRO_UNIT_PASSED).
  • v5.0 — Unified multi_gpu_slab Hydro+DM Main Binary + Optional External C Hooks + Route B hybrid-chimes + Route C GPU Chemistry / Metals / M1RT (reports/v50-unified-chem-rt-gate.json): Extracted src/grav_cosmo_hydro_engine.cuh (run_cosmo_hydro_main) and unified cosmological TreePM+CRK-SPH+Baryons directly into src/multi_gpu_slab.cu (auto-detecting CosmoHydroHeader or --hydro/GRAV_ENABLE_HYDRO=1), added src/grav_ext_hooks.h (GRAV_WITH_CHIMES/GRACKLE/VELOCIRAPTOR, dlopen C-ABI hooks, Route B OpenMP cold-ISM packing), and added src/grav_gpu_chem_rt.cuh (Route C GPU 7-species M-matrix chemistry, 6-element metals, and M1RT), sharing the corrected cosmological time-conversion constant GRAV_MPC_KMS_TO_S = 3.08567758e19 s across CPU/GPU paths with per-substep RT source injection, substeps_max = 512, and CFL clamping. Post-fix Colab Tesla T4 verification (GRAV_WITH_CHIMES=1 GRAV_WITH_GRACKLE=1 GRAV_WITH_VELOCIRAPTOR=1): multi_gpu_slab matches grav_cosmo_hydro (5.27e-8 RMS pos) while pure-DM $64^3$ passes bad_count=0; test_v50_chem_rt_hooks verifies a=0.1000->0.1001 = 817.194 kyr, 4% selective cold-ISM offload, max_elem_err=0.0, [O/Fe]=+0.3342/-1.5728, and $32^3$ GPU Strömgren sphere (0.03% / 0.69% / 1.58% at 30 / 80 / 180 Myr); short-expansion tests confirm chem_dt_s_tot accuracy (1.24e-10 / 3.81e-11 rel err) and 288 RT substeps (up to 63/step, rt_cfl_max=0.2489 <= 0.25); and Gate 5 passes both live Route C (x_HI=0.0126, x_HII=0.9874, M1 photons=1.32e61, rt_cfl_max=0.2491, valid_dag=true) and Route B (hybrid_cold_frac=2.11%, x_H2=0.01371, vr_halos=8, valid_dag=true).
  • v5.1 (Spec A) — FP32-Relative / float4 CRK-SPH Acceleration + $64^3$ Strong-Nonlinear Full-Stack Gate 5 + High-Precision LET Auto-Tightening + Launch/Sync Overhead Reduction (reports/v51-crk-opt-64c-gate.json, reports/v51-let-highprec-gate.json): Added FP32-relative CRK solvers in src/grav_crk_sph.cuh and AoSoA float4 sorted packing + tighter 1.45*h neighbor grid in src/grav_cosmo_hydro_engine.cuh (preserving GRAV_CRK_FP64=1 fallback), automatic high-precision LET opening tightening 0.70 -> 0.25 via let_effective_theta in src/grav_let_pruning.cuh, pinned GpuCtrlPinned + batched scan_local_slabs in src/multi_gpu_slab.cu, and stack-allocated dist_pm exchange maps in src/grav_cuda_pm_dist.cu. Verified on Colab Tesla T4: $24^3$ A/B cuts sph_ms 44.47× (6,821.13 ms -> 153.39 ms) and full wall time 11.43× (max_rel_rho_diff=4.20e-4, mean_rel_u_diff=1.37e-3, Hubble adiabatic 1.997e-9); $64^3\text{ DM}+64^3\text{ Gas}$ (524,288 particles) 180-step strong-nonlinear full stack finishes in 30.01 s (max_gas_overd=1,966.67, m_star=0.1588, n_bh=38, bh_spin_max=0.9649, 6 SN + 10 AGN jets, n_subhalos_6d=35, merger tree 163 nodes / 13 trees valid_dag=true, baryon_mass_rel_err=4.52e-12); high-precision LET pushes remote median error to 0 and p95 52.47× lower (1.52e-2 -> 2.89e-4); and pure-DM $64^3$ regression passes bad_count=0. (4-GPU strong-scaling re-benchmark awaits a multi-GPU node.)
  • v5.2 (Spec B) — Streaming ZIP64 On-the-Fly DMO & Hydro Lightcone (HEALPix / Pencil-Beam + Gas / Star / Compton-$y$) + Direct ObsCU weak_lensing Export (reports/v52-lightcone-gate.json): Added src/grav_lightcone.cuh and wired [lightcone] / GRAV_LC_SHELLS_OUT across both DMO (src/multi_gpu_slab.cu) and --hydro (src/grav_cosmo_hydro_engine.cuh) using a streaming zero-copy ZIP64 .npz exporter (0x0001/0x06064B50/0x07064B50 headers with table-driven CRC-32 supporting $&gt;4,\text{GiB}$ arrays and archives), exporting total-matter shells.npy + kappa_born.npy for ObsCU/src/obscu/weak_lensing.py plus shells_gas_mass.npy, shells_star_mass.npy, shells_compton_y.npy, and compton_y_map.npy in --hydro runs. Verified across DMO + $&gt;4,\text{GiB}$ ZIP64 + --hydro on Colab Tesla T4 & local read-back: 62,224 HEALPix round-trips (0 mismatches), Born convergence exactness (2.17e-16 / 2.17e-15), DMO ObsCU parity (3.54e-5 full-sky / 3.35e-5 pencil); real 4.5000 GiB Nside=2048 11-shell archive (scripts/test_v52_zip64.cpp, shells.npy = 4,429,185,152 B, kappa_born.npy offset 4,429,186,421 B) passing full zipfile.testzip() CRC32 and numpy.load() verification across all 12 entries; and --hydro lightcone matching analytic adiabatic Compton-$y$ to 0.076% (0.81% max shell) while delivering live full-sky & pencil gas_mass_lc, star_mass_lc, compton_y_map, and ObsCU Born $\kappa$ parity (6.37e-5 / 3.99e-5).
  • v5.3 — SWIFT (kp1.0ms1.2 / COLIBRE Minihalo) Physics, Config Parity & Hydro Baryon Merger Tree Export (reports/v53-swift-parity-gate.json): Added src/grav_sph_kernel.cuh (runtime-selectable 3D Quartic Spline $M_5$ H=2.018932 h / Wendland C2 + configurable $X_H$ and piecewise neutral/ionized $\mu(T)$ thermo), updated src/grav_cosmo_hydro_engine.cuh, src/grav_chimes_table.cuh, src/grav_gpu_chem_rt.cuh, src/grav_treepm_hydro.cuh, src/grav_merger_tree.cuh, and src/grav_config_file.h with dual star-formation gating (overdensity > 1000 and n_H > 10 cm^-3), GRAV_HYDRO_UVB=0, GRAV_COSMIC_RAY_RATE, T_min = 1 K cooling floor, T_init = 466.455 K / T_Hion = 10000 K, variable artificial viscosity $\alpha \in [0, 2]$, max_vol_change = 1.4 smoothing-length limiter, soft_h = 3.125e-4, GRAV_SNAP_Z_LIST / GRAV_SNAP_A_LIST multi-snapshot export, merger_tree.every config mapping, GPU spatial-hash aperture baryon attachment (Mgas, Mstar, MBH, Zgas, SFR), and ENABLE_HDF5=1 direct /MergerTree .hdf5 / GMT1 v2 export, plus configs/swift_minihalo_parity.ini and streaming --hydro HDF5 conversion in scripts/prepare_input.py. Verified across Gates 1–6 + regressions on Colab Tesla T4 (all_pass=true): $M_5$ integral 1.11e-15 / $dW$ 1.68e-9 / CRK-SPH 0th & 1st-order 1.33e-15 / 3.55e-15; strict dual-threshold SF gating; UVB=0 exact zero heating & cooling to < 22 K (table) / 1.0 K (non-eq); variable viscosity 0.1 -> 1.626 (shock) / 0.423 (expansion), vol_ratio in [0.7143, 1.4]; end-to-end $z=200\to 0$ preset run (1,806 steps, 3 snapshots, 0.0 baryon error); and Gate 6 clustered hydro merger tree direct HDF5 export (491 nodes, 1 tree, valid_dag=true, GMT1 v2 exact match, Mgas/Mstar aperture error 1.49e-8 / 1.39e-17, test-merger-tree & build/multi_gpu_slab passing).

Deferred Track (Exascale / 10k-GPU Infrastructure)

  • Track 3 — Exascale Readiness (S1–S4, deferred): Dynamic $N_{\rm top} \propto G^{1/3}$ / ORB tree cuts (replacing static 12^3), cuFFTMp / heFFTe 2D pencil FFT + MPI_Alltoallv_c, sparse neighborhood graph + LET pruning, uint64_t particle IDs, and parallel HDF5 / ADIOS2 async checkpointing.

Cosmology Unified (CU) Ecosystem

Repository Role Canonical Link
CU-Suite Top-level orchestrator, interface contract & baryon calibration https://github.com/HainaHuang729/CU-Suite
CosmoCU C++20 Einstein–Boltzmann, nonlinear HMcode/BCM/EFTofLSS, CMB & Dual<10> AD https://github.com/HainaHuang729/CosmoCU
ICU Memory-optimized GPU/CPU/MPI 1LPT/2LPT/3LPT cosmological initial conditions https://github.com/HainaHuang729/ICU
gravityCU Multi-GPU VRAM-resident CUDA TreePM, SPH hydro, lightcones & GPU FoF https://github.com/HainaHuang729/gravityCU
21cmCU Native C/CUDA + cuFFT 21cm reionization & Bayesian inference engine https://github.com/HainaHuang729/21cmCU
ObsCU Decoupled cosmological survey forward modeling, SBI & baryon calibration https://github.com/HainaHuang729/ObsCU

Citation & Authorship

Author: Haina Huang (Department of Physics, The Chinese University of Hong Kong).
Please cite CITATION.cff and see paper/main.tex and reports/MULTI-GPU-AND-VALIDATION-REPORT.md for full derivations, kernel specifications, and benchmark provenance.

About

gravityCU: Multi-GPU VRAM-Resident CUDA TreePM & Full-GPU FoF Cosmological N-Body Engine (up to 1024^3 particles)

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages