[1502] | 1 | #ifndef EP_COMM_HPP_INCLUDED |
---|
| 2 | #define EP_COMM_HPP_INCLUDED |
---|
| 3 | |
---|
| 4 | #include "ep_message.hpp" |
---|
| 5 | #include "ep_intercomm.hpp" |
---|
| 6 | #include "ep_barrier.hpp" |
---|
| 7 | #include "ep_buffer.hpp" |
---|
| 8 | |
---|
| 9 | typedef std::pair< int, int > SIZE_RANK_INFO; // < rank, size> |
---|
| 10 | typedef std::vector< std::pair<int, int> > RANK_MAP; // at(ep_rank) = <ep_rank_local, mpi_rank> |
---|
| 11 | typedef std::map<int, std::pair<int, int> > EP_RANK_MAP; // key(ep_rank) = <ep_rank_local, mpi_rank> |
---|
[1503] | 12 | //typedef std::vector<std::pair< std::pair<int, int>, std::pair<int, int> > > INTERCOMM_RANK_MAP; |
---|
[1502] | 13 | typedef std::list<ep_lib::MPI_Message > Message_list; |
---|
| 14 | |
---|
| 15 | namespace ep_lib |
---|
| 16 | { |
---|
| 17 | |
---|
| 18 | class ep_comm; |
---|
| 19 | |
---|
| 20 | class ep_communicator |
---|
| 21 | { |
---|
| 22 | public: |
---|
| 23 | |
---|
| 24 | SIZE_RANK_INFO size_rank_info[3]; // 0: ep_rank, ep_size |
---|
| 25 | // 1: ep_rank_loc, num_ep |
---|
| 26 | // 2: mpi_rank, mpi_size |
---|
| 27 | |
---|
[1515] | 28 | // for intercomm : = size_rank_info of local_comm |
---|
[1502] | 29 | |
---|
[1515] | 30 | |
---|
[1502] | 31 | ep_comm **comm_list; |
---|
| 32 | |
---|
| 33 | Message_list *message_queue; |
---|
| 34 | |
---|
| 35 | |
---|
| 36 | int comm_label; |
---|
| 37 | |
---|
| 38 | ep_intercomm *intercomm; |
---|
| 39 | |
---|
| 40 | ep_communicator(); |
---|
| 41 | bool operator == (ep_communicator right); |
---|
| 42 | bool operator != (ep_communicator right); |
---|
| 43 | |
---|
| 44 | }; |
---|
| 45 | |
---|
| 46 | |
---|
| 47 | class ep_comm |
---|
| 48 | { |
---|
| 49 | public: |
---|
| 50 | |
---|
| 51 | bool is_ep; |
---|
| 52 | bool is_intercomm; |
---|
| 53 | |
---|
| 54 | BUFFER *my_buffer; |
---|
| 55 | ep_barrier *ep_barrier; |
---|
[1515] | 56 | EP_RANK_MAP *ep_rank_map; // for intercomm : = ep_rank_map of newcomm |
---|
[1502] | 57 | void* mpi_comm; |
---|
| 58 | ep_communicator *ep_comm_ptr; |
---|
| 59 | ep_comm **mem_bridge; |
---|
| 60 | void* mpi_bridge; |
---|
| 61 | |
---|
| 62 | ep_comm(); |
---|
| 63 | ep_comm(void* comm); |
---|
| 64 | |
---|
| 65 | |
---|
| 66 | bool operator == (ep_comm right); |
---|
| 67 | bool operator != (ep_comm right); |
---|
| 68 | bool is_null(); |
---|
| 69 | |
---|
| 70 | }; |
---|
| 71 | |
---|
| 72 | typedef ep_comm* MPI_Comm; |
---|
| 73 | |
---|
| 74 | |
---|
| 75 | } |
---|
| 76 | |
---|
| 77 | |
---|
| 78 | |
---|
| 79 | #endif // EP_COMM_HPP_INCLUDED |
---|
| 80 | |
---|