---------------------------------------------------------------
| 91 | |
| 92 | //--------------------------------------------------------------- |
| 93 | void TestCommCalls() { |
| 94 | BL_PROFILE("TestCommCalls()"); |
| 95 | BL_PROFILE_REGION_START("TestCommCalls()"); |
| 96 | |
| 97 | if(ParallelDescriptor::IOProcessor()) { |
| 98 | cout << "Testing mixed communication calls." << endl; |
| 99 | } |
| 100 | |
| 101 | //long nChunks(100), chunkSize(1000000); |
| 102 | long nChunks(4), chunkSize(1000); |
| 103 | Real totalTime(0.0); |
| 104 | long reqsSize(37); |
| 105 | Vector<MPI_Request> reqs(reqsSize); |
| 106 | Vector<MPI_Status> status(reqsSize); |
| 107 | Vector<int> index(reqsSize); |
| 108 | int completed(0), sendSize(32), destPid(42), tag(127); |
| 109 | |
| 110 | for(long t(0); t < nChunks; ++t) { |
| 111 | BL_PROFILE_REGION_START("Chunks()"); |
| 112 | Real startTime(ParallelDescriptor::second()); |
| 113 | for(long n(0); n < chunkSize; ++n) { |
| 114 | BL_COMM_PROFILE_BARRIER("Barrier0", true); |
| 115 | BL_COMM_PROFILE_ALLREDUCE(BLProfiler::AllReduceR, BLProfiler::BeforeCall(), true); |
| 116 | BL_COMM_PROFILE_ALLREDUCE(BLProfiler::AllReduceR, sizeof(Real), false); |
| 117 | BL_COMM_PROFILE_BARRIER("Barrier0", false); |
| 118 | BL_COMM_PROFILE_BARRIER("Barrier1", true); |
| 119 | BL_COMM_PROFILE_REDUCE(BLProfiler::AllReduceR, BLProfiler::BeforeCall(), true); |
| 120 | BL_COMM_PROFILE(BLProfiler::AsendTsii, sendSize * sizeof(Real), destPid, tag); |
| 121 | BL_COMM_PROFILE_WAITSOME(BLProfiler::Waitsome, reqs, completed, index, status, true); |
| 122 | BL_COMM_PROFILE(BLProfiler::ArecvTsiiM, sendSize * sizeof(Real), destPid, tag); |
| 123 | BL_COMM_PROFILE_BARRIER("Barrier1", false); |
| 124 | } |
| 125 | totalTime += ParallelDescriptor::second() - startTime; |
| 126 | BL_PROFILE_REGION_STOP("Chunks()"); |
| 127 | } |
| 128 | |
| 129 | long nCalls(nChunks * chunkSize * 10); // ---- ten calls in loop above |
| 130 | long millionCalls(nCalls / 1000000); |
| 131 | cout << ParallelDescriptor::MyProc() |
| 132 | << ":: TestFunctionCalls: NCalls/proc = " << millionCalls |
| 133 | << " million totalTime = " << totalTime |
| 134 | << " mCPS = " << millionCalls / totalTime << endl; |
| 135 | |
| 136 | BL_PROFILE_REGION_STOP("TestCommCalls()"); |
| 137 | } |
| 138 | |
| 139 | |
| 140 | //--------------------------------------------------------------- |
no test coverage detected