source: XIOS/dev/branch_openmp/extern/ep_dev/ep_size.cpp @ 1525

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

save dev : intercomm_create via intracomm. To do : modif related intercomm communication routines, barrier, free, rank, size...

File size: 1.4 KB
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  int MPI_Comm_size(MPI_Comm comm, int* size)
10  {
11    if(comm->is_ep)
12    {
13      Debug("MPI_Comm_size with EP");
14      return *size = comm->ep_comm_ptr->size_rank_info[0].second;
15    }
16
17    return MPI_Comm_size_mpi(comm, size);
18  }
19
20  int MPI_Comm_remote_size(MPI_Comm comm, int *size)
21  {
22    if(comm->is_ep)
23    {
24      if(comm->is_intercomm)
25      {
26        Debug("MPI_Comm_remote_size with EP_intercomm");
27        return *size = comm->ep_comm_ptr->intercomm->intercomm_rank_map->size();
28      }
29      else
30      {
31        Debug("MPI_Comm_remote_size with EP_intracomm");
32        return *size=0;
33      }
34    }
35    return MPI_Comm_remote_size_mpi(comm, size);
36  }
37
38  int MPI_Comm_remote_size2(MPI_Comm comm, int *size)
39  {
40    if(comm->is_ep)
41    {
42      if(comm->is_intercomm)
43      {
44        Debug("MPI_Comm_remote_size with EP_intercomm");
45        return *size = comm->inter_rank_map->size();
46      }
47      return *size=0;
48    }
49    return MPI_Comm_remote_size_mpi(comm, size);
50  }
51
52
53  int MPI_Comm_size_mpi(MPI_Comm comm, int* size)
54  {
55    Debug("MPI_Comm_size with MPI");
56    return ::MPI_Comm_size(to_mpi_comm(comm->mpi_comm), size);
57  }
58
59  int MPI_Comm_remote_size_mpi(MPI_Comm comm, int *size)
60  {
61    Debug("MPI_Comm_remote_size with MPI");
62    return ::MPI_Comm_remote_size(to_mpi_comm(comm->mpi_comm), size);
63  }
64
65}
66
67
Note: See TracBrowser for help on using the repository browser.