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

Function WaitRegion

Tools/AMRProfParser/TestCodes/ProfWaitTest.cpp:24–68  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

22
23//---------------------------------------------------------------
24void WaitRegion() {
25 BL_PROFILE_REGION_START("R::Wait");
26 BL_PROFILE("Wait");
27 int nProcs(ParallelDescriptor::NProcs());
28 int myProc(ParallelDescriptor::MyProc());
29
30 Vector<long> snds(nProcs,0);
31 Vector<MPI_Status> stats(nProcs-1);
32 Vector<MPI_Request> rreqs(nProcs-1);
33 const int SeqNum = ParallelDescriptor::SeqNum();
34 Vector<int> data(nProcs, myProc);
35 int nSends = nProcs-1;
36 int j;
37
38 j=0;
39 for (int i=0; i<nProcs; ++i)
40 {
41 if (i != myProc)
42 {
43 rreqs[j] = ParallelDescriptor::Arecv(&data[i], 1, i, SeqNum).req();
44 j++;
45 }
46 }
47
48 j=0;
49 for (int i=0; i<nProcs; ++i)
50 {
51 if (i != myProc)
52 {
53 ParallelDescriptor::Send(&data[j], 1, i, SeqNum);
54 j++;
55 }
56 }
57
58 for (int i=0; i<nSends; ++i)
59 {
60 ParallelDescriptor::Wait(rreqs[i], stats[i]);
61 }
62
63 amrex::Print() << "Wait: " << endl;
64 for (int i=0; i<nProcs; i++)
65 { amrex::Print() << "data[" << i << "] = " << data[i] << endl; }
66
67 BL_PROFILE_REGION_STOP("R::Wait");
68}
69
70//---------------------------------------------------------------
71void WaitAllRegion() {

Callers 1

mainFunction · 0.85

Calls 8

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

Tested by

no test coverage detected