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

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

update intercomm_merge and remove redundant files

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