source: XIOS/dev/branch_openmp/extern/src_ep_dev/ep_barrier.cpp @ 1539

Last change on this file since 1539 was 1539, checked in by yushan, 6 years ago

update intercomm_merge and remove redundant files

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