Skip to content

Commit

Permalink
Fix offset in recv buffer of single precision particle communication
Browse files Browse the repository at this point in the history
A similar bug was fixed in #3758 for the particle send buffer. But we did
not notice the issue in the receive buffer at the time. The offset for the
`i`th buffer might be aligned for the `i`th buffer's communication data
type, not the previous buffer.
  • Loading branch information
WeiqunZhang committed Apr 17, 2024
1 parent 2780fa8 commit eac844c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Src/Particle/AMReX_ParticleCommunication.H
Original file line number Diff line number Diff line change
Expand Up @@ -481,10 +481,10 @@ void communicateParticlesStart (const PC& pc, ParticleCopyPlan& plan, const SndB
for (int i = 0; i < NProcs; ++i) {
if (plan.m_rcv_num_particles[i] > 0) {
RcvProc.push_back(i);
rOffset.push_back(TotRcvBytes);
Long nbytes = plan.m_rcv_num_particles[i]*psize;
std::size_t acd = ParallelDescriptor::sizeof_selected_comm_data_type(nbytes);
TotRcvBytes = Long(amrex::aligned_size(acd, TotRcvBytes));
rOffset.push_back(TotRcvBytes);
TotRcvBytes += Long(amrex::aligned_size(acd, nbytes));
plan.m_rcv_pad_correction_h.push_back(plan.m_rcv_pad_correction_h.back() + nbytes);
}
Expand Down

0 comments on commit eac844c

Please sign in to comment.