source: XIOS/dev/branch_openmp/extern/src_ep_dev/ep_rank.cpp @ 1354

Last change on this file since 1354 was 1354, checked in by yushan, 4 years ago

omp dev : unify MPI_Comm type

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.