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

Function WaitAnyRegion

Tools/AMRProfParser/TestCodes/ProfWaitTest.cpp:166–210  ·  view source on GitHub ↗

---------------------------------------------------------------

Source from the content-addressed store, hash-verified

164
165//---------------------------------------------------------------
166void WaitAnyRegion() {
167 BL_PROFILE_REGION_START("R::WaitAny");
168 BL_PROFILE("WaitAny");
169 int nProcs(ParallelDescriptor::NProcs());
170 int myProc(ParallelDescriptor::MyProc());
171
172 Vector<long> snds(nProcs,0);
173 MPI_Status stats;
174 Vector<MPI_Request> rreqs(nProcs-1);
175 const int SeqNum = ParallelDescriptor::SeqNum();
176 Vector<int> data(nProcs, myProc);
177 int nSends = nProcs-1;
178 int j;
179
180 j=0;
181 for (int i=0; i<nProcs; ++i)
182 {
183 if (i != myProc)
184 {
185 rreqs[j] = ParallelDescriptor::Arecv(&data[i], 1, i, SeqNum).req();
186 j++;
187 }
188 }
189
190 j=0;
191 for (int i=0; i<nProcs; ++i)
192 {
193 if (i != myProc)
194 {
195 ParallelDescriptor::Send(&data[j], 1, i, SeqNum);
196 j++;
197 }
198 }
199
200 amrex::Print() << "Waitany: " << endl;
201 int indx = -1;
202 for (int i=0; i<nSends; ++i)
203 {
204 ParallelDescriptor::Waitany(rreqs, indx, stats);
205 amrex::Print() << myProc << " :data[" << indx+1 << "] = " << data[indx+1] << endl;
206 }
207 amrex::Print() << myProc << " :data[" << myProc << "] = " << data[myProc] << endl;
208
209 BL_PROFILE_REGION_STOP("R::WaitAny");
210}
211
212
213// --------------------------------------------------------------

Callers 1

mainFunction · 0.85

Calls 8

SeqNumFunction · 0.85
ArecvFunction · 0.85
SendFunction · 0.85
PrintClass · 0.85
WaitanyFunction · 0.85
reqMethod · 0.80
NProcsFunction · 0.50
MyProcFunction · 0.50

Tested by

no test coverage detected