Experimental: indexed/flat particle backends#73
Open
rogeriojorge wants to merge 3 commits intouwplasma:mainfrom
Open
Experimental: indexed/flat particle backends#73rogeriojorge wants to merge 3 commits intouwplasma:mainfrom
rogeriojorge wants to merge 3 commits intouwplasma:mainfrom
Conversation
Member
Author
|
As of now, it seems to be completely wrong, but the tests still pass. Perhaps we should harden the tests. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds physics-preserving, opt-in experimental particle backends that reduce CPU overhead via data layout changes:
fast_backend = "indexed": stores per-particle cell indices + fractional offsets to avoid repeated position->index conversions.fast_backend = "flat": flattens all species into one container (uniform shape & periodic BCs) to reduce per-species overhead.Core physics-kernel changes are limited to:
PyPIC3D/boris.py(indexed interpolation/push)PyPIC3D/J.py(indexed current deposition + 1D/2D multi-species accumulation fix)PyPIC3D/evolve.py(indexed time loop)All other touched files are routing/metadata only:
PyPIC3D/indexed_particles.py(new container + periodic index normalization)PyPIC3D/flat_particles.py(new container)PyPIC3D/initialization.py(fast_backend routing + compatibility checks)PyPIC3D/utils.py(dump metadata for flat backend)Usage
Restrictions:
flatbackend requires uniform particle shape + update flags across speciesBenchmarks (CPU)
Configs:
demos/two_stream/two_stream.toml,demos/weibel/weibel.toml, plotting disabled.Plots (artifacts branch)
Artifacts (plots + raw numbers) live in
codex/cpu-5x-indexed-artifactsand are not intended to merge into main.Runtime & speedup
Two-stream
Weibel
Raw numbers (artifacts branch)