PC::make_alike<Allocator> Change Default#4771
Merged
ax3l merged 1 commit intoAMReX-Codes:developmentfrom Nov 14, 2025
Merged
Conversation
Change the template default of `make_alike<>()` to use the same allocator as the creating allocator. This is a breaking change. In practice, this was so far used to create a pinned allocator, e.g., for I/O operations. It is more sensible to create the same allocator if unspecified as the creating PC and it also makes "modern"/future AMReX, which uses PCs with `PolymorphicArena` allocators, shorter/cleaner in user code.
PC::make_alike<Allocator>PC::make_alike<Allocator> Change Default
WeiqunZhang
approved these changes
Nov 10, 2025
atmyers
pushed a commit
to BLAST-WarpX/warpx
that referenced
this pull request
Feb 20, 2026
- [x] replace all templates - [x] `setArena`, update `define()` calls, etc. - [x] remove unnecessary classes (e.g., `PinnedMemoryParticleContainer`): if `WarpXParticleContainer` had not purely virtual functions, this would be cleaner to implement (adding a `WarpXParticleContainer::Base` for now). - [x] test again on GPU at runtime - [x] rebase on AMReX-Codes/pyamrex#428 - [x] rebase on AMReX-Codes/amrex#4771 and simplify `make_alike` calls - [x] rebase on AMReX-Codes/amrex#4776 and AMReX-Codes/amrex#4948 and AMReX-Codes/amrex#4949
atmyers
pushed a commit
to atmyers/WarpX
that referenced
this pull request
Mar 23, 2026
- [x] replace all templates - [x] `setArena`, update `define()` calls, etc. - [x] remove unnecessary classes (e.g., `PinnedMemoryParticleContainer`): if `WarpXParticleContainer` had not purely virtual functions, this would be cleaner to implement (adding a `WarpXParticleContainer::Base` for now). - [x] test again on GPU at runtime - [x] rebase on AMReX-Codes/pyamrex#428 - [x] rebase on AMReX-Codes/amrex#4771 and simplify `make_alike` calls - [x] rebase on AMReX-Codes/amrex#4776 and AMReX-Codes/amrex#4948 and AMReX-Codes/amrex#4949
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
Change the template default of
make_alike<>()to use the same allocator as the creating allocator. This is a breaking change.In practice, this was so far used to create a pinned allocator, e.g., for I/O operations. It is more sensible to create the same allocator if unspecified as the creating PC and it also makes "modern"/future AMReX, which uses PCs with
PolymorphicArenaallocators, shorter/cleaner in user code.Additional background
Introduced a few years ago for BLAST codes. Not sure how widely this is used yet, will ask on Slack, too. I doubt in practice this is used a lot without explicit template arguments.
In pyAMReX, we already implement this only for the same allocator as the creating one (no break).
See the particle roadmap.
Checklist
The proposed changes: