source: XIOS/dev/branch_yushan/extern/src_ep_dev/ep_barrier.cpp @ 1037

Last change on this file since 1037 was 1037, checked in by yushan, 7 years ago

initialize the branch

File size: 756 bytes
Line 
1#include "ep_lib.hpp"
2#include <mpi.h>
3//#include "ep_declaration.hpp"
4
5namespace ep_lib
6{
7
8
9
10  int MPI_Barrier(MPI_Comm comm)
11  {
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 = static_cast< ::MPI_Comm > (comm.mpi_comm);
22        ::MPI_Barrier(mpi_comm);
23      }
24
25      MPI_Barrier_local(comm);
26
27      return 0;
28    }
29    else if(comm.mpi_comm !=0 )
30    {
31      ::MPI_Comm mpi_comm = static_cast< ::MPI_Comm> (comm.mpi_comm);
32      ::MPI_Barrier(mpi_comm);
33      return 0;
34    }
35
36    else return 0;
37  }
38
39  int MPI_Barrier_local(MPI_Comm comm)
40  {
41    //Message_Check(comm);
42    comm.ep_barrier->wait();
43  }
44
45
46}
47
48
Note: See TracBrowser for help on using the repository browser.