Skip to content

PODVector: Add _default Platform Aliases#540

Merged
ax3l merged 4 commits intoAMReX-Codes:developmentfrom
ax3l:topic-podvector-default
Mar 2, 2026
Merged

PODVector: Add _default Platform Aliases#540
ax3l merged 4 commits intoAMReX-Codes:developmentfrom
ax3l:topic-podvector-default

Conversation

@ax3l
Copy link
Copy Markdown
Member

@ax3l ax3l commented Mar 2, 2026

Update: Renamed what was added here in PR #545.
What I actually meant with this PR is amrex::Gpu::DeviceVector<amrex::Real>. When Cuda is off, all these containers revert to amrex::Gpu::PODVector.
https://github.com/AMReX-Codes/amrex/blob/26.03/Src/Base/AMReX_GpuContainers.H#L23-L24
https://github.com/AMReX-Codes/amrex/blob/26.03/Src/Base/AMReX_GpuContainers.H#L79-L81

Register PODVector_{real,int,uint64}_default as aliases that resolve to _std on CPU builds and _arena on GPU builds, matching the C++ Gpu::DeviceVector<T> type per platform.
For other containers like PC & MF we an just use the default arena, but PODVector is implemented a bit special, relying on a std::allocator instead of the default arena on CPU.

This helps to write CPU/GPU agnostic interfaces, e.g., in BLAST-ImpactX/impactx#1305

@ax3l ax3l added enhancement New feature or request backend: cuda Specific to CUDA execution (GPUs) backend: sycl Specific to DPC++/SYCL execution (CPUs/GPUs) backend: hip Specific to ROCm execution (GPUs) backend: openmp Specific to OpenMP execution (CPUs) labels Mar 2, 2026
@ax3l ax3l force-pushed the topic-podvector-default branch from 432d037 to 64d6673 Compare March 2, 2026 08:18
Register `PODVector_{real,int,uint64}_default` as aliases that
resolve to `_std` on CPU builds and `_arena` on GPU builds,
matching the C++ `Gpu::DeviceVector<T>` type per platform.

This helps to write CPU/GPU agnostic interfaces, e.g., in
BLAST-ImpactX/impactx#1305
@ax3l ax3l force-pushed the topic-podvector-default branch from 64d6673 to 3e09aef Compare March 2, 2026 08:28
ax3l added a commit to ax3l/impactx that referenced this pull request Mar 2, 2026
@ax3l ax3l force-pushed the topic-podvector-default branch from 505104c to 046a43d Compare March 2, 2026 17:45
@ax3l ax3l merged commit 805bfbe into AMReX-Codes:development Mar 2, 2026
26 of 27 checks passed
@ax3l ax3l deleted the topic-podvector-default branch March 2, 2026 22:41
ax3l added a commit to ax3l/impactx that referenced this pull request Mar 3, 2026
@ax3l
Copy link
Copy Markdown
Member Author

ax3l commented Mar 4, 2026

What I actually meant with this PR is amrex::Gpu::DeviceVector<amrex::Real>. When Cuda is off, all these containers revert to amrex::Gpu::PODVector.
https://github.com/AMReX-Codes/amrex/blob/26.03/Src/Base/AMReX_GpuContainers.H#L23-L24
https://github.com/AMReX-Codes/amrex/blob/26.03/Src/Base/AMReX_GpuContainers.H#L79-L81

Maybe should rename them in a follow-up to make it clearer: #545

ax3l added a commit to ax3l/pyamrex that referenced this pull request Mar 4, 2026
Follow-up to AMReX-Codes#540, renaming the `PODVector_{real,int,uint64}_default`
to `DeviceVector_{real,int,uint64}` et al. Implement the aliases
for `AMReX_GpuContainers.H`
@ax3l ax3l mentioned this pull request Mar 4, 2026
1 task
ax3l added a commit to ax3l/pyamrex that referenced this pull request Mar 4, 2026
Follow-up to AMReX-Codes#540, renaming the `PODVector_{real,int,uint64}_default`
to `DeviceVector_{real,int,uint64}` et al. Implement the aliases
for `AMReX_GpuContainers.H`
cemitch99 pushed a commit to BLAST-ImpactX/impactx that referenced this pull request Mar 6, 2026
* Fix: Python Wake Tests on GPU

Ensure the CSR wake Python tests work also on GPU.

* Use new `PODVector_*_default`

See AMReX-Codes/pyamrex#540
ax3l added a commit to ax3l/pyamrex that referenced this pull request Apr 5, 2026
Follow-up to AMReX-Codes#540, renaming the `PODVector_{real,int,uint64}_default`
to `DeviceVector_{real,int,uint64}` et al. Implement the aliases
for `AMReX_GpuContainers.H`
ax3l added a commit to ax3l/pyamrex that referenced this pull request Apr 5, 2026
Follow-up to AMReX-Codes#540, renaming the `PODVector_{real,int,uint64}_default`
to `DeviceVector_{real,int,uint64}` et al. Implement the aliases
for `AMReX_GpuContainers.H`
ax3l added a commit to ax3l/pyamrex that referenced this pull request Apr 6, 2026
Follow-up to AMReX-Codes#540, renaming the `PODVector_{real,int,uint64}_default`
to `DeviceVector_{real,int,uint64}` et al. Implement the aliases
for `AMReX_GpuContainers.H`
ax3l added a commit that referenced this pull request Apr 6, 2026
Follow-up to #540, renaming the `PODVector_{real,int,uint64}_default` to
`DeviceVector_{real,int,uint64}` et al. Implement the aliases for
`AMReX_GpuContainers.H`

- [x] resolve inconsistency mentioned in
AMReX-Codes/amrex#5123

---------

Signed-off-by: Axel Huebl <axel.huebl@plasma.ninja>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend: cuda Specific to CUDA execution (GPUs) backend: hip Specific to ROCm execution (GPUs) backend: openmp Specific to OpenMP execution (CPUs) backend: sycl Specific to DPC++/SYCL execution (CPUs/GPUs) enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant