Changeset 569 for XIOS/trunk/src/client_server_mapping_distributed.hpp
- Timestamp:
- 03/10/15 10:49:13 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/client_server_mapping_distributed.hpp
r568 r569 1 /*! 2 \file client_server_mapping.hpp 3 \author Ha NGUYEN 4 \since 27 Feb 2015 5 \date 09 Mars 2015 6 7 \brief Mapping between index client and server. 8 Clients pre-calculate all information of server distribution. 9 */ 10 1 11 #ifndef __XIOS_CLIENT_SERVER_MAPPING_DISTRIBUTED_HPP__ 2 12 #define __XIOS_CLIENT_SERVER_MAPPING_DISTRIBUTED_HPP__ … … 10 20 namespace xios 11 21 { 12 22 /*! 23 \class CClientServerMappingDistributed 24 This class computes index of data which are sent to server as well as index of data 25 on server side with a distributed alogrithm. Each client has a piece of information about the distribution 26 of servers. To find out all these info, first of all, all client join a discovering process in which each client 27 announces the others about the info they have as well as demand others info they are lacked of. After this process, 28 each client has enough info to decide to which client it need to send a demand for corresponding server of a global index. 29 The alogrithm depends on hashed index. 30 */ 13 31 class CClientServerMappingDistributed : public CClientServerMapping 14 32 { … … 17 35 CClientServerMappingDistributed(const boost::unordered_map<size_t,int>& globalIndexOfServer, 18 36 const MPI_Comm& clientIntraComm); 37 38 virtual void computeServerIndexMapping(const CArray<size_t,1>& globalIndexOnClient); 19 39 20 40 virtual void computeServerIndexMapping(const CArray<size_t,1>& globalIndexOnClient, … … 25 45 26 46 protected: 47 // Redistribute global index and server index among clients 27 48 void computeDistributedServerIndex(const boost::unordered_map<size_t,int>& globalIndexOfServer, 28 49 const MPI_Comm& clientIntraComm); 29 50 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 51 // Send server index to clients 46 52 void sendIndexServerToClients(int clientDestRank, std::vector<int>& indexServer, 47 53 const MPI_Comm& clientIntraComm, std::list<MPI_Request>& requestSendIndexServer); 48 54 55 // Send global index to clients 49 56 void sendIndexGlobalToClients(int clientDestRank, std::vector<size_t>& indexGlobal, 50 57 const MPI_Comm& clientIntraComm, std::list<MPI_Request>& requestSendIndexGlobal); 51 58 52 void resetRequestAndCount(); 59 // Verify sending request 60 void testSendRequest(std::list<MPI_Request>& sendRequest); 53 61 62 // Process request 63 void processReceivedRequest(unsigned long* buffIndexGlobal, int* buffIndexServer, int count); 64 65 // Probe and receive message of global index 54 66 void probeIndexGlobalMessageFromClients(unsigned long* recvIndexGlobalBuff, int recvNbIndexCount); 55 67 68 // Probe and receive message of server index 56 69 void probeIndexServerMessageFromClients(int* recvIndexServerBuff, int recvNbIndexCount); 57 70 71 // Compute range of hashing 72 void computeHashIndex(); 73 74 // Compute size of receiving buffer for global index 58 75 int computeBuffCountIndexGlobal(MPI_Request& requestRecv); 59 76 77 // Compute size of receiving buffer for server index 60 78 int computeBuffCountIndexServer(MPI_Request& requestRecv); 79 80 // Reset request map 81 void resetReceivingRequestAndCount(); 82 61 83 private: 84 //! Mapping of global index to the corresponding server 62 85 boost::unordered_map<size_t,int> globalIndexToServerMapping_; 63 86 87 //! Bounds of hash index 88 std::vector<size_t> indexClientHash_; 89 90 //! Number of client 91 int nbClient_; 92 93 //! Rank of client 94 int clientRank_; 95 96 //! Counting of buffer for receiving global index 97 int countIndexGlobal_; 98 99 //! Counting of buffer for receiving server index 100 int countIndexServer_; 101 102 //! intracommuntion of clients 103 MPI_Comm clientIntraComm_; 104 105 //! Request returned by MPI_IRecv function about global index 64 106 std::map<int, MPI_Request> requestRecvIndexGlobal_; 65 107 108 //! Request returned by MPI_IRecv function about index of server 66 109 std::map<int, MPI_Request> requestRecvIndexServer_; 67 110 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 111 //! Mapping client rank and the beginning position of receiving buffer for message of global index from this client 80 112 std::map<int, unsigned long*> indexGlobalBuffBegin_; 81 113 114 //! Mapping client rank and the begining position of receiving buffer for message of server index from this client 82 115 std::map<int, int*> indexServerBuffBegin_; 83 84 116 }; 85 117
Note: See TracChangeset
for help on using the changeset viewer.