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

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

initialize the branch

File size: 728 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_Comm_rank(MPI_Comm comm, int* rank)
11  {
12
13    if(comm.is_ep)
14    {
15      Debug("Calling EP_Comm_rank\n");
16
17      if(comm.is_intercomm)
18      {
19        *rank = comm.ep_comm_ptr->intercomm->size_rank_info[0].first;
20        return 0;
21      }
22      else
23      {
24        *rank = comm.ep_comm_ptr->size_rank_info[0].first;
25        return 0;
26      }
27    }
28
29
30    if(comm.mpi_comm)
31    {
32      ::MPI_Comm mpi_comm = static_cast< ::MPI_Comm > (comm.mpi_comm);
33      ::MPI_Comm_rank(mpi_comm, rank);
34      return 0;
35    }
36    else
37    {
38      printf("rank is undefined\n");
39
40      *rank = MPI_UNDEFINED;
41      return 0;
42    }
43
44  }
45
46
47
48}
49
50
Note: See TracBrowser for help on using the repository browser.