Skip to main content

PM++: Multi-GPU Particle-Mesh Cosmology

PM++ logo

Documentation Status Package build PyPI version Python versions License

What is PM++?

PM++ is a JAX-based, differentiable particle-mesh simulator for large-scale structure cosmology. It distributes a single simulation across multiple GPUs and covers the path from Gaussian initial modes through Lagrangian perturbation theory and N-body evolution to density fields and scientific summary statistics.

PM++ is designed for simulations that need both scale and derivatives. It can differentiate observables with respect to initial modes, particle states, and cosmological parameters while keeping the distributed forward model and its adjoint in one JAX program.

The implementation builds on ideas from PMWD. The maintained validation suite compares PM++ directly with PMWD for forward evolution and gradients. For the configurations covered by those tests, the two agree down to machine precision.

Capabilities

  • End-to-end cosmological evolution: transfer and growth calculations, Gaussian and nested initial fields, linear modes, LPT, PM N-body evolution, density assignment, observers, and power-spectrum analysis.
  • Automatic differentiation: forward and reverse derivatives through the simulation, including a custom N-body adjoint for memory-efficient reverse sweeps.
  • Distributed execution: sharded particle ownership, mesh-halo exchange, distributed FFTs, and particle migration across a multi-GPU device mesh.
  • Accelerated particle-mesh operations: paired Pallas CIC kernels and an optional compiled CUDA routing backend, with portable JAX fallbacks.
  • Scientific configuration: float32 and float64 execution, configurable particle and force meshes, integration schedules, correction models, and differentiable cosmological parameters.
  • Validation and analysis: PMWD forward and gradient comparisons, mass and ownership checks, finite-difference tests, power spectra, projections, and CAMELS and QUIJOTE data adapters.

What PM++ enables

By combining multi-GPU execution with differentiability, PM++ makes it possible to simulate larger cosmological volumes or use finer mass resolution without giving up parameter sensitivities. This supports field-level inference, initial-condition reconstruction, gradient-based calibration, and sensitivity studies of how cosmological parameters shape large-scale structure.

Installation

PM++ requires Python 3.10 or newer and supports jax>=0.9.1,<0.11. Install the JAX build for the accelerator and driver before installing PM++. For a CUDA 12 environment:

python -m venv ~/.venvs/pmpp
source ~/.venvs/pmpp/bin/activate
python -m pip install --upgrade pip
python -m pip install "jax[cuda12]>=0.9.1,<0.11"
python -m pip install pmpp

Choose the PM++ extra that matches the environment:

Use Installation
Run simulations python -m pip install pmpp
Run the repository tests python -m pip install "pmpp[dev]"
Build the documentation python -m pip install "pmpp[docs]"
Develop, test, and build documentation python -m pip install "pmpp[dev,docs]"

When a compatible CUDA development toolkit and CMake are available, build the optional accelerated routing extension in the same environment:

pmpp-build-cuda-routing

The compiled router is optional. PM++ uses its portable JAX implementation when the extension or a compatible nvcc is unavailable.

See the installation guide for CUDA 13, HPC cluster, Compute Canada, and offline-wheel instructions.

Documentation

The complete documentation is available at pmpp-docs.readthedocs.io. It contains the getting-started workflow, scientific configuration guide, multi-GPU setup, differentiation guidance, solver internals, and API reference.

Useful entry points:

Repository layout

PMpp/
|-- src/pmpp/
|   |-- core/                  # Configuration and shared utilities
|   |-- cosmology/             # Cosmological models, transfer, and growth
|   |-- initial_conditions/    # White noise, linear modes, and LPT
|   |-- nbody/                 # Particles, gravity, integration, and observers
|   |-- cic/                   # Scatter, gather, and Pallas CIC kernels
|   |-- distributed/           # Device meshes, FFTs, halos, and routing
|   |-- numerics/              # Local FFT and ODE primitives
|   |-- corrections/           # Optional force and phase-space corrections
|   |-- analysis/              # Power spectra and plotting
|   `-- extras/                # CAMELS and QUIJOTE adapters
|-- cuda/                      # Optional native CUDA routing sources
|-- tests/
|   `-- pmwd/                  # Test-only PMWD reference implementation
|-- docs/source/
|   |-- getting_started/       # Installation and first-run guidance
|   |-- user_guide/            # Scientific and runtime configuration
|   |-- internals/             # Algorithms and distributed design
|   |-- api/                   # Public API reference
|   `-- notebooks/             # Pre-rendered scientific workflows
|-- pyproject.toml             # Package metadata, dependencies, and tooling
`-- requirements.txt           # Read the Docs environment requirements

The importable implementation lives entirely under src/pmpp. The copy of PMWD under tests/pmwd is retained only as a numerical reference for validation.

Citation

See the citation guide for PM++, its discrete-adjoint foundation, and PMWD attribution.

License

PM++ is distributed under the BSD 3-Clause license. See LICENSE. PM++ retains the original PMWD notice in THIRD_PARTY_NOTICES.md.

Metadata

Release files for pmpp 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pmpp 1.1.1
File Size Uploaded Provenance Actions
pmpp-1.1.1.tar.gz 185.6 kB With provenance Details for pmpp-1.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pmpp 1.1.1
File Interpreter ABI Platform Actions
pmpp-1.1.1-py3-none-any.whl Python 3 none any Details for pmpp-1.1.1-py3-none-any.whl

Total release size: 402.0 kB

Release files / pmpp-1.1.1.tar.gz

Download URL pmpp-1.1.1.tar.gz
Size 185.6 kB
Tags Source
SHA-256 checksum
How to use checksums
631b37c6f5cd2ee88d58bed95db24d8acf856fc81365c6dcb7d37fc207f24456
BLAKE2b-256 checksum
How to use checksums
55d147ebb4ea45ea25e17653fb4006155a511b8ff7d17bef4546de3196627090
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

Release files / pmpp-1.1.1-py3-none-any.whl

Download URL pmpp-1.1.1-py3-none-any.whl
Size 216.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7f50d3e0d4f152387eef1feba173ca6a51975c918a8eeb097c2afa08ac048b4c
BLAKE2b-256 checksum
How to use checksums
f3f7342dbbf93eaafa6cdf46064a662e8dad3c46745b3ee8ac25a0ad15020727
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

Security for pmpp 1.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pmpp-1.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page