Skip to content

CAMB speed and precision update targeting future SO#198

Draft
cmbant wants to merge 29 commits intomasterfrom
devel
Draft

CAMB speed and precision update targeting future SO#198
cmbant wants to merge 29 commits intomasterfrom
devel

Conversation

@cmbant
Copy link
Copy Markdown
Owner

@cmbant cmbant commented May 1, 2026

Summary

This is a large numerical/tooling update that modernizes CAMB’s ODE integration path, adds accuracy-stability diagnostics, and improves development/build reproducibility. It should be 10-25% faster than the previous version at the same or better accuracy.

  • TODO: Fully tune default accuracy parameters as needed for next-gen experiments to high L.

Main changes:

  • Replace the legacy DVERK-style integrator implementation with a named RungeKuttaDP45 module that preserves CAMB’s re-entry/control-flow semantics while using Dormand-Prince 4/5 coefficients.
  • Add a default RECFAST Rosenbrock-to-DP45 handoff path, with configurable RECFAST_use_rosenbrock, RECFAST_rosenbrock_handoff_xH, and RECFAST_rosenbrock_tol settings exposed through Fortran, Python, and .ini round-tripping.
  • Retune RECFAST defaults for the new fast handoff mode, including a lower RECFAST_nz baseline and scaling with BackgroundTimeStepBoost and IntTolBoost.
  • Stabilize PPF dark-energy Gamma evolution at high ckH^2 by relaxing toward the quasi-static fixed point rather than hard-setting Gamma = 0.
  • Add TimeSwitchBoost as a separate accuracy control for physical transition/switch timings.
  • Add camb check_accuracy, with Python API support, CLI docs, optional plots, chi-squared estimates, boost searches, and component refinement.
  • Improve .ini writing/round-tripping for RECFAST Rosenbrock settings and cleaner float serialization.
  • Raise an error when high-k matter-power extrapolation would proceed from a rising tail.
  • Add devcontainer support, portable tracked pre-commit hook setup, LF normalization, and build fixes for stale dependency files and read-only shared libraries.
  • Tighten source distribution packaging through an explicit MANIFEST.in whitelist.

Using check_accuracy

This PR adds a new stability-checking command:

camb check_accuracy inifiles/planck_2018.ini

It compares the requested calculation against a boosted-accuracy reference run and reports derived-parameter, CMB spectra, lensing-potential, and matter-power differences. Useful options include:

camb check_accuracy inifiles/planck_2018.ini --set-for-lmax 4000
camb check_accuracy inifiles/planck_2018.ini --plot-dir accuracy_plots
camb check_accuracy inifiles/planck_2018.ini --chi2 --chi2-config so

Notes

The PR includes numerical behavior changes. The two added changelog notes document the RECFAST Rosenbrock tuning and the PPF Gamma stabilization experiments, including the main accuracy comparisons used to select the shipped defaults.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant