1 | #ifndef __XIOS_CLIENT_SERVER_MAPPING_DISTRIBUTED_HPP__ |
---|
2 | #define __XIOS_CLIENT_SERVER_MAPPING_DISTRIBUTED_HPP__ |
---|
3 | |
---|
4 | #include <client_server_mapping.hpp> |
---|
5 | #include "xmlioserver_spl.hpp" |
---|
6 | #include "array_new.hpp" |
---|
7 | #include "mpi.hpp" |
---|
8 | #include <boost/unordered_map.hpp> |
---|
9 | |
---|
10 | namespace xios |
---|
11 | { |
---|
12 | |
---|
13 | class CClientServerMappingDistributed : public CClientServerMapping |
---|
14 | { |
---|
15 | public: |
---|
16 | /** Default constructor */ |
---|
17 | CClientServerMappingDistributed(const boost::unordered_map<size_t,int>& globalIndexOfServer, |
---|
18 | const MPI_Comm& clientIntraComm); |
---|
19 | |
---|
20 | virtual void computeServerIndexMapping(const CArray<size_t,1>& globalIndexOnClient, |
---|
21 | const CArray<int,1>& localIndexOnClient); |
---|
22 | |
---|
23 | /** Default destructor */ |
---|
24 | virtual ~CClientServerMappingDistributed(); |
---|
25 | |
---|
26 | protected: |
---|
27 | void computeDistributedServerIndex(const boost::unordered_map<size_t,int>& globalIndexOfServer, |
---|
28 | const MPI_Comm& clientIntraComm); |
---|
29 | |
---|
30 | void processReceivedRequest(unsigned long* buffIndexGlobal, int* buffIndexServer, int count); |
---|
31 | |
---|
32 | void testSendRequest(std::list<MPI_Request>& sendRequest); |
---|
33 | |
---|
34 | int computeBuffCount(MPI_Request& requestRecvIndexGlobal, MPI_Request& requestRecvIndexServer); |
---|
35 | |
---|
36 | void computeHashIndex(); |
---|
37 | |
---|
38 | // void sendIndexServerToClients(std::map<int, std::vector<int> >& indexServer, |
---|
39 | // const MPI_Comm& clientIntraComm, |
---|
40 | // std::list<MPI_Request>& requestSendIndexServer); |
---|
41 | |
---|
42 | // void sendIndexGlobalToClients(std::map<int, std::vector<size_t> >& indexGlobal, |
---|
43 | // const MPI_Comm& clientIntraComm, |
---|
44 | // std::list<MPI_Request>& requestSendIndexGlobal); |
---|
45 | |
---|
46 | void sendIndexServerToClients(int clientDestRank, std::vector<int>& indexServer, |
---|
47 | const MPI_Comm& clientIntraComm, std::list<MPI_Request>& requestSendIndexServer); |
---|
48 | |
---|
49 | void sendIndexGlobalToClients(int clientDestRank, std::vector<size_t>& indexGlobal, |
---|
50 | const MPI_Comm& clientIntraComm, std::list<MPI_Request>& requestSendIndexGlobal); |
---|
51 | |
---|
52 | void resetRequestAndCount(); |
---|
53 | |
---|
54 | void probeIndexGlobalMessageFromClients(unsigned long* recvIndexGlobalBuff, int recvNbIndexCount); |
---|
55 | |
---|
56 | void probeIndexServerMessageFromClients(int* recvIndexServerBuff, int recvNbIndexCount); |
---|
57 | |
---|
58 | int computeBuffCountIndexGlobal(MPI_Request& requestRecv); |
---|
59 | |
---|
60 | int computeBuffCountIndexServer(MPI_Request& requestRecv); |
---|
61 | private: |
---|
62 | boost::unordered_map<size_t,int> globalIndexToServerMapping_; |
---|
63 | |
---|
64 | std::map<int, MPI_Request> requestRecvIndexGlobal_; |
---|
65 | |
---|
66 | std::map<int, MPI_Request> requestRecvIndexServer_; |
---|
67 | |
---|
68 | std::vector<size_t> indexClientHash_; |
---|
69 | |
---|
70 | int nbClient_; |
---|
71 | |
---|
72 | int clientRank_; |
---|
73 | |
---|
74 | int countIndexGlobal_; |
---|
75 | |
---|
76 | int countIndexServer_; |
---|
77 | |
---|
78 | MPI_Comm clientIntraComm_; |
---|
79 | |
---|
80 | std::map<int, unsigned long*> indexGlobalBuffBegin_; |
---|
81 | |
---|
82 | std::map<int, int*> indexServerBuffBegin_; |
---|
83 | |
---|
84 | }; |
---|
85 | |
---|
86 | } // namespace xios |
---|
87 | #endif // __XIOS_CLIENT_SERVER_MAPPING_DISTRIBUTED_HPP__ |
---|