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

Function doHandShakeLocal

Src/Particle/AMReX_ParticleMPIUtil.cpp:50–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48 }
49
50 Long doHandShakeLocal(const std::map<int, Vector<char> >& not_ours,
51 const Vector<int>& neighbor_procs, Vector<Long>& Snds, Vector<Long>& Rcvs)
52 {
53
54 Long NumSnds = 0;
55 for (const auto& kv : not_ours)
56 {
57 NumSnds += kv.second.size();
58 Snds[kv.first] = kv.second.size();
59 }
60
61 const int SeqNum = ParallelDescriptor::SeqNum();
62
63 const int num_rcvs = static_cast<int>(neighbor_procs.size());
64 Vector<MPI_Status> stats(num_rcvs);
65 Vector<MPI_Request> rreqs(num_rcvs);
66
67 // Post receives
68 for (int i = 0; i < num_rcvs; ++i) {
69 const int Who = neighbor_procs[i];
70 const Long Cnt = 1;
71
72 AMREX_ASSERT(Who >= 0 && Who < ParallelContext::NProcsSub());
73
74 rreqs[i] = ParallelDescriptor::Arecv(&Rcvs[Who], Cnt, Who, SeqNum,
75 ParallelContext::CommunicatorSub()).req();
76 }
77
78 // Send.
79 for (int i = 0; i < num_rcvs; ++i) {
80 const int Who = neighbor_procs[i];
81 const Long Cnt = 1;
82
83 AMREX_ASSERT(Who >= 0 && Who < ParallelContext::NProcsSub());
84
85 ParallelDescriptor::Send(&Snds[Who], Cnt, Who, SeqNum,
86 ParallelContext::CommunicatorSub());
87 }
88
89 if (num_rcvs > 0) {
90 ParallelDescriptor::Waitall(rreqs, stats);
91 }
92
93 return NumSnds;
94 }
95#endif // AMREX_USE_MPI
96
97}

Callers 1

doHandShakeMethod · 0.85

Calls 8

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

Tested by

no test coverage detected