# Upstream Comparison and CPU Optimization Keep track of how **21cmCU** relates to upstream **`21cmfast/21cmFAST`** (`v4.3.2`), its **93 CUDA C APIs / 57 CFFI exports**, its 5 zero-precision-loss CPU optimizations, and the features beyond upstream in `v1.0.0` – `v1.2.0-dev`. --- ## 1. Upstream `21cmFAST` Sync Matrix (`v4.3.2`) | Upstream Release / PR | Upstream Feature | Status in `21cmCU` | Notes | | --- | --- | --- | --- | | **`v4.1.0` – `v4.3.2`** | `v4` C-backend, discrete halos, `ComputeLF`, cached coeval reads (`#821`, `#825`), $\sigma(M)$ tables (`#826`), angular pre-interp (`#819`) | **Synced** (`93` CUDA C APIs / `57` CFFI exports) | Checked by `python scripts/check_cuda_abi.py` | | **PR `#818`** | Fixed-and-Paired Initial Conditions | **Implemented** | `fixed_paired_initial_conditions(...)` in `py21cmcu.shortcuts` | | **PR `#834` / `#820`** | Lightconer protocol & HEALPix angular lightcones | Complementary | `RectilinearLightconer`, `ObliqueRectilinearLightconer`, `lightcone_ksz_map` | | **PR `#763` / `#631`** | Fuzzy Dark Matter (`FDM`) & Primordial $f_{\mathrm{NL}}$ | **Stage 3 Roadmap** | Scheduled in [ROADMAP.md](../ROADMAP.md) | --- ## 2. Five-Point CPU Hot-Path Optimizations All 5 optimizations preserve bit-level/numerical parity (`max_abs = 0.0`) relative to the baseline CPU C path: | Optimization | Module / Stage | Result | | --- | --- | --- | | Cache-blocked 3D transpose & SIMD FFTW | `PerturbField`, `SpinTemperature`, `IonisationBox` | `max_abs = 0.0` | | Fused halo-to-grid deposit | `HaloCatalog` CIC/NGP scatter | `max_abs = 0.0` | | Reusable FFTW & CUDA host buffers | `fftw_wisdom.c` & `cuda_api` | `max_abs = 0.0` | | NUMA-aware OpenMP loop scheduling | Multi-redshift evolution loops | `max_abs = 0.0` | | Batched spin-temperature interpolation | `SpinTemperature.c` | `max_abs = 0.0` | --- ## 3. Capabilities Added Beyond Upstream (`v0.9.0` → `v1.2.0-dev`) - **Native Inference Engine (completed, formerly Direction P)**: `PriorTransform`, `NativeNestedSampler`, `NativeEnsembleMCMC`, `audit_posterior_native`, `BatchPool` multi-GPU evaluation, and `v1.1.0-dev` distributed collectives (`distributed_likelihood_eval`, `NCCL` / `gloo`) with SHA-256 checkpoint provenance. - **Multi-Probe & Active SBI (`v1.0.0` → `v1.2.0-dev`)**: `cross_power_21cm_galaxy`, `ksz_momentum_map`, `lightcone_ksz_map`, `UVLFLikelihood`, `JointLikelihood`, `fixed_paired_initial_conditions`, `select_active_sbi_points`, and `ActiveSBILoop`. --- ## Related Pages - Full standalone document: [UPSTREAM_AND_OPTIMIZATION.md](../UPSTREAM_AND_OPTIMIZATION.md) - Performance numbers and CUDA layout: [Architecture Overview](Architecture-Overview.md) & [Multi-Probe & Fisher](Multi-Probe-Fisher-and-Topology.md) - Forward plan: [ROADMAP.md](../ROADMAP.md)