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

Function TestReductionCalls

Tools/AMRProfParser/TestCodes/BLProfCallTimes.cpp:63–89  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

61
62//---------------------------------------------------------------
63void TestReductionCalls() {
64 BL_PROFILE("TestReductionCalls()");
65
66 if(ParallelDescriptor::IOProcessor()) {
67 cout << "Testing reduction calls." << endl;
68 }
69
70 //long nChunks(100), chunkSize(1000000);
71 long nChunks(10), chunkSize(1000000);
72 Real totalTime(0.0);
73
74 for(long t(0); t < nChunks; ++t) {
75 Real startTime(ParallelDescriptor::second());
76 for(long n(0); n < chunkSize; ++n) {
77 BL_COMM_PROFILE_ALLREDUCE(BLProfiler::AllReduceR, BLProfiler::BeforeCall(), true);
78 BL_COMM_PROFILE_ALLREDUCE(BLProfiler::AllReduceR, sizeof(Real), false);
79 }
80 totalTime += ParallelDescriptor::second() - startTime;
81 }
82
83 long nCalls(nChunks * chunkSize * 2); // ---- two calls in loop above
84 long millionCalls(nCalls / 1000000);
85 cout << ParallelDescriptor::MyProc()
86 << ":: TestFunctionCalls: NCalls/proc = " << millionCalls
87 << " million totalTime = " << totalTime
88 << " mCPS = " << millionCalls / totalTime << endl;
89}
90
91
92//---------------------------------------------------------------

Callers

nothing calls this directly

Calls 3

IOProcessorFunction · 0.85
secondFunction · 0.85
MyProcFunction · 0.50

Tested by

no test coverage detected