Last change
on this file since 1034 was
1034,
checked in by yushan, 7 years ago
|
adding src_ep into extern folder
|
File size:
1.5 KB
|
Line | |
---|
1 | #include "ep_lib.hpp" |
---|
2 | #include <mpi.h> |
---|
3 | #include "ep_declaration.hpp" |
---|
4 | |
---|
5 | namespace ep_lib |
---|
6 | { |
---|
7 | |
---|
8 | |
---|
9 | |
---|
10 | |
---|
11 | int MPI_Comm_size(MPI_Comm comm, int* size) |
---|
12 | { |
---|
13 | |
---|
14 | if(comm.is_ep) |
---|
15 | { |
---|
16 | if(!comm.is_intercomm) |
---|
17 | { |
---|
18 | *size = comm.ep_comm_ptr->size_rank_info[0].second; |
---|
19 | |
---|
20 | return 0; |
---|
21 | } |
---|
22 | else |
---|
23 | { |
---|
24 | *size = comm.ep_comm_ptr->intercomm->size_rank_info[0].second; |
---|
25 | |
---|
26 | return 0; |
---|
27 | } |
---|
28 | |
---|
29 | } |
---|
30 | |
---|
31 | Debug("Calling EP_Comm_size\n"); |
---|
32 | |
---|
33 | if(comm.mpi_comm) |
---|
34 | { |
---|
35 | ::MPI_Comm mpi_comm = static_cast< ::MPI_Comm > (comm.mpi_comm); |
---|
36 | int mpi_size; |
---|
37 | |
---|
38 | ::MPI_Comm_size(mpi_comm, &mpi_size); |
---|
39 | printf("============ ep comm size called for non ep comm, %d\n", mpi_size); |
---|
40 | *size = mpi_size; |
---|
41 | return 0; |
---|
42 | } |
---|
43 | |
---|
44 | else |
---|
45 | { |
---|
46 | *size = MPI_UNDEFINED; |
---|
47 | printf("============ ep comm size called for non ep comm not defined\n"); |
---|
48 | return 0; |
---|
49 | } |
---|
50 | } |
---|
51 | |
---|
52 | int MPI_Comm_remote_size(MPI_Comm comm, int *size) |
---|
53 | { |
---|
54 | if(!comm.is_ep) |
---|
55 | { |
---|
56 | if(comm.mpi_comm) |
---|
57 | { |
---|
58 | ::MPI_Comm mpi_comm = static_cast< ::MPI_Comm > (comm.mpi_comm); |
---|
59 | #ifdef _serialized |
---|
60 | #pragma omp critical (_mpi_call) |
---|
61 | #endif // _serialized |
---|
62 | ::MPI_Comm_remote_size(mpi_comm, size); |
---|
63 | return 0; |
---|
64 | } |
---|
65 | |
---|
66 | else |
---|
67 | { |
---|
68 | *size = MPI_UNDEFINED; |
---|
69 | return 0; |
---|
70 | } |
---|
71 | } |
---|
72 | |
---|
73 | if(comm.is_intercomm) |
---|
74 | { |
---|
75 | *size = comm.ep_comm_ptr->intercomm->remote_rank_map->size(); |
---|
76 | return 0; |
---|
77 | } |
---|
78 | *size = MPI_UNDEFINED; |
---|
79 | return 0; |
---|
80 | } |
---|
81 | } |
---|
82 | |
---|
83 | |
---|
Note: See
TracBrowser
for help on using the repository browser.