Changeset 863
- Timestamp:
- 06/09/16 11:32:47 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/client_client_dht_template_impl.hpp
r860 r863 105 105 size_t index; 106 106 HashXIOS<size_t> hashGlobalIndex; 107 boost::unordered_map<size_t,int> nbIndices; 108 nbIndices.rehash(std::ceil(ssize/nbIndices.max_load_factor())); 107 109 for (int i = 0; i < ssize; ++i) 108 110 { 109 111 index = indices(i); 110 hashedVal = hashGlobalIndex(index); 111 itClientHash = std::upper_bound(itbClientHash, iteClientHash, hashedVal); 112 int indexClient = std::distance(itbClientHash, itClientHash)-1; 113 ++sendNbIndexBuff[indexClient]; 112 if (0 == nbIndices.count(index)) 113 { 114 hashedVal = hashGlobalIndex(index); 115 itClientHash = std::upper_bound(itbClientHash, iteClientHash, hashedVal); 116 int indexClient = std::distance(itbClientHash, itClientHash)-1; 117 ++sendNbIndexBuff[indexClient]; 118 nbIndices[index] = 1; 119 } 114 120 } 115 121 … … 129 135 { 130 136 index = indices(i); 131 hashedVal = hashGlobalIndex(index); 132 itClientHash = std::upper_bound(itbClientHash, iteClientHash, hashedVal); 133 { 137 if (1 == nbIndices[index]) 138 { 139 hashedVal = hashGlobalIndex(index); 140 itClientHash = std::upper_bound(itbClientHash, iteClientHash, hashedVal); 134 141 int indexClient = std::distance(itbClientHash, itClientHash)-1; 135 { 136 client2ClientIndex[indexClient+groupRankBegin][sendNbIndexBuff[indexClient]] = index; 137 ++sendNbIndexBuff[indexClient]; 138 } 142 client2ClientIndex[indexClient+groupRankBegin][sendNbIndexBuff[indexClient]] = index; 143 ++sendNbIndexBuff[indexClient]; 144 ++nbIndices[index]; 139 145 } 140 146 } … … 597 603 for (it = itb; it != ite; ++it) 598 604 { 599 int infoVecSize = it->second.size(); 600 for (int idx = 0; idx < infoVecSize; ++idx) 601 { 602 size_t hashIndex = hashGlobalIndex(it->first); 603 itClientHash = std::upper_bound(itbClientHash, iteClientHash, hashIndex); 604 { 605 int indexClient = std::distance(itbClientHash, itClientHash)-1; 606 { 607 ++sendNbIndexBuff[indexClient]; 608 } 609 } 610 } 605 size_t hashIndex = hashGlobalIndex(it->first); 606 itClientHash = std::upper_bound(itbClientHash, iteClientHash, hashIndex); 607 int indexClient = std::distance(itbClientHash, itClientHash)-1; 608 sendNbIndexBuff[indexClient] += it->second.size(); 611 609 } 612 610 … … 628 626 { 629 627 const std::vector<InfoType>& infoTmp = it->second; 628 size_t hashIndex = hashGlobalIndex(it->first); 629 itClientHash = std::upper_bound(itbClientHash, iteClientHash, hashIndex); 630 int indexClient = std::distance(itbClientHash, itClientHash)-1; 630 631 for (int idx = 0; idx < infoTmp.size(); ++idx) 631 632 { 632 size_t hashIndex = hashGlobalIndex(it->first); 633 itClientHash = std::upper_bound(itbClientHash, iteClientHash, hashIndex); 634 { 635 int indexClient = std::distance(itbClientHash, itClientHash)-1; 636 { 637 client2ClientIndex[indexClient + groupRankBegin][sendNbIndexBuff[indexClient]] = it->first;; 638 // ProcessDHTElement<InfoType>::packElement(it->second, client2ClientInfo[indexClient + groupRankBegin], sendNbInfo[indexClient]); 639 ProcessDHTElement<InfoType>::packElement(infoTmp[idx], client2ClientInfo[indexClient + groupRankBegin], sendNbInfo[indexClient]); 640 ++sendNbIndexBuff[indexClient]; 641 } 642 } 633 client2ClientIndex[indexClient + groupRankBegin][sendNbIndexBuff[indexClient]] = it->first;; 634 // ProcessDHTElement<InfoType>::packElement(it->second, client2ClientInfo[indexClient + groupRankBegin], sendNbInfo[indexClient]); 635 ProcessDHTElement<InfoType>::packElement(infoTmp[idx], client2ClientInfo[indexClient + groupRankBegin], sendNbInfo[indexClient]); 636 ++sendNbIndexBuff[indexClient]; 643 637 } 644 638 } … … 695 689 Index2VectorInfoTypeMap indexToInfoMapping; 696 690 indexToInfoMapping.rehash(std::ceil(currentIndex/indexToInfoMapping.max_load_factor())); 691 // boost::unordered_map<size_t,int> tmpInfoSize; 692 // tmpInfoSize.rehash(std::ceil(currentIndex/tmpInfoSize.max_load_factor())); 693 // currentIndex = 0; 694 // for (int idx = 0; idx < nbRecvClient; ++idx) 695 // { 696 // int count = recvNbIndexClientCount[idx]; 697 // for (int i = 0; i < count; ++i) 698 // { 699 // ++tmpInfoSize[*(recvIndexBuff+currentIndex+i)]; 700 // } 701 // currentIndex += count; 702 // } 703 // 704 // for (boost::unordered_map<size_t,int>::iterator it=tmpInfoSize.begin(); it != tmpInfoSize.end(); ++it) 705 // { 706 // indexToInfoMapping[it->first].resize(it->second); 707 // it->second = 0; 708 // } 709 697 710 currentIndex = 0; 698 711 InfoType infoValue; … … 701 714 for (int idx = 0; idx < nbRecvClient; ++idx) 702 715 { 716 // size_t index; 703 717 int count = recvNbIndexClientCount[idx]; 704 718 for (int i = 0; i < count; ++i) 705 719 { 720 // index = *(recvIndexBuff+currentIndex+i); 706 721 ProcessDHTElement<InfoType>::unpackElement(infoValue, infoBuff, infoIndex); 707 // indexToInfoMapping[*(recvIndexBuff+currentIndex+i)] = infoValue; 722 // ProcessDHTElement<InfoType>::unpackElement(indexToInfoMapping[index][tmpInfoSize[index]], infoBuff, infoIndex); 723 // ++tmpInfoSize[index]; 708 724 indexToInfoMapping[*(recvIndexBuff+currentIndex+i)].push_back(infoValue); 709 725 }
Note: See TracChangeset
for help on using the changeset viewer.