source:
XIOS/dev/branch_openmp/extern/ep_dev/ep_size.cpp
@
1503
Last change on this file since 1503 was 1503, checked in by yushan, 6 years ago | |
---|---|
File size: 1.3 KB |
Rev | Line | |
---|---|---|
[1381] | 1 | #include "ep_lib.hpp" |
2 | #include <mpi.h> | |
3 | #include "ep_declaration.hpp" | |
4 | #include "ep_mpi.hpp" | |
5 | ||
6 | namespace ep_lib | |
7 | { | |
8 | ||
9 | ||
10 | ||
11 | ||
12 | int MPI_Comm_size(MPI_Comm comm, int* size) | |
13 | { | |
14 | ||
[1500] | 15 | if(comm->is_ep) |
[1381] | 16 | { |
[1500] | 17 | if(!comm->is_intercomm) |
[1381] | 18 | { |
[1500] | 19 | *size = comm->ep_comm_ptr->size_rank_info[0].second; |
[1381] | 20 | |
21 | return 0; | |
22 | } | |
23 | else | |
24 | { | |
[1500] | 25 | *size = comm->ep_comm_ptr->intercomm->size_rank_info[0].second; |
[1381] | 26 | |
27 | return 0; | |
28 | } | |
29 | ||
30 | } | |
31 | ||
32 | Debug("Calling EP_Comm_size\n"); | |
33 | ||
[1500] | 34 | if(comm->mpi_comm != static_cast< ::MPI_Comm*>(MPI_COMM_NULL->mpi_comm)) |
[1381] | 35 | { |
[1500] | 36 | ::MPI_Comm mpi_comm = to_mpi_comm(comm->mpi_comm); |
[1381] | 37 | int mpi_size; |
38 | ||
39 | ::MPI_Comm_size(mpi_comm, &mpi_size); | |
40 | *size = mpi_size; | |
41 | return 0; | |
42 | } | |
43 | ||
44 | else | |
45 | { | |
46 | *size = MPI_UNDEFINED; | |
47 | return 0; | |
48 | } | |
49 | } | |
50 | ||
51 | int MPI_Comm_remote_size(MPI_Comm comm, int *size) | |
52 | { | |
[1500] | 53 | if(!comm->is_ep) |
[1381] | 54 | { |
[1500] | 55 | if(comm->mpi_comm != static_cast< ::MPI_Comm*>(MPI_COMM_NULL->mpi_comm)) |
[1381] | 56 | { |
[1500] | 57 | ::MPI_Comm mpi_comm = to_mpi_comm(comm->mpi_comm); |
[1381] | 58 | ::MPI_Comm_remote_size(mpi_comm, size); |
59 | return 0; | |
60 | } | |
61 | ||
62 | else | |
63 | { | |
64 | *size = MPI_UNDEFINED; | |
65 | return 0; | |
66 | } | |
67 | } | |
68 | ||
[1500] | 69 | if(comm->is_intercomm) |
[1381] | 70 | { |
[1500] | 71 | *size = comm->ep_comm_ptr->intercomm->remote_rank_map->size(); |
[1381] | 72 | return 0; |
73 | } | |
74 | *size = MPI_UNDEFINED; | |
75 | return 0; | |
76 | } | |
77 | } | |
78 | ||
79 |
Note: See TracBrowser
for help on using the repository browser.