---------------------------------------------------------------
| 69 | |
| 70 | //--------------------------------------------------------------- |
| 71 | void 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 | //--------------------------------------------------------------- |
| 114 | void WaitSomeRegion() { |