source: XIOS/dev/branch_openmp/extern/ep_dev/ep_rank.cpp @ 1381

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

add folder for MPI EP-RMA development. Current: MPI_Win, MPI_win_create, MPI_win_fence, MPI_win_free

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