MCPcopy Create free account
hub / github.com/AMReX-Codes/amrex / doHandShakeLocal

Method doHandShakeLocal

Src/Particle/AMReX_ParticleCommunication.cpp:288–330  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

286}
287
288void ParticleCopyPlan::doHandShakeLocal (const Vector<Long>& Snds, Vector<Long>& Rcvs) const // NOLINT(readability-convert-member-functions-to-static)
289{
290#ifdef AMREX_USE_MPI
291 const int SeqNum = ParallelDescriptor::SeqNum();
292 const auto num_rcvs = static_cast<int>(m_neighbor_procs.size());
293 Vector<MPI_Status> rstats(num_rcvs);
294 Vector<MPI_Request> rreqs(num_rcvs);
295 Vector<MPI_Status> sstats(num_rcvs);
296 Vector<MPI_Request> sreqs(num_rcvs);
297
298 // Post receives
299 for (int i = 0; i < num_rcvs; ++i)
300 {
301 const int Who = m_neighbor_procs[i];
302 const Long Cnt = 1;
303
304 AMREX_ASSERT(Who >= 0 && Who < ParallelContext::NProcsSub());
305
306 rreqs[i] = ParallelDescriptor::Arecv(&Rcvs[Who], Cnt, Who, SeqNum,
307 ParallelContext::CommunicatorSub()).req();
308 }
309
310 // Send.
311 for (int i = 0; i < num_rcvs; ++i)
312 {
313 const int Who = m_neighbor_procs[i];
314 const Long Cnt = 1;
315
316 AMREX_ASSERT(Who >= 0 && Who < ParallelContext::NProcsSub());
317
318 sreqs[i] = ParallelDescriptor::Asend(&Snds[Who], Cnt, Who, SeqNum,
319 ParallelContext::CommunicatorSub()).req();
320 }
321
322 if (num_rcvs > 0)
323 {
324 ParallelDescriptor::Waitall(sreqs, sstats);
325 ParallelDescriptor::Waitall(rreqs, rstats);
326 }
327#else
328 amrex::ignore_unused(Snds,Rcvs);
329#endif
330}
331
332void ParticleCopyPlan::doHandShakeAllToAll (const Vector<Long>& Snds, Vector<Long>& Rcvs)
333{

Callers

nothing calls this directly

Calls 8

SeqNumFunction · 0.85
NProcsSubFunction · 0.85
ArecvFunction · 0.85
CommunicatorSubFunction · 0.85
AsendFunction · 0.85
WaitallFunction · 0.85
reqMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected