Last change
on this file since 1513 was
1503,
checked in by yushan, 6 years ago
|
rank_map is passed from vector to map, in order to have more flexibility in comm_split
|
File size:
1.3 KB
|
Line | |
---|
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 | |
---|
15 | if(comm->is_ep) |
---|
16 | { |
---|
17 | if(!comm->is_intercomm) |
---|
18 | { |
---|
19 | *size = comm->ep_comm_ptr->size_rank_info[0].second; |
---|
20 | |
---|
21 | return 0; |
---|
22 | } |
---|
23 | else |
---|
24 | { |
---|
25 | *size = comm->ep_comm_ptr->intercomm->size_rank_info[0].second; |
---|
26 | |
---|
27 | return 0; |
---|
28 | } |
---|
29 | |
---|
30 | } |
---|
31 | |
---|
32 | Debug("Calling EP_Comm_size\n"); |
---|
33 | |
---|
34 | if(comm->mpi_comm != static_cast< ::MPI_Comm*>(MPI_COMM_NULL->mpi_comm)) |
---|
35 | { |
---|
36 | ::MPI_Comm mpi_comm = to_mpi_comm(comm->mpi_comm); |
---|
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 | { |
---|
53 | if(!comm->is_ep) |
---|
54 | { |
---|
55 | if(comm->mpi_comm != static_cast< ::MPI_Comm*>(MPI_COMM_NULL->mpi_comm)) |
---|
56 | { |
---|
57 | ::MPI_Comm mpi_comm = to_mpi_comm(comm->mpi_comm); |
---|
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 | |
---|
69 | if(comm->is_intercomm) |
---|
70 | { |
---|
71 | *size = comm->ep_comm_ptr->intercomm->remote_rank_map->size(); |
---|
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.