source: XIOS/dev/dev_trunk_omp/extern/src_ep_dev/ep_barrier.cpp @ 1646

Last change on this file since 1646 was 1646, checked in by yushan, 5 years ago

branch merged with trunk @1645. arch file (ep&mpi) added for ADA

File size: 782 bytes
Line 
1#ifdef _usingEP
2#include "ep_lib.hpp"
3#include <mpi.h>
4#include "ep_declaration.hpp"
5#include "ep_mpi.hpp"
6
7namespace ep_lib
8{
9
10  int MPI_Barrier(MPI_Comm comm)
11  {
12
13    if(comm->is_ep) 
14    {
15      return MPI_Barrier_endpoint(comm);
16    }
17
18   
19    return MPI_Barrier_mpi(comm);
20
21  }
22
23  int MPI_Barrier_endpoint(MPI_Comm comm)
24  {
25    int ep_rank_loc = comm->ep_comm_ptr->size_rank_info[1].first;
26
27    MPI_Barrier_local(comm);
28
29    if(ep_rank_loc == 0)
30    {
31      ::MPI_Comm mpi_comm = to_mpi_comm(comm->mpi_comm);
32
33      ::MPI_Barrier(mpi_comm);
34    }
35
36    MPI_Barrier_local(comm);
37  }
38
39
40  int MPI_Barrier_mpi(MPI_Comm comm)
41  {
42    return ::MPI_Barrier(to_mpi_comm(comm->mpi_comm));
43  }
44
45
46  int MPI_Barrier_local(MPI_Comm comm)
47  {
48    comm->ep_barrier->wait();
49  }
50
51
52}
53
54#endif
Note: See TracBrowser for help on using the repository browser.