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

Implementing new hash algorithm and fixing bug related to zoom

+) Replace boost hash with hash algorithm of Jenkins
+) Domain, if an attribute is non-empty for one client, it should also be non-empty for others inspite of zoom
+) Replace the way to find the number of client connecting to a server to make sure every server receive a message

Test
+) On Curie
+) test_client: passed and results are same like before
+) test_complete: passed, results are partially the same, the different part comes from added working operation

File:
1 edited

Legend:

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

    r569 r584  
    1111#include <limits> 
    1212#include <boost/functional/hash.hpp> 
     13#include "utils.hpp" 
    1314 
    1415namespace xios 
     
    3536   \param [in] globalIndexOnClient global index client has 
    3637*/ 
    37 void CClientServerMappingDistributed::computeServerIndexMapping(const CArray<size_t,1>& globalIndexOnClient) 
    38 { 
    39   int ssize = globalIndexOnClient.numElements(); 
    40   CArray<int,1>* localIndexOnClient = new CArray<int,1>(ssize); 
    41   for (int i = 0; i < ssize; ++i) (*localIndexOnClient)(i) = i; 
    42  
    43   this->computeServerIndexMapping(globalIndexOnClient, *localIndexOnClient); 
    44   delete localIndexOnClient; 
    45 } 
     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//} 
    4647 
    4748/*! 
     
    5051   \param [in] localIndexOnClient local index on client 
    5152*/ 
    52 void CClientServerMappingDistributed::computeServerIndexMapping(const CArray<size_t,1>& globalIndexOnClient, 
    53                                                                 const CArray<int,1>& localIndexOnClient) 
     53//void CClientServerMappingDistributed::computeServerIndexMapping(const CArray<size_t,1>& globalIndexOnClient, 
     54//                                                                const CArray<int,1>& localIndexOnClient) 
     55void CClientServerMappingDistributed::computeServerIndexMapping(const CArray<size_t,1>& globalIndexOnClient) 
    5456{ 
    5557  size_t ssize = globalIndexOnClient.numElements(), hashedIndex; 
     
    5961  std::map<int, std::vector<size_t> > client2ClientIndexGlobal; 
    6062  std::map<int, std::vector<int> > client2ClientIndexServer; 
    61   std::map<int, std::vector<int> > clientLocalIndex; 
     63//  std::map<int, std::vector<int> > clientLocalIndex; 
    6264 
    6365  // Number of global index whose mapping server can be found out thanks to index-server mapping 
     
    6668  // Number of global index whose mapping server are on other clients 
    6769  int nbIndexSendToOthers = 0; 
    68   boost::hash<size_t> hashGlobalIndex; 
     70  HashXIOS<size_t> hashGlobalIndex; 
    6971  for (int i = 0; i < ssize; ++i) 
    7072  { 
     
    7981      { 
    8082        (indexGlobalOnServer_[globalIndexToServerMapping_[globalIndexClient]]).push_back(globalIndexClient); 
    81         (localIndexSend2Server_[globalIndexToServerMapping_[globalIndexClient]]).push_back(localIndexOnClient(i)); 
     83//        (localIndexSend2Server_[globalIndexToServerMapping_[globalIndexClient]]).push_back(localIndexOnClient(i)); 
    8284        ++nbIndexAlreadyOnClient; 
    8385      } 
     
    8587      { 
    8688        client2ClientIndexGlobal[indexClient].push_back(globalIndexClient); 
    87         clientLocalIndex[indexClient].push_back(i); 
     89//        clientLocalIndex[indexClient].push_back(i); 
    8890        ++nbIndexSendToOthers; 
    8991      } 
     
    123125  std::vector<int> demandAlreadyReceived, repondAlreadyReceived; 
    124126  int nbDemandingClient = recvBuff[clientRank_], nbIndexServerReceived = 0; 
     127 
     128  resetReceivingRequestAndCount(); 
    125129  while ((0 < nbDemandingClient) || (!sendRequest.empty()) || 
    126130         (nbIndexServerReceived < nbIndexReceivedFromOthers)) 
     
    176180        int* beginBuff = indexServerBuffBegin_[clientSourceRank]; 
    177181        std::vector<size_t>& globalIndexTmp = client2ClientIndexGlobal[clientSourceRank]; 
    178         std::vector<int>& localIndexTmp = clientLocalIndex[clientSourceRank]; 
     182//        std::vector<int>& localIndexTmp = clientLocalIndex[clientSourceRank]; 
    179183        for (int i = 0; i < count; ++i) 
    180184        { 
    181185          (indexGlobalOnServer_[*(beginBuff+i)]).push_back(globalIndexTmp[i]); 
    182           (localIndexSend2Server_[*(beginBuff+i)]).push_back(localIndexOnClient(localIndexTmp[i])); 
     186//          (localIndexSend2Server_[*(beginBuff+i)]).push_back(localIndexOnClient(localIndexTmp[i])); 
    183187        } 
    184188        nbIndexServerReceived += count; 
     
    243247  boost::unordered_map<size_t,int>::const_iterator it  = globalIndexOfServer.begin(), 
    244248                                                   ite = globalIndexOfServer.end(); 
    245   boost::hash<size_t> hashGlobalIndex; 
     249  HashXIOS<size_t> hashGlobalIndex; 
    246250  for (; it != ite; ++it) 
    247251  { 
Note: See TracChangeset for help on using the changeset viewer.