---------------------------------------------------------------
| 112 | |
| 113 | //--------------------------------------------------------------- |
| 114 | void WaitSomeRegion() { |
| 115 | BL_PROFILE_REGION_START("R::WaitSome"); |
| 116 | BL_PROFILE("WaitSome"); |
| 117 | int nProcs(ParallelDescriptor::NProcs()); |
| 118 | int myProc(ParallelDescriptor::MyProc()); |
| 119 | |
| 120 | Vector<long> snds(nProcs,0); |
| 121 | Vector<MPI_Status> stats(nProcs-1); |
| 122 | Vector<MPI_Request> rreqs(nProcs-1); |
| 123 | const int SeqNum = ParallelDescriptor::SeqNum(); |
| 124 | Vector<int> data(nProcs, myProc); |
| 125 | int nSends = nProcs-1; |
| 126 | int j; |
| 127 | |
| 128 | j=0; |
| 129 | for (int i=0; i<nProcs; ++i) |
| 130 | { |
| 131 | if (i != myProc) |
| 132 | { |
| 133 | rreqs[j] = ParallelDescriptor::Arecv(&data[i], 1, i, SeqNum).req(); |
| 134 | j++; |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | j=0; |
| 139 | for (int i=0; i<nProcs; ++i) |
| 140 | { |
| 141 | if (i != myProc) |
| 142 | { |
| 143 | ParallelDescriptor::Send(&data[j], 1, i, SeqNum); |
| 144 | j++; |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | int finished = 0; |
| 149 | while (finished < nSends) |
| 150 | { |
| 151 | int completed = -1; |
| 152 | Vector<int> indx(rreqs.size()); |
| 153 | ParallelDescriptor::Waitsome(rreqs, completed, indx, stats); |
| 154 | finished += completed; |
| 155 | |
| 156 | amrex::Print() << "Waitsome: " << endl; |
| 157 | for (int i=0; i<indx.size(); i++) |
| 158 | { amrex::Print() << myProc << " :data[" << i+1 << "] = " << data[i+1] << endl; } |
| 159 | } |
| 160 | amrex::Print() << myProc << " :data[" << myProc+1 << "] = " << data[myProc] << endl; |
| 161 | |
| 162 | BL_PROFILE_REGION_STOP("R::WaitSome"); |
| 163 | } |
| 164 | |
| 165 | //--------------------------------------------------------------- |
| 166 | void WaitAnyRegion() { |