source:
XIOS/dev/branch_openmp/extern/ep_dev/ep_barrier.cpp
@
1527
Last change on this file since 1527 was 1527, checked in by yushan, 6 years ago | |
---|---|
File size: 760 bytes |
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 | ||
[1517] | 12 | if(comm->is_ep) |
[1381] | 13 | { |
[1527] | 14 | return MPI_Barrier_endpoint(comm); |
[1517] | 15 | } |
[1381] | 16 | |
[1517] | 17 | |
18 | return MPI_Barrier_mpi(comm); | |
[1381] | 19 | |
[1517] | 20 | } |
[1381] | 21 | |
[1527] | 22 | int MPI_Barrier_endpoint(MPI_Comm comm) |
[1517] | 23 | { |
24 | int ep_rank_loc = comm->ep_comm_ptr->size_rank_info[1].first; | |
[1381] | 25 | |
[1517] | 26 | MPI_Barrier_local(comm); |
[1381] | 27 | |
[1517] | 28 | if(ep_rank_loc == 0) |
[1381] | 29 | { |
[1500] | 30 | ::MPI_Comm mpi_comm = to_mpi_comm(comm->mpi_comm); |
[1517] | 31 | |
[1381] | 32 | ::MPI_Barrier(mpi_comm); |
33 | } | |
34 | ||
[1517] | 35 | MPI_Barrier_local(comm); |
[1381] | 36 | } |
37 | ||
[1525] | 38 | |
[1517] | 39 | int MPI_Barrier_mpi(MPI_Comm comm) |
40 | { | |
41 | return ::MPI_Barrier(to_mpi_comm(comm->mpi_comm)); | |
[1381] | 42 | } |
43 | ||
44 | ||
45 | int MPI_Barrier_local(MPI_Comm comm) | |
46 | { | |
[1500] | 47 | comm->ep_barrier->wait(); |
[1381] | 48 | } |
49 | ||
50 | ||
51 | } | |
52 | ||
53 |
Note: See TracBrowser
for help on using the repository browser.