- Timestamp:
- 04/26/16 16:04:04 (8 years ago)
- Location:
- XIOS/trunk/src
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/client_client_dht_template.hpp
r839 r843 44 44 45 45 const Index2InfoTypeMap& getInfoIndexMap() const {return indexToInfoMappingLevel_; } 46 47 int getNbClient() { return nbClient_; } 46 48 47 49 /** Default destructor */ … … 101 103 //! Flag to specify whether data is distributed or not 102 104 bool isDataDistributed_; 105 106 //! Number of client 107 int nbClient_; 103 108 }; 104 109 -
XIOS/trunk/src/client_client_dht_template_impl.hpp
r839 r843 24 24 CClientClientDHTTemplate<T,H>::CClientClientDHTTemplate(const boost::unordered_map<size_t,T>& indexInfoMap, 25 25 const MPI_Comm& clientIntraComm) 26 : H(clientIntraComm), index2InfoMapping_(), indexToInfoMappingLevel_() 27 { 26 : H(clientIntraComm), index2InfoMapping_(), indexToInfoMappingLevel_(), nbClient_(0) 27 { 28 MPI_Comm_size(clientIntraComm, &nbClient_); 28 29 this->computeMPICommLevel(); 29 30 int nbLvl = this->getNbLevel(); … … 88 89 } 89 90 90 std::map<int, size_t* > client2ClientIndex;91 boost::unordered_map<int, size_t* > client2ClientIndex; 91 92 for (int idx = 0; idx < nbClient; ++idx) 92 93 { … … 140 141 } 141 142 142 std::map<int, size_t* >::iterator itbIndex = client2ClientIndex.begin(), itIndex,143 iteIndex = client2ClientIndex.end();143 boost::unordered_map<int, size_t* >::iterator itbIndex = client2ClientIndex.begin(), itIndex, 144 iteIndex = client2ClientIndex.end(); 144 145 for (itIndex = itbIndex; itIndex != iteIndex; ++itIndex) 145 146 sendIndexToClients(itIndex->first, (itIndex->second), sendNbIndexBuff[itIndex->first-groupRankBegin], commLevel, request); … … 213 214 } 214 215 215 std::map<int,unsigned char*> client2ClientInfoOnReturn;216 std::map<int,size_t*> client2ClientIndexOnReturn;216 boost::unordered_map<int,unsigned char*> client2ClientInfoOnReturn; 217 boost::unordered_map<int,size_t*> client2ClientIndexOnReturn; 217 218 currentIndex = 0; 218 219 for (int idx = 0; idx < nbRecvClient; ++idx) … … 249 250 250 251 boost::unordered_map<size_t,InfoType> indexToInfoMapping; 252 indexToInfoMapping.rehash(std::ceil(recvNbIndexCountOnReturn/indexToInfoMapping.max_load_factor())); 251 253 int infoIndex = 0; 252 254 for (int idx = 0; idx < recvNbIndexCountOnReturn; ++idx) … … 255 257 } 256 258 257 indexToInfoMappingLevel_ = (indexToInfoMapping);259 indexToInfoMappingLevel_.swap(indexToInfoMapping); //indexToInfoMappingLevel_ = (indexToInfoMapping); 258 260 if (0 != recvNbIndexCount) delete [] recvIndexBuff; 259 for ( std::map<int,size_t*>::const_iterator it = client2ClientIndex.begin();260 it != client2ClientIndex.end(); ++it)261 for (boost::unordered_map<int,size_t*>::const_iterator it = client2ClientIndex.begin(); 262 it != client2ClientIndex.end(); ++it) 261 263 delete [] it->second; 262 264 delete tmpGlobalIndex; … … 268 270 } 269 271 270 for ( std::map<int,unsigned char*>::const_iterator it = client2ClientInfoOnReturn.begin();271 it != client2ClientInfoOnReturn.end(); ++it)272 for (boost::unordered_map<int,unsigned char*>::const_iterator it = client2ClientInfoOnReturn.begin(); 273 it != client2ClientInfoOnReturn.end(); ++it) 272 274 delete [] it->second; 273 275 274 for ( std::map<int,size_t*>::const_iterator it = client2ClientIndexOnReturn.begin();276 for (boost::unordered_map<int,size_t*>::const_iterator it = client2ClientIndexOnReturn.begin(); 275 277 it != client2ClientIndexOnReturn.end(); ++it) 276 278 delete [] it->second; … … 342 344 } 343 345 344 std::map<int, size_t*> client2ClientIndex;345 std::map<int, unsigned char*> client2ClientInfo;346 boost::unordered_map<int, size_t*> client2ClientIndex; 347 boost::unordered_map<int, unsigned char*> client2ClientInfo; 346 348 for (int idx = 0; idx < nbClient; ++idx) 347 349 { … … 407 409 } 408 410 409 std::map<int, size_t* >::iterator itbIndex = client2ClientIndex.begin(), itIndex,410 iteIndex = client2ClientIndex.end();411 boost::unordered_map<int, size_t* >::iterator itbIndex = client2ClientIndex.begin(), itIndex, 412 iteIndex = client2ClientIndex.end(); 411 413 for (itIndex = itbIndex; itIndex != iteIndex; ++itIndex) 412 414 sendIndexToClients(itIndex->first, itIndex->second, sendNbIndexBuff[itIndex->first-groupRankBegin], commLevel, request); 413 std::map<int, unsigned char*>::iterator itbInfo = client2ClientInfo.begin(), itInfo,414 iteInfo = client2ClientInfo.end();415 boost::unordered_map<int, unsigned char*>::iterator itbInfo = client2ClientInfo.begin(), itInfo, 416 iteInfo = client2ClientInfo.end(); 415 417 for (itInfo = itbInfo; itInfo != iteInfo; ++itInfo) 416 418 sendInfoToClients(itInfo->first, itInfo->second, sendNbInfo[itInfo->first-groupRankBegin], commLevel, request); … … 420 422 421 423 boost::unordered_map<size_t,InfoType> indexToInfoMapping; 424 indexToInfoMapping.rehash(std::ceil(currentIndex/indexToInfoMapping.max_load_factor())); 422 425 currentIndex = 0; 423 426 InfoType infoValue; … … 440 443 delete [] recvInfoBuff; 441 444 } 442 for ( std::map<int,unsigned char*>::const_iterator it = client2ClientInfo.begin();443 it != client2ClientInfo.end(); ++it)445 for (boost::unordered_map<int,unsigned char*>::const_iterator it = client2ClientInfo.begin(); 446 it != client2ClientInfo.end(); ++it) 444 447 delete [] it->second; 445 448 446 for ( std::map<int,size_t*>::const_iterator it = client2ClientIndex.begin();447 it != client2ClientIndex.end(); ++it)449 for (boost::unordered_map<int,size_t*>::const_iterator it = client2ClientIndex.begin(); 450 it != client2ClientIndex.end(); ++it) 448 451 delete [] it->second; 449 452 … … 455 458 } 456 459 else 457 index2InfoMapping_ = (indexToInfoMapping);460 index2InfoMapping_.swap(indexToInfoMapping); //index2InfoMapping_ = (indexToInfoMapping); 458 461 } 459 462 -
XIOS/trunk/src/client_server_mapping.cpp
r832 r843 12 12 13 13 CClientServerMapping::CClientServerMapping() 14 : indexGlobalOnServer_() , connectedClients_() //, localIndexSend2Server_()14 : indexGlobalOnServer_() 15 15 { 16 16 } -
XIOS/trunk/src/client_server_mapping.hpp
r831 r843 45 45 //! Global index of data on SERVER, which are calculated by client(s) 46 46 GlobalIndexMap indexGlobalOnServer_; 47 48 //!< Number of clients connected to a server49 std::map<int, int> connectedClients_;50 47 }; 51 48 -
XIOS/trunk/src/client_server_mapping_distributed.cpp
r835 r843 38 38 ccDHT_->computeIndexInfoMapping(globalIndexOnClient); 39 39 const boost::unordered_map<size_t,int>& infoIndexMap = (ccDHT_->getInfoIndexMap()); 40 boost::unordered_map<size_t,int>::const_iterator it = infoIndexMap.begin(), ite = infoIndexMap.end(); 41 for (; it != ite; ++it) 40 boost::unordered_map<size_t,int>::const_iterator itb = infoIndexMap.begin(), ite = infoIndexMap.end(), it; 41 std::vector<size_t> nbInfoIndex(ccDHT_->getNbClient(),0); 42 43 for (it = itb; it != ite; ++it) 42 44 { 43 indexGlobalOnServer_[it->second].push_back(it->first); 45 ++nbInfoIndex[it->second]; 46 } 47 48 for (int idx = 0; idx < nbInfoIndex.size(); ++idx) 49 { 50 if (0 != nbInfoIndex[idx]) 51 { 52 indexGlobalOnServer_[idx].resize(nbInfoIndex[idx]); 53 nbInfoIndex[idx] = 0; 54 } 55 } 56 57 for (it = itb; it != ite; ++it) 58 { 59 indexGlobalOnServer_[it->second][nbInfoIndex[it->second]] = (it->first); 60 ++nbInfoIndex[it->second]; 44 61 } 45 62 } -
XIOS/trunk/src/distribution_client.cpp
r834 r843 17 17 , dataNIndex_(), dataDims_(), dataBegin_(), dataIndex_(), domainMasks_(), axisMasks_() 18 18 , gridMask_(), localDomainIndex_(), localAxisIndex_(), indexMap_(), indexDomainData_(), indexAxisData_() 19 , isDataDistributed_(true), axisNum_(0), domainNum_(0) , nIndexDomain_(), nIndexAxis_()19 , isDataDistributed_(true), axisNum_(0), domainNum_(0) 20 20 , localDataIndex_(), localMaskIndex_() 21 21 , globalLocalDataSendToServerMap_() … … 30 30 , dataNIndex_(), dataDims_(), dataBegin_(), dataIndex_(), domainMasks_(), axisMasks_() 31 31 , gridMask_(), localDomainIndex_(), localAxisIndex_(), indexMap_(), indexDomainData_(), indexAxisData_() 32 , isDataDistributed_(true), axisNum_(0), domainNum_(0) , nIndexDomain_(), nIndexAxis_()32 , isDataDistributed_(true), axisNum_(0), domainNum_(0) 33 33 , localDataIndex_(), localMaskIndex_() 34 34 , globalLocalDataSendToServerMap_() … … 37 37 readDistributionInfo(grid); 38 38 createGlobalIndex(); 39 // createGlobalIndexSendToServer();40 39 } 41 40 … … 81 80 } 82 81 83 void CDistributionClient::readDomainIndex(const std::vector<CDomain*>& domList)84 {85 int domainSize = domList.size();86 nIndexDomain_.resize(domainSize);87 88 for (int k = 0; k < domainSize; ++k)89 {90 nIndexDomain_[k].resize(2);91 int ni = domList[k]->ni;92 int nj = domList[k]->nj;93 nIndexDomain_[k][0].resize(ni*nj);94 nIndexDomain_[k][1].resize(ni*nj);95 nIndexDomain_[k][0] = domList[k]->i_index;96 nIndexDomain_[k][1] = domList[k]->j_index;97 }98 }99 100 void CDistributionClient::readAxisIndex(const std::vector<CAxis*>& axisList)101 {102 int axisSize = axisList.size();103 nIndexAxis_.resize(axisSize);104 105 for (int k = 0; k < axisSize; ++k)106 {107 int n = axisList[k]->n;108 nIndexAxis_[k].resize(n);109 for (int i = 0; i < n; ++i)110 nIndexAxis_[k](i) = i;111 }112 }113 114 82 /*! 115 83 Read information from domain(s) and axis to generate distribution. … … 204 172 205 173 dataBegin_.at(indexMap_[idx]+1) = domList[domIndex]->data_jbegin.getValue(); //(2 == domList[domIndex]->data_dim) ? domList[domIndex]->data_jbegin.getValue() : -1; 206 // dataIndex_.at(indexMap_[idx]+1).resize(domList[domIndex]->data_j_index.numElements());207 174 dataIndex_.at(indexMap_[idx]+1) = &(domList[domIndex]->data_j_index); 208 // infoIndex_.at(indexMap_[idx]+1).resize(domList[domIndex]->j_index.numElements());209 175 infoIndex_.at(indexMap_[idx]+1) = &(domList[domIndex]->j_index); 210 176 … … 218 184 219 185 dataBegin_.at(indexMap_[idx]) = domList[domIndex]->data_ibegin.getValue(); 220 // dataIndex_.at(indexMap_[idx]).resize(domList[domIndex]->data_i_index.numElements());221 186 dataIndex_.at(indexMap_[idx]) = &(domList[domIndex]->data_i_index); 222 // infoIndex_.at(indexMap_[idx]).resize(domList[domIndex]->i_index.numElements());223 187 infoIndex_.at(indexMap_[idx]) = &(domList[domIndex]->i_index); 224 188 … … 240 204 241 205 dataBegin_.at(indexMap_[idx]) = axisList[axisIndex]->data_begin.getValue(); 242 // dataIndex_.at(indexMap_[idx]).resize(axisList[axisIndex]->data_index.numElements());243 206 dataIndex_.at(indexMap_[idx]) = &(axisList[axisIndex]->data_index); 244 // infoIndex_.at(indexMap_[idx]).resize(axisList[axisIndex]->index.numElements());245 207 infoIndex_.at(indexMap_[idx]) = &(axisList[axisIndex]->index); 246 208 dataNIndex_.at(idx) = axisList[axisIndex]->data_index.numElements(); … … 253 215 ++idx; 254 216 } 255 readDomainIndex(domList);256 readAxisIndex(axisList);257 217 } 258 218 … … 511 471 localDataIndex_.resize(indexLocalDataOnClientCount); 512 472 localMaskIndex_.resize(indexSend2ServerCount); 473 globalLocalDataSendToServerMap_.rehash(std::ceil(indexSend2ServerCount/globalLocalDataSendToServerMap_.max_load_factor())); //globalLocalDataSendToServerMap_.reserve(indexSend2ServerCount); 513 474 514 475 // We need to loop with data index -
XIOS/trunk/src/distribution_client.hpp
r834 r843 62 62 const std::vector<CAxis*>& axisList, 63 63 const CArray<bool,1>& axisDomainOrder); 64 void readDomainIndex(const std::vector<CDomain*>& domList);65 void readAxisIndex(const std::vector<CAxis*>& axisList);66 64 private: 67 65 //! Create local index of a domain … … 92 90 std::vector<int> nZoomBegin_; //!< Begin index of zoom of each dimension 93 91 std::vector<int> nZoomEnd_; //!< End index of zoom of each dimension 94 std::vector<std::vector<CArray<int,1> > > nIndexDomain_; //!< Local index of each domain dimension (e.x: i_index, j_index)95 std::vector<CArray<int,1> > nIndexAxis_;96 92 97 93 // Data_n_index of domain or axis (For now, axis uses its size as data_n_index -
XIOS/trunk/src/server_distribution_description.cpp
r815 r843 117 117 << "Index begin is larger than index end"); 118 118 119 globalIndex_.rehash(std::ceil((indexEnd-indexBegin+1)/globalIndex_.max_load_factor())); 120 119 121 int dim = nGlobal_.size(); 120 122 std::vector<int> currentIndex(dim); … … 153 155 } 154 156 if ((indexBegin <= globalIndex) && (globalIndex <= indexEnd)) 155 globalIndex_ .insert(std::make_pair<size_t,int>(globalIndex, idxServer));157 globalIndex_[globalIndex] = idxServer; 156 158 ++idx; 157 159 } -
XIOS/trunk/src/transformation/generic_algorithm_transformation.cpp
r841 r843 83 83 { 84 84 size_t srcGridSize = globalIndexSrcGrid[idx].size(); 85 // globaIndexWeightFromDestToSource[(it->first)].reserve(srcGridSize); 86 globaIndexWeightFromDestToSource[(it->first)].resize(srcGridSize); 85 // globaIndexWeightFromDestToSource[(it->first)].resize(srcGridSize); 86 DestinationGlobalIndex& tmp = globaIndexWeightFromDestToSource[(it->first)]; 87 tmp.resize(srcGridSize); 87 88 for (int i = 0; i < srcGridSize; ++i) 88 89 { 89 globaIndexWeightFromDestToSource[(it->first)][i] = (make_pair(it->second, make_pair(globalIndexSrcGrid[idx][i], currentVecWeight[i]))); 90 tmp[i].first = it->second; 91 tmp[i].second = make_pair(globalIndexSrcGrid[idx][i], currentVecWeight[i]); 92 // globaIndexWeightFromDestToSource[(it->first)][i] = (make_pair(it->second, make_pair(globalIndexSrcGrid[idx][i], currentVecWeight[i]))); 90 93 } 91 94 } -
XIOS/trunk/src/transformation/generic_algorithm_transformation.hpp
r833 r843 21 21 class CGenericAlgorithmTransformation 22 22 { 23 protected: 24 typedef std::vector<std::pair<int, std::pair<size_t,double> > > DestinationGlobalIndex; 23 25 public: 24 26 // Stupid global index map, it must be replaced by tuple 25 27 // Mapping between global index map of DESTINATION and its local index with pair of global index of SOURCE and weights 26 typedef boost::unordered_map<size_t, std::vector<std::pair<int, std::pair<size_t,double> > > > DestinationIndexMap; 28 typedef boost::unordered_map<size_t, DestinationGlobalIndex> DestinationIndexMap; 29 27 30 protected: 28 31 typedef boost::unordered_map<size_t,int> GlobalLocalMap; -
XIOS/trunk/src/transformation/transformation_mapping.cpp
r842 r843 31 31 32 32 // Mapping of global index and pair containing rank and local index 33 CClientClientDHTPairIntInt::Index2InfoTypeMap globalIndexOfServer; 33 CClientClientDHTPairIntInt::Index2InfoTypeMap globalIndexOfClientSrc; 34 globalIndexOfClientSrc.rehash(std::ceil(globalLocalIndexGridSrc.size()/globalIndexOfClientSrc.max_load_factor())); 35 34 36 PairIntInt pairIntInt; 35 37 for (; itIndex != iteIndex; ++itIndex) … … 37 39 pairIntInt.first = clientRank; 38 40 pairIntInt.second = itIndex->second; 39 globalIndexOf Server[itIndex->first] = pairIntInt;40 } 41 42 gridIndexClientClientMapping_ = new CClientClientDHTPairIntInt(globalIndexOf Server,41 globalIndexOfClientSrc[itIndex->first] = pairIntInt; 42 } 43 44 gridIndexClientClientMapping_ = new CClientClientDHTPairIntInt(globalIndexOfClientSrc, 43 45 client->intraComm); 44 46 }
Note: See TracChangeset
for help on using the changeset viewer.