Last change
on this file since 1388 was
1381,
checked in by yushan, 6 years ago
|
add folder for MPI EP-RMA development. Current: MPI_Win, MPI_win_create, MPI_win_fence, MPI_win_free
|
File size:
1.2 KB
|
Rev | Line | |
---|
[1381] | 1 | #include "ep_lib.hpp" |
---|
| 2 | #include <mpi.h> |
---|
| 3 | #include "ep_declaration.hpp" |
---|
| 4 | #include "ep_mpi.hpp" |
---|
| 5 | |
---|
| 6 | namespace ep_lib |
---|
| 7 | { |
---|
| 8 | |
---|
| 9 | int MPI_Barrier(MPI_Comm comm) |
---|
| 10 | { |
---|
| 11 | if(comm.is_intercomm) return MPI_Barrier_intercomm(comm); |
---|
| 12 | |
---|
| 13 | if(comm.is_ep) |
---|
| 14 | { |
---|
| 15 | int ep_rank_loc = comm.ep_comm_ptr->size_rank_info[1].first; |
---|
| 16 | |
---|
| 17 | MPI_Barrier_local(comm); |
---|
| 18 | |
---|
| 19 | if(ep_rank_loc == 0) |
---|
| 20 | { |
---|
| 21 | ::MPI_Comm mpi_comm = to_mpi_comm(comm.mpi_comm); |
---|
| 22 | |
---|
| 23 | ::MPI_Barrier(mpi_comm); |
---|
| 24 | } |
---|
| 25 | |
---|
| 26 | MPI_Barrier_local(comm); |
---|
| 27 | |
---|
| 28 | return 0; |
---|
| 29 | } |
---|
| 30 | else if(comm.mpi_comm != static_cast< ::MPI_Comm*>(MPI_COMM_NULL.mpi_comm)) |
---|
| 31 | { |
---|
| 32 | ::MPI_Comm mpi_comm = to_mpi_comm(comm.mpi_comm); |
---|
| 33 | ::MPI_Barrier(mpi_comm); |
---|
| 34 | return 0; |
---|
| 35 | } |
---|
| 36 | |
---|
| 37 | else return 0; |
---|
| 38 | } |
---|
| 39 | |
---|
| 40 | |
---|
| 41 | int MPI_Barrier_intercomm(MPI_Comm comm) |
---|
| 42 | { |
---|
| 43 | |
---|
| 44 | int ep_rank_loc = comm.ep_comm_ptr->size_rank_info[1].first; |
---|
| 45 | |
---|
| 46 | MPI_Barrier_local(comm); |
---|
| 47 | |
---|
| 48 | if(ep_rank_loc == 0) |
---|
| 49 | { |
---|
| 50 | ::MPI_Comm mpi_comm = to_mpi_comm(comm.ep_comm_ptr->intercomm->mpi_inter_comm); |
---|
| 51 | ::MPI_Barrier(mpi_comm); |
---|
| 52 | } |
---|
| 53 | |
---|
| 54 | MPI_Barrier_local(comm); |
---|
| 55 | |
---|
| 56 | return 0; |
---|
| 57 | |
---|
| 58 | } |
---|
| 59 | |
---|
| 60 | |
---|
| 61 | int MPI_Barrier_local(MPI_Comm comm) |
---|
| 62 | { |
---|
| 63 | comm.ep_barrier->wait(); |
---|
| 64 | } |
---|
| 65 | |
---|
| 66 | |
---|
| 67 | } |
---|
| 68 | |
---|
| 69 | |
---|
Note: See
TracBrowser
for help on using the repository browser.