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

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

server mode OK for both multiple and one file mode. Tested with test_client

File size: 1.2 KB
RevLine 
[1037]1#include "ep_lib.hpp"
2#include <mpi.h>
[1063]3#include "ep_declaration.hpp"
[1037]4
5namespace ep_lib
6{
7
8  int MPI_Barrier(MPI_Comm comm)
9  {
[1063]10    if(comm.is_intercomm) return MPI_Barrier_intercomm(comm);
[1037]11
12    if(comm.is_ep)
13    {
14      int ep_rank_loc = comm.ep_comm_ptr->size_rank_info[1].first;
15
16      MPI_Barrier_local(comm);
17
18      if(ep_rank_loc == 0)
19      {
20        ::MPI_Comm mpi_comm = static_cast< ::MPI_Comm > (comm.mpi_comm);
[1063]21
[1037]22        ::MPI_Barrier(mpi_comm);
23      }
24
25      MPI_Barrier_local(comm);
26
27      return 0;
28    }
[1063]29    else if(comm.mpi_comm != MPI_COMM_NULL_STD )
[1037]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
[1063]39
40  int MPI_Barrier_intercomm(MPI_Comm comm)
41  {
42
43    int ep_rank_loc = comm.ep_comm_ptr->size_rank_info[1].first;
44
45    MPI_Barrier_local(comm);
46
47    if(ep_rank_loc == 0)
48    {
49      ::MPI_Comm mpi_comm = static_cast< ::MPI_Comm > (comm.ep_comm_ptr->intercomm->mpi_inter_comm);
50      ::MPI_Barrier(mpi_comm);
51    }
52
53    MPI_Barrier_local(comm);
54
55    return 0;
56
57  }
58
59
[1037]60  int MPI_Barrier_local(MPI_Comm comm)
61  {
[1063]62    Message_Check(comm);
[1037]63    comm.ep_barrier->wait();
64  }
65
66
67}
68
69
Note: See TracBrowser for help on using the repository browser.