Ignore:
Timestamp:
04/01/15 17:52:58 (9 years ago)
Author:
mhnguyen
Message:

Modifying some functions to make sure zoom working even with grid not distributed

+) Change some code in sendIndex to make sure non-distributed grid work with zoom

Test
+) On Curie
+) test_client: passed and results are same like on the branchs
+) test_complete: there is a difference of output because of zoom index offset

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/client_server_mapping_distributed.cpp

    r584 r585  
    1717 
    1818CClientServerMappingDistributed::CClientServerMappingDistributed(const boost::unordered_map<size_t,int>& globalIndexOfServer, 
    19                                                                  const MPI_Comm& clientIntraComm) 
     19                                                                 const MPI_Comm& clientIntraComm, bool isDataDistributed) 
    2020  : CClientServerMapping(), indexClientHash_(), countIndexGlobal_(0), countIndexServer_(0), 
    21     indexGlobalBuffBegin_(), indexServerBuffBegin_(), requestRecvIndexServer_() 
     21    indexGlobalBuffBegin_(), indexServerBuffBegin_(), requestRecvIndexServer_(), isDataDistributed_(isDataDistributed) 
    2222{ 
    2323  clientIntraComm_ = clientIntraComm; 
     
    3535   Compute mapping global index of server which client sends to. 
    3636   \param [in] globalIndexOnClient global index client has 
    37 */ 
    38 //void CClientServerMappingDistributed::computeServerIndexMapping(const CArray<size_t,1>& globalIndexOnClient) 
    39 //{ 
    40 //  int ssize = globalIndexOnClient.numElements(); 
    41 //  CArray<int,1>* localIndexOnClient = new CArray<int,1>(ssize); 
    42 //  for (int i = 0; i < ssize; ++i) (*localIndexOnClient)(i) = i; 
    43 // 
    44 //  this->computeServerIndexMapping(globalIndexOnClient, *localIndexOnClient); 
    45 //  delete localIndexOnClient; 
    46 //} 
    47  
    48 /*! 
    49    Compute mapping global index of server which client sends to. 
    50    \param [in] globalIndexOnClient global index client has 
    5137   \param [in] localIndexOnClient local index on client 
    5238*/ 
     
    6147  std::map<int, std::vector<size_t> > client2ClientIndexGlobal; 
    6248  std::map<int, std::vector<int> > client2ClientIndexServer; 
    63 //  std::map<int, std::vector<int> > clientLocalIndex; 
    6449 
    6550  // Number of global index whose mapping server can be found out thanks to index-server mapping 
     
    8166      { 
    8267        (indexGlobalOnServer_[globalIndexToServerMapping_[globalIndexClient]]).push_back(globalIndexClient); 
    83 //        (localIndexSend2Server_[globalIndexToServerMapping_[globalIndexClient]]).push_back(localIndexOnClient(i)); 
    8468        ++nbIndexAlreadyOnClient; 
    8569      } 
     
    8771      { 
    8872        client2ClientIndexGlobal[indexClient].push_back(globalIndexClient); 
    89 //        clientLocalIndex[indexClient].push_back(i); 
    9073        ++nbIndexSendToOthers; 
    9174      } 
     
    10689         sendIndexGlobalToClients(it->first, it->second, clientIntraComm_, sendRequest); 
    10790 
     91  int nbDemandingClient = recvBuff[clientRank_], nbIndexServerReceived = 0; 
    10892  // Receiving demand as well as the responds from other clients 
    10993  // The demand message contains global index; meanwhile the responds have server index information 
     
    11296  int maxNbIndexDemandedFromOthers = (nbIndexAlreadyOnClient >= globalIndexToServerMapping_.size()) 
    11397                                   ? 0 : (globalIndexToServerMapping_.size() - nbIndexAlreadyOnClient); 
     98  if (!isDataDistributed_) maxNbIndexDemandedFromOthers = nbDemandingClient * globalIndexToServerMapping_.size(); // Not very optimal but it's general 
     99 
    114100  if (0 != maxNbIndexDemandedFromOthers) 
    115101    recvBuffIndexGlobal = new unsigned long[maxNbIndexDemandedFromOthers]; 
     
    118104  int* recvBuffIndexServer = 0; 
    119105  int nbIndexReceivedFromOthers = nbIndexSendToOthers; 
     106//  int nbIndexReceivedFromOthers = globalIndexToServerMapping_.size() - nbIndexAlreadyOnClient; 
    120107  if (0 != nbIndexReceivedFromOthers) 
    121108    recvBuffIndexServer = new int[nbIndexReceivedFromOthers]; 
    122109 
    123   resetReceivingRequestAndCount(); 
    124110  std::map<int, MPI_Request>::iterator itRequest; 
    125111  std::vector<int> demandAlreadyReceived, repondAlreadyReceived; 
    126   int nbDemandingClient = recvBuff[clientRank_], nbIndexServerReceived = 0; 
     112 
    127113 
    128114  resetReceivingRequestAndCount(); 
     
    180166        int* beginBuff = indexServerBuffBegin_[clientSourceRank]; 
    181167        std::vector<size_t>& globalIndexTmp = client2ClientIndexGlobal[clientSourceRank]; 
    182 //        std::vector<int>& localIndexTmp = clientLocalIndex[clientSourceRank]; 
    183168        for (int i = 0; i < count; ++i) 
    184169        { 
    185170          (indexGlobalOnServer_[*(beginBuff+i)]).push_back(globalIndexTmp[i]); 
    186 //          (localIndexSend2Server_[*(beginBuff+i)]).push_back(localIndexOnClient(localIndexTmp[i])); 
    187171        } 
    188172        nbIndexServerReceived += count; 
     
    224208  Compute distribution of global index for servers 
    225209  Each client already holds a piece of information about global index and the corresponding server. 
    226 This information is redistributed into size_t sipace in which each client possesses a specific range of index. 
    227 Afterh the redistribution, each client as long as its range of index contains all necessary information about server. 
     210This information is redistributed into size_t space in which each client possesses a specific range of index. 
     211After the redistribution, each client as well as its range of index contains all necessary information about server. 
    228212  \param [in] globalIndexOfServer global index and the corresponding server 
    229213  \param [in] clientIntraComm client joining distribution process. 
Note: See TracChangeset for help on using the changeset viewer.