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

Last change on this file since 1500 was 1500, checked in by yushan, 3 years ago

save dev

File size: 748 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.