Skip to content

Commit

Permalink
Use The_Comms_Arena in particle communication. (AMReX-Codes#4175)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
atmyers authored Oct 23, 2024
1 parent c060294 commit dc745bb
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Src/Particle/AMReX_NeighborParticles.H
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ protected:
ParticleCopyPlan neighbor_copy_plan;

amrex::PODVector<char, PolymorphicArenaAllocator<char> > snd_buffer;
amrex::Gpu::DeviceVector<char> rcv_buffer;
amrex::PODVector<char, PolymorphicArenaAllocator<char> > rcv_buffer;

Gpu::PinnedVector<char> pinned_snd_buffer;
Gpu::PinnedVector<char> pinned_rcv_buffer;
Expand Down
6 changes: 6 additions & 0 deletions Src/Particle/AMReX_NeighborParticlesGPUImpl.H
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,12 @@ updateNeighborsGPU (bool boundary_neighbors_only)
}

clearNeighbors();

if (ParallelDescriptor::UseGpuAwareMpi()) {
snd_buffer.setArena(The_Comms_Arena());
rcv_buffer.setArena(The_Comms_Arena());
}

packBuffer(*this, neighbor_copy_op, neighbor_copy_plan, snd_buffer);
if (ParallelDescriptor::UseGpuAwareMpi())
{
Expand Down
8 changes: 7 additions & 1 deletion Src/Particle/AMReX_ParticleContainerI.H
Original file line number Diff line number Diff line change
Expand Up @@ -1388,8 +1388,14 @@ ParticleContainer_impl<ParticleType, NArrayReal, NArrayInt, Allocator, CellAssig
plan.build(*this, op, h_redistribute_int_comp,
h_redistribute_real_comp, local);

// by default, this uses The_Arena();
amrex::PODVector<char, PolymorphicArenaAllocator<char> > snd_buffer;
Gpu::DeviceVector<char> rcv_buffer;
amrex::PODVector<char, PolymorphicArenaAllocator<char> > rcv_buffer;

if (ParallelDescriptor::UseGpuAwareMpi()) {
snd_buffer.setArena(The_Comms_Arena());
rcv_buffer.setArena(The_Comms_Arena());
}

packBuffer(*this, op, plan, snd_buffer);

Expand Down

0 comments on commit dc745bb

Please sign in to comment.