pmpp 0.1.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. pmpp-0.1.3/.gitignore +11 -0
  2. pmpp-0.1.3/LICENSE +29 -0
  3. pmpp-0.1.3/PKG-INFO +242 -0
  4. pmpp-0.1.3/README.md +205 -0
  5. pmpp-0.1.3/THIRD_PARTY_NOTICES.md +35 -0
  6. pmpp-0.1.3/pyproject.toml +70 -0
  7. pmpp-0.1.3/src/pmpp/FFT_distributed.py +851 -0
  8. pmpp-0.1.3/src/pmpp/__init__.py +9 -0
  9. pmpp-0.1.3/src/pmpp/boltzmann.py +484 -0
  10. pmpp-0.1.3/src/pmpp/camels_io.py +370 -0
  11. pmpp-0.1.3/src/pmpp/configuration.py +569 -0
  12. pmpp-0.1.3/src/pmpp/corrections/__init__.py +90 -0
  13. pmpp-0.1.3/src/pmpp/corrections/combined.py +41 -0
  14. pmpp-0.1.3/src/pmpp/corrections/common.py +184 -0
  15. pmpp-0.1.3/src/pmpp/corrections/core.py +397 -0
  16. pmpp-0.1.3/src/pmpp/corrections/mesh_cnn.py +333 -0
  17. pmpp-0.1.3/src/pmpp/corrections/pgd.py +255 -0
  18. pmpp-0.1.3/src/pmpp/corrections/radial.py +245 -0
  19. pmpp-0.1.3/src/pmpp/corrections/softening.py +81 -0
  20. pmpp-0.1.3/src/pmpp/corrections/window.py +285 -0
  21. pmpp-0.1.3/src/pmpp/cosmo.py +514 -0
  22. pmpp-0.1.3/src/pmpp/enmesh.py +169 -0
  23. pmpp-0.1.3/src/pmpp/fft.py +155 -0
  24. pmpp-0.1.3/src/pmpp/gather.py +614 -0
  25. pmpp-0.1.3/src/pmpp/gravity.py +747 -0
  26. pmpp-0.1.3/src/pmpp/growth.py +111 -0
  27. pmpp-0.1.3/src/pmpp/halo_moving.py +3623 -0
  28. pmpp-0.1.3/src/pmpp/lpt.py +299 -0
  29. pmpp-0.1.3/src/pmpp/mesh_halo.py +198 -0
  30. pmpp-0.1.3/src/pmpp/modes.py +458 -0
  31. pmpp-0.1.3/src/pmpp/multigpu_configuration.py +263 -0
  32. pmpp-0.1.3/src/pmpp/nbody.py +642 -0
  33. pmpp-0.1.3/src/pmpp/nbody_observers.py +145 -0
  34. pmpp-0.1.3/src/pmpp/ode_util.py +500 -0
  35. pmpp-0.1.3/src/pmpp/particles.py +2092 -0
  36. pmpp-0.1.3/src/pmpp/plotting_utils.py +195 -0
  37. pmpp-0.1.3/src/pmpp/potential_correction.py +86 -0
  38. pmpp-0.1.3/src/pmpp/power_spectrum.py +560 -0
  39. pmpp-0.1.3/src/pmpp/scatter.py +421 -0
  40. pmpp-0.1.3/src/pmpp/steps.py +1060 -0
  41. pmpp-0.1.3/src/pmpp/utils.py +490 -0
pmpp-0.1.3/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /CAMELS/ICs/
2
+ /CAMELS/ics.npz
3
+ /CAMELS/snapshot_090.hdf5
4
+ /CAMELS/snapshot_090.npz
5
+ .idea
6
+ /profiles/
7
+ /notebooks/tests/output/
8
+ /diagnostics/
9
+ /notebooks/
10
+ /Quijote/
11
+ /CAMELS/
pmpp-0.1.3/LICENSE ADDED
@@ -0,0 +1,29 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2026, the PM++ developers
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ 1. Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ 3. Neither the name of the copyright holder nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
pmpp-0.1.3/PKG-INFO ADDED
@@ -0,0 +1,242 @@
1
+ Metadata-Version: 2.4
2
+ Name: pmpp
3
+ Version: 0.1.3
4
+ Summary: PM++: a JAX-based differentiable multi-GPU Particle-Mesh cosmology simulator.
5
+ Project-URL: Homepage, https://github.com/rouzib/PMpp
6
+ Project-URL: Repository, https://github.com/rouzib/PMpp
7
+ Project-URL: Documentation, https://pmpp-v2.readthedocs.io/en/latest/
8
+ Project-URL: Issues, https://github.com/rouzib/PMpp/issues
9
+ Author: rouzib
10
+ License-Expression: BSD-3-Clause
11
+ License-File: LICENSE
12
+ License-File: THIRD_PARTY_NOTICES.md
13
+ Keywords: cosmology,differentiable-simulation,jax,multi-gpu,n-body,particle-mesh
14
+ Classifier: Development Status :: 3 - Alpha
15
+ Classifier: Intended Audience :: Science/Research
16
+ Classifier: License :: OSI Approved :: BSD License
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Topic :: Scientific/Engineering :: Astronomy
22
+ Classifier: Topic :: Scientific/Engineering :: Physics
23
+ Requires-Python: >=3.10
24
+ Requires-Dist: jax>=0.4.7
25
+ Requires-Dist: mcfit>=0.0.18
26
+ Provides-Extra: dev
27
+ Requires-Dist: build; extra == 'dev'
28
+ Requires-Dist: pytest; extra == 'dev'
29
+ Requires-Dist: twine; extra == 'dev'
30
+ Provides-Extra: docs
31
+ Requires-Dist: jupyter-book<2.0; extra == 'docs'
32
+ Requires-Dist: matplotlib; extra == 'docs'
33
+ Requires-Dist: myst-nb; extra == 'docs'
34
+ Requires-Dist: sphinx; extra == 'docs'
35
+ Requires-Dist: sphinx-rtd-theme; extra == 'docs'
36
+ Description-Content-Type: text/markdown
37
+
38
+ # PM++: Multi-GPU Particle-Mesh Cosmology
39
+
40
+ [![Documentation Status](https://readthedocs.org/projects/pmpp-docs/badge/?version=latest)](https://pmpp-docs.readthedocs.io/en/latest/?badge=latest)
41
+
42
+ PM++ is a JAX-based, differentiable particle-mesh cosmology code built on top
43
+ of PMWD ideas and extended for multi-GPU simulations. The active implementation
44
+ is imported as `pmpp` and lives in `src/pmpp/`; the `pmwd/` directory is kept as a reference implementation for
45
+ validation.
46
+
47
+ ## Current Scope
48
+
49
+ - Multi-GPU PM N-body simulation with JAX.
50
+ - Preferred `mesh_halo` multi-GPU mode.
51
+ - PMWD comparison tests for forward and gradient correctness.
52
+ - Distributed FFT support for sharded meshes.
53
+ - LPT, Boltzmann/growth utilities, scatter/gather, and power-spectrum tools.
54
+ - Potential-correction models under `src/pmpp/corrections/`.
55
+
56
+ ## Repository Layout
57
+
58
+ ```text
59
+ PMpp/
60
+ |-- src/pmpp/ # Active importable PM++ package
61
+ | |-- configuration.py # Simulation configuration
62
+ | |-- multigpu_configuration.py# Multi-GPU mode/configuration object
63
+ | |-- particles.py # Particle state and ownership
64
+ | |-- scatter.py # Particle-to-mesh assignment
65
+ | |-- gather.py # Mesh-to-particle interpolation
66
+ | |-- gravity.py # PM force solve
67
+ | |-- steps.py # Drift, kick, force, adjoint pieces
68
+ | |-- nbody.py # Full N-body integration and VJP
69
+ | |-- FFT_distributed.py # Distributed FFT construction
70
+ | |-- mesh_halo.py # Mesh halo exchange helpers
71
+ | |-- modes.py # White noise and linear modes
72
+ | |-- lpt.py # LPT initialization
73
+ | |-- power_spectrum.py # Density and particle P(k)
74
+ | |-- corrections/ # Potential corrections
75
+ | `-- potential_correction.py # Backward-compatible correction facade
76
+ |-- pmwd/ # Reference PMWD implementation
77
+ |-- tests/ # Regression and gradient tests
78
+ |-- scripts/ # Benchmarks and diagnostics
79
+ |-- notebooks/ # Examples and exploratory notebooks
80
+ `-- docs/ # Project documentation
81
+ ```
82
+
83
+ ## Minimal Multi-GPU Setup
84
+
85
+ New code should use the nested `MultiGPUConfiguration` object. The older
86
+ top-level `compute_mesh=` compatibility path still exists, but is not preferred.
87
+
88
+ ```python
89
+ import jax
90
+ import jax.numpy as jnp
91
+
92
+ from pmpp.configuration import Configuration
93
+ from pmpp.multigpu_configuration import MultiGPUConfiguration
94
+ from pmpp.utils import create_compute_mesh
95
+
96
+ res = 256
97
+ box_size = 1000.0 # Mpc/h
98
+ ptcl_grid_shape = (res, res, res)
99
+ ptcl_spacing = box_size / res
100
+
101
+ gpu_devices = [device for device in jax.devices() if device.platform == "gpu"]
102
+ if len(gpu_devices) < 2:
103
+ raise RuntimeError("This multi-GPU example requires at least 2 GPUs.")
104
+ compute_mesh = create_compute_mesh(gpu_devices)
105
+ num_devices = len(gpu_devices)
106
+
107
+ conf = Configuration(
108
+ ptcl_spacing,
109
+ ptcl_grid_shape,
110
+ mesh_shape=1,
111
+ multigpu=MultiGPUConfiguration(
112
+ compute_mesh=compute_mesh,
113
+ mode="mesh_halo",
114
+ ),
115
+ max_ptcl_per_slice=int((res**3 / num_devices) * 1.8),
116
+ max_share_ptcl=50_000,
117
+ max_halo_share_ptcl=50_000,
118
+ max_share_gather_ptcl=200_000,
119
+ float_dtype=jnp.float32,
120
+ )
121
+ ```
122
+
123
+ Capacity overflows are correctness failures. If a run reports overflow in
124
+ particle migration, halo rebuild, or gather exchange buffers, increase the
125
+ corresponding capacity and rerun.
126
+
127
+ ## Minimal Forward Run
128
+
129
+ ```python
130
+ import jax
131
+ import jax.numpy as jnp
132
+
133
+ from pmpp.boltzmann import boltzmann
134
+ from pmpp.configuration import Configuration
135
+ from pmpp.cosmo import SimpleLCDM
136
+ from pmpp.lpt import lpt
137
+ from pmpp.modes import linear_modes, white_noise
138
+ from pmpp.nbody import nbody
139
+ from pmpp.scatter import scatter
140
+
141
+ res = 32
142
+ box_size = 100.0
143
+ conf = Configuration(
144
+ box_size / res,
145
+ (res, res, res),
146
+ mesh_shape=1,
147
+ float_dtype=jnp.float32,
148
+ )
149
+
150
+ cosmo = boltzmann(SimpleLCDM(conf), conf)
151
+ modes = white_noise(0, conf)
152
+ modes = linear_modes(modes, cosmo, conf)
153
+ ptcl = lpt(modes, cosmo, conf)
154
+
155
+ nbody_jit = jax.jit(nbody, static_argnames=("conf", "reverse"))
156
+ ptcl_final = nbody_jit(ptcl, cosmo, conf)
157
+ density = scatter(ptcl_final, conf)
158
+
159
+ print(density.shape)
160
+ print(float(density.mean()))
161
+ ```
162
+
163
+ Expected sanity checks:
164
+
165
+ - density shape matches the mesh;
166
+ - density mean is close to `1.0`;
167
+ - no capacity warnings appear.
168
+
169
+ ## Potential Corrections
170
+
171
+ Correction implementations now live in `pmpp.corrections` (`src/pmpp/corrections/`).
172
+
173
+ ```python
174
+ from pmpp.corrections import (
175
+ apply_potential_correction,
176
+ evaluate_potential_transfer,
177
+ init_potential_correction,
178
+ )
179
+ ```
180
+
181
+ `pmpp.potential_correction` remains as a compatibility facade for old scripts,
182
+ but new code and tests should import from `pmpp.corrections`.
183
+
184
+ Supported correction families:
185
+
186
+ - `radial`, `radial_spline`, `neural_spline`
187
+ - `mesh_cnn`, `cnn`
188
+ - `combined`, `hybrid`, `spline_cnn`
189
+ - `pm_window`, `cic_compensation`, `cic_window_compensation`
190
+
191
+ ## Multi-GPU Modes
192
+
193
+ Prefer `mesh_halo` for current serious multi-GPU work:
194
+
195
+ - particles are stored authoritatively on their owning slab;
196
+ - particles migrate between slabs when needed;
197
+ - mesh halos are exchanged for local stencil operations;
198
+ - it is generally faster than the older particle-halo path in current
199
+ `256^3`, 2-GPU testing.
200
+
201
+ `particle_halo` remains useful for comparison and legacy validation.
202
+
203
+ ## Testing
204
+
205
+ Focused correction and gravity checks:
206
+
207
+ ```bash
208
+ /home/rouzib/.virtualenvs/PMPP/bin/python -m pytest \
209
+ tests/test_potential_correction.py \
210
+ tests/test_grad_gravity.py \
211
+ tests/test_gravity_particle_nyquist_filter.py \
212
+ -q
213
+ ```
214
+
215
+ Mesh-halo scatter/gather:
216
+
217
+ ```bash
218
+ /home/rouzib/.virtualenvs/PMPP/bin/python -m pytest tests/test_mesh_halo_scatter_gather.py -q
219
+ ```
220
+
221
+ End-to-end gradient:
222
+
223
+ ```bash
224
+ /home/rouzib/.virtualenvs/PMPP/bin/python -m pytest tests/test_grad_nbody.py -q
225
+ ```
226
+
227
+ ## Notebooks
228
+
229
+ The primary example notebooks are:
230
+
231
+ - `notebooks/pmpp_showcase.ipynb`
232
+ - `notebooks/mGPU_pmwd_local.ipynb`
233
+
234
+ Restart notebook kernels after code changes. Stale kernels can keep old module
235
+ objects, especially around `pmpp.corrections` and multi-GPU configuration.
236
+
237
+ ## License
238
+
239
+ PM++ is distributed under the BSD-3-Clause license; see [LICENSE](LICENSE).
240
+ PM++ is based on PMWD and retains the original PMWD BSD 3-Clause notice in
241
+ [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md). The `pmwd/` directory is kept
242
+ as a reference implementation for validation.
pmpp-0.1.3/README.md ADDED
@@ -0,0 +1,205 @@
1
+ # PM++: Multi-GPU Particle-Mesh Cosmology
2
+
3
+ [![Documentation Status](https://readthedocs.org/projects/pmpp-docs/badge/?version=latest)](https://pmpp-docs.readthedocs.io/en/latest/?badge=latest)
4
+
5
+ PM++ is a JAX-based, differentiable particle-mesh cosmology code built on top
6
+ of PMWD ideas and extended for multi-GPU simulations. The active implementation
7
+ is imported as `pmpp` and lives in `src/pmpp/`; the `pmwd/` directory is kept as a reference implementation for
8
+ validation.
9
+
10
+ ## Current Scope
11
+
12
+ - Multi-GPU PM N-body simulation with JAX.
13
+ - Preferred `mesh_halo` multi-GPU mode.
14
+ - PMWD comparison tests for forward and gradient correctness.
15
+ - Distributed FFT support for sharded meshes.
16
+ - LPT, Boltzmann/growth utilities, scatter/gather, and power-spectrum tools.
17
+ - Potential-correction models under `src/pmpp/corrections/`.
18
+
19
+ ## Repository Layout
20
+
21
+ ```text
22
+ PMpp/
23
+ |-- src/pmpp/ # Active importable PM++ package
24
+ | |-- configuration.py # Simulation configuration
25
+ | |-- multigpu_configuration.py# Multi-GPU mode/configuration object
26
+ | |-- particles.py # Particle state and ownership
27
+ | |-- scatter.py # Particle-to-mesh assignment
28
+ | |-- gather.py # Mesh-to-particle interpolation
29
+ | |-- gravity.py # PM force solve
30
+ | |-- steps.py # Drift, kick, force, adjoint pieces
31
+ | |-- nbody.py # Full N-body integration and VJP
32
+ | |-- FFT_distributed.py # Distributed FFT construction
33
+ | |-- mesh_halo.py # Mesh halo exchange helpers
34
+ | |-- modes.py # White noise and linear modes
35
+ | |-- lpt.py # LPT initialization
36
+ | |-- power_spectrum.py # Density and particle P(k)
37
+ | |-- corrections/ # Potential corrections
38
+ | `-- potential_correction.py # Backward-compatible correction facade
39
+ |-- pmwd/ # Reference PMWD implementation
40
+ |-- tests/ # Regression and gradient tests
41
+ |-- scripts/ # Benchmarks and diagnostics
42
+ |-- notebooks/ # Examples and exploratory notebooks
43
+ `-- docs/ # Project documentation
44
+ ```
45
+
46
+ ## Minimal Multi-GPU Setup
47
+
48
+ New code should use the nested `MultiGPUConfiguration` object. The older
49
+ top-level `compute_mesh=` compatibility path still exists, but is not preferred.
50
+
51
+ ```python
52
+ import jax
53
+ import jax.numpy as jnp
54
+
55
+ from pmpp.configuration import Configuration
56
+ from pmpp.multigpu_configuration import MultiGPUConfiguration
57
+ from pmpp.utils import create_compute_mesh
58
+
59
+ res = 256
60
+ box_size = 1000.0 # Mpc/h
61
+ ptcl_grid_shape = (res, res, res)
62
+ ptcl_spacing = box_size / res
63
+
64
+ gpu_devices = [device for device in jax.devices() if device.platform == "gpu"]
65
+ if len(gpu_devices) < 2:
66
+ raise RuntimeError("This multi-GPU example requires at least 2 GPUs.")
67
+ compute_mesh = create_compute_mesh(gpu_devices)
68
+ num_devices = len(gpu_devices)
69
+
70
+ conf = Configuration(
71
+ ptcl_spacing,
72
+ ptcl_grid_shape,
73
+ mesh_shape=1,
74
+ multigpu=MultiGPUConfiguration(
75
+ compute_mesh=compute_mesh,
76
+ mode="mesh_halo",
77
+ ),
78
+ max_ptcl_per_slice=int((res**3 / num_devices) * 1.8),
79
+ max_share_ptcl=50_000,
80
+ max_halo_share_ptcl=50_000,
81
+ max_share_gather_ptcl=200_000,
82
+ float_dtype=jnp.float32,
83
+ )
84
+ ```
85
+
86
+ Capacity overflows are correctness failures. If a run reports overflow in
87
+ particle migration, halo rebuild, or gather exchange buffers, increase the
88
+ corresponding capacity and rerun.
89
+
90
+ ## Minimal Forward Run
91
+
92
+ ```python
93
+ import jax
94
+ import jax.numpy as jnp
95
+
96
+ from pmpp.boltzmann import boltzmann
97
+ from pmpp.configuration import Configuration
98
+ from pmpp.cosmo import SimpleLCDM
99
+ from pmpp.lpt import lpt
100
+ from pmpp.modes import linear_modes, white_noise
101
+ from pmpp.nbody import nbody
102
+ from pmpp.scatter import scatter
103
+
104
+ res = 32
105
+ box_size = 100.0
106
+ conf = Configuration(
107
+ box_size / res,
108
+ (res, res, res),
109
+ mesh_shape=1,
110
+ float_dtype=jnp.float32,
111
+ )
112
+
113
+ cosmo = boltzmann(SimpleLCDM(conf), conf)
114
+ modes = white_noise(0, conf)
115
+ modes = linear_modes(modes, cosmo, conf)
116
+ ptcl = lpt(modes, cosmo, conf)
117
+
118
+ nbody_jit = jax.jit(nbody, static_argnames=("conf", "reverse"))
119
+ ptcl_final = nbody_jit(ptcl, cosmo, conf)
120
+ density = scatter(ptcl_final, conf)
121
+
122
+ print(density.shape)
123
+ print(float(density.mean()))
124
+ ```
125
+
126
+ Expected sanity checks:
127
+
128
+ - density shape matches the mesh;
129
+ - density mean is close to `1.0`;
130
+ - no capacity warnings appear.
131
+
132
+ ## Potential Corrections
133
+
134
+ Correction implementations now live in `pmpp.corrections` (`src/pmpp/corrections/`).
135
+
136
+ ```python
137
+ from pmpp.corrections import (
138
+ apply_potential_correction,
139
+ evaluate_potential_transfer,
140
+ init_potential_correction,
141
+ )
142
+ ```
143
+
144
+ `pmpp.potential_correction` remains as a compatibility facade for old scripts,
145
+ but new code and tests should import from `pmpp.corrections`.
146
+
147
+ Supported correction families:
148
+
149
+ - `radial`, `radial_spline`, `neural_spline`
150
+ - `mesh_cnn`, `cnn`
151
+ - `combined`, `hybrid`, `spline_cnn`
152
+ - `pm_window`, `cic_compensation`, `cic_window_compensation`
153
+
154
+ ## Multi-GPU Modes
155
+
156
+ Prefer `mesh_halo` for current serious multi-GPU work:
157
+
158
+ - particles are stored authoritatively on their owning slab;
159
+ - particles migrate between slabs when needed;
160
+ - mesh halos are exchanged for local stencil operations;
161
+ - it is generally faster than the older particle-halo path in current
162
+ `256^3`, 2-GPU testing.
163
+
164
+ `particle_halo` remains useful for comparison and legacy validation.
165
+
166
+ ## Testing
167
+
168
+ Focused correction and gravity checks:
169
+
170
+ ```bash
171
+ /home/rouzib/.virtualenvs/PMPP/bin/python -m pytest \
172
+ tests/test_potential_correction.py \
173
+ tests/test_grad_gravity.py \
174
+ tests/test_gravity_particle_nyquist_filter.py \
175
+ -q
176
+ ```
177
+
178
+ Mesh-halo scatter/gather:
179
+
180
+ ```bash
181
+ /home/rouzib/.virtualenvs/PMPP/bin/python -m pytest tests/test_mesh_halo_scatter_gather.py -q
182
+ ```
183
+
184
+ End-to-end gradient:
185
+
186
+ ```bash
187
+ /home/rouzib/.virtualenvs/PMPP/bin/python -m pytest tests/test_grad_nbody.py -q
188
+ ```
189
+
190
+ ## Notebooks
191
+
192
+ The primary example notebooks are:
193
+
194
+ - `notebooks/pmpp_showcase.ipynb`
195
+ - `notebooks/mGPU_pmwd_local.ipynb`
196
+
197
+ Restart notebook kernels after code changes. Stale kernels can keep old module
198
+ objects, especially around `pmpp.corrections` and multi-GPU configuration.
199
+
200
+ ## License
201
+
202
+ PM++ is distributed under the BSD-3-Clause license; see [LICENSE](LICENSE).
203
+ PM++ is based on PMWD and retains the original PMWD BSD 3-Clause notice in
204
+ [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md). The `pmwd/` directory is kept
205
+ as a reference implementation for validation.
@@ -0,0 +1,35 @@
1
+ # Third-Party Notices
2
+
3
+ PM++ is based on PMWD ideas/code and keeps `pmwd/` as a reference implementation for validation. PMWD is distributed under the BSD 3-Clause License; its original notice is preserved below.
4
+
5
+ ## PMWD
6
+
7
+ BSD 3-Clause License
8
+
9
+ Copyright (c) 2021, the pmwd developers
10
+ All rights reserved.
11
+
12
+ Redistribution and use in source and binary forms, with or without
13
+ modification, are permitted provided that the following conditions are met:
14
+
15
+ 1. Redistributions of source code must retain the above copyright notice, this
16
+ list of conditions and the following disclaimer.
17
+
18
+ 2. Redistributions in binary form must reproduce the above copyright notice,
19
+ this list of conditions and the following disclaimer in the documentation
20
+ and/or other materials provided with the distribution.
21
+
22
+ 3. Neither the name of the copyright holder nor the names of its
23
+ contributors may be used to endorse or promote products derived from
24
+ this software without specific prior written permission.
25
+
26
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
29
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
30
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
32
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
33
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
34
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,70 @@
1
+ [build-system]
2
+ requires = ["hatchling>=1.26"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "pmpp"
7
+ version = "0.1.3"
8
+ description = "PM++: a JAX-based differentiable multi-GPU Particle-Mesh cosmology simulator."
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = "BSD-3-Clause"
12
+ license-files = ["LICENSE", "THIRD_PARTY_NOTICES.md"]
13
+ authors = [
14
+ { name = "rouzib" },
15
+ ]
16
+ keywords = [
17
+ "cosmology",
18
+ "particle-mesh",
19
+ "jax",
20
+ "n-body",
21
+ "multi-gpu",
22
+ "differentiable-simulation",
23
+ ]
24
+ classifiers = [
25
+ "Development Status :: 3 - Alpha",
26
+ "Intended Audience :: Science/Research",
27
+ "License :: OSI Approved :: BSD License",
28
+ "Programming Language :: Python :: 3",
29
+ "Programming Language :: Python :: 3.10",
30
+ "Programming Language :: Python :: 3.11",
31
+ "Programming Language :: Python :: 3.12",
32
+ "Topic :: Scientific/Engineering :: Astronomy",
33
+ "Topic :: Scientific/Engineering :: Physics",
34
+ ]
35
+ dependencies = [
36
+ "jax>=0.4.7",
37
+ "mcfit>=0.0.18",
38
+ ]
39
+
40
+ [project.optional-dependencies]
41
+ docs = [
42
+ "jupyter-book<2.0",
43
+ "sphinx",
44
+ "sphinx-rtd-theme",
45
+ "myst-nb",
46
+ "matplotlib",
47
+ ]
48
+ dev = [
49
+ "build",
50
+ "twine",
51
+ "pytest",
52
+ ]
53
+
54
+ [project.urls]
55
+ Homepage = "https://github.com/rouzib/PMpp"
56
+ Repository = "https://github.com/rouzib/PMpp"
57
+ Documentation = "https://pmpp-v2.readthedocs.io/en/latest/"
58
+ Issues = "https://github.com/rouzib/PMpp/issues"
59
+
60
+ [tool.hatch.build.targets.wheel]
61
+ packages = ["src/pmpp"]
62
+
63
+ [tool.hatch.build.targets.sdist]
64
+ include = [
65
+ "/src/pmpp",
66
+ "/README.md",
67
+ "/LICENSE",
68
+ "/THIRD_PARTY_NOTICES.md",
69
+ "/pyproject.toml",
70
+ ]