PM++: Multi-GPU Particle-Mesh Cosmology
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.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pmpp-1.0.0.tar.gz.
File metadata
- Download URL: pmpp-1.0.0.tar.gz
- Upload date:
- Size: 182.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
813c3fb165c29d38aa68298ce9c4074ef5745741df84ca1b24b0a6a78ded7ccd
|
|
| MD5 |
9ed1421194e25f988c5b0e4694118e46
|
|
| BLAKE2b-256 |
541068c56a1c237a3bb88e7c6052a80caa1caaf2cd6b7a7f9807dffbcc9ef5d4
|
Provenance
The following attestation bundles were made for pmpp-1.0.0.tar.gz:
Publisher:
publish-to-pypi.yml on rouzib/PMpp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pmpp-1.0.0.tar.gz -
Subject digest:
813c3fb165c29d38aa68298ce9c4074ef5745741df84ca1b24b0a6a78ded7ccd - Sigstore transparency entry: 2444462501
- Sigstore integration time:
-
Permalink:
rouzib/PMpp@1406f9188881cecb8ff20cfb1c7bbaea28a3a830 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/rouzib
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@1406f9188881cecb8ff20cfb1c7bbaea28a3a830 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file pmpp-1.0.0-py3-none-any.whl.
File metadata
- Download URL: pmpp-1.0.0-py3-none-any.whl
- Upload date:
- Size: 212.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d0d97fa3ff6dc321a9e1dd4a7cd44afa705e97737aa017ac21280c922b4f88e7
|
|
| MD5 |
5cd907270cab33679cd97d81ae8a0965
|
|
| BLAKE2b-256 |
e7b5fdb91106e115a34cd796460c205df95802459ad88ce9a02d4108c3e9d2b4
|
Provenance
The following attestation bundles were made for pmpp-1.0.0-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on rouzib/PMpp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pmpp-1.0.0-py3-none-any.whl -
Subject digest:
d0d97fa3ff6dc321a9e1dd4a7cd44afa705e97737aa017ac21280c922b4f88e7 - Sigstore transparency entry: 2444462582
- Sigstore integration time:
-
Permalink:
rouzib/PMpp@1406f9188881cecb8ff20cfb1c7bbaea28a3a830 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/rouzib
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@1406f9188881cecb8ff20cfb1c7bbaea28a3a830 -
Trigger Event:
workflow_dispatch
-
Statement type: