Skip to content

PC::make_alike<Allocator> Change Default#4771

Merged
ax3l merged 1 commit intoAMReX-Codes:developmentfrom
ax3l:pc-make-alike-same-alloc
Nov 14, 2025
Merged

PC::make_alike<Allocator> Change Default#4771
ax3l merged 1 commit intoAMReX-Codes:developmentfrom
ax3l:pc-make-alike-same-alloc

Conversation

@ax3l
Copy link
Copy Markdown
Member

@ax3l ax3l commented Nov 10, 2025

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 PolymorphicArena allocators, 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:

  • fix a bug or incorrect behavior in AMReX
  • add new capabilities to AMReX
  • changes answers in the test suite to more than roundoff level
  • are likely to significantly affect the results of downstream AMReX users
  • include documentation in the code and/or rst files, if appropriate

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.
@ax3l ax3l requested review from WeiqunZhang and atmyers November 10, 2025 05:00
@ax3l ax3l changed the title PC::make_alike<Allocator> PC::make_alike<Allocator> Change Default Nov 10, 2025
@ax3l ax3l mentioned this pull request Nov 10, 2025
7 tasks
@ax3l ax3l merged commit d0e2504 into AMReX-Codes:development Nov 14, 2025
73 checks passed
@ax3l ax3l deleted the pc-make-alike-same-alloc branch November 14, 2025 17:52
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants