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

Function WaitAllRegion

Tools/AMRProfParser/TestCodes/ProfWaitTest.cpp:71–111  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

69
70//---------------------------------------------------------------
71void WaitAllRegion() {
72 BL_PROFILE_REGION_START("R::WaitAll");
73 BL_PROFILE("WaitAll");
74 int nProcs(ParallelDescriptor::NProcs());
75 int myProc(ParallelDescriptor::MyProc());
76
77 Vector<long> snds(nProcs,0);
78 Vector<MPI_Status> stats(nProcs-1);
79 Vector<MPI_Request> rreqs(nProcs-1);
80 const int SeqNum = ParallelDescriptor::SeqNum();
81 Vector<int> data(nProcs, myProc);
82 int j;
83
84 j=0;
85 for (int i=0; i<nProcs; ++i)
86 {
87 if (i != myProc)
88 {
89 rreqs[j] = ParallelDescriptor::Arecv(&data[i], 1, i, SeqNum).req();
90 j++;
91 }
92 }
93
94 j=0;
95 for (int i=0; i<nProcs; ++i)
96 {
97 if (i != myProc)
98 {
99 ParallelDescriptor::Send(&data[j], 1, i, SeqNum);
100 j++;
101 }
102 }
103
104 ParallelDescriptor::Waitall(rreqs, stats);
105
106 amrex::Print() << "Waitall: " << endl;
107 for (int i=0; i<nProcs; i++)
108 { amrex::Print() << "data[" << i << "] = " << data[i] << endl; }
109
110 BL_PROFILE_REGION_STOP("R::WaitAll");
111}
112
113//---------------------------------------------------------------
114void WaitSomeRegion() {

Callers 1

mainFunction · 0.85

Calls 8

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

Tested by

no test coverage detected