Changeset 988
- Timestamp:
- 11/16/16 14:53:16 (7 years ago)
- Location:
- XIOS/trunk/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/context_client.cpp
r917 r988 50 50 for (int i = 0; i < serverByClient; i++) 51 51 ranksServerLeader.push_back(rankStart + i); 52 53 ranksServerNotLeader.resize(0); 52 54 } 53 55 else … … 60 62 if (clientRank % (clientByServer + 1) == 0) 61 63 ranksServerLeader.push_back(clientRank / (clientByServer + 1)); 64 else 65 ranksServerNotLeader.push_back(clientRank / (clientByServer + 1)); 62 66 } 63 67 else … … 66 70 if (rank % clientByServer == 0) 67 71 ranksServerLeader.push_back(remain + rank / clientByServer); 68 } 72 else 73 ranksServerNotLeader.push_back(remain + rank / clientByServer); 74 } 69 75 } 70 76 … … 249 255 \return ranks of leading servers 250 256 */ 257 const std::list<int>& CContextClient::getRanksServerNotLeader(void) const 258 { 259 return ranksServerNotLeader; 260 } 261 262 /*! 263 Check if client connects to leading server 264 \return connected(true), not connected (false) 265 */ 266 bool CContextClient::isServerNotLeader(void) const 267 { 268 return !ranksServerNotLeader.empty(); 269 } 270 271 /*! 272 Get leading server in the group of connected server 273 \return ranks of leading servers 274 */ 251 275 const std::list<int>& CContextClient::getRanksServerLeader(void) const 252 276 { -
XIOS/trunk/src/context_client.hpp
r917 r988 41 41 42 42 bool isServerLeader(void) const; 43 bool isServerNotLeader(void) const; 43 44 const std::list<int>& getRanksServerLeader(void) const; 45 const std::list<int>& getRanksServerNotLeader(void) const; 44 46 45 47 bool isAttachedModeEnabled() const; … … 80 82 std::list<int> ranksServerLeader; 81 83 84 //! List of server ranks for which the client is not leader 85 std::list<int> ranksServerNotLeader; 86 82 87 public: // Some function should be removed in the future 83 88 // void registerEvent(CEventClient& event); -
XIOS/trunk/src/filter/source_filter.cpp
r932 r988 48 48 packet->status = CDataPacket::NO_ERROR; 49 49 50 if (data.size() != grid->storeIndex_toSrv.size()) 50 // if (data.size() != grid->storeIndex_toSrv.size()) 51 if (data.size() != grid->storeIndex_fromSrv.size()) 51 52 ERROR("CSourceFilter::streamDataFromServer(CDate date, const std::map<int, CArray<double, 1> >& data)", 52 53 << "Incoherent data received from servers," 53 << " expected " << grid->storeIndex_ toSrv.size() << " chunks but " << data.size() << " were given.");54 << " expected " << grid->storeIndex_fromSrv.size() << " chunks but " << data.size() << " were given."); 54 55 55 56 packet->data.resize(grid->storeIndex_client.numElements()); … … 57 58 for (it = data.begin(); it != itEnd; it++) 58 59 { 59 CArray<int,1>& index = grid->storeIndex_toSrv[it->first];60 60 // CArray<int,1>& index = grid->storeIndex_toSrv[it->first]; 61 CArray<int,1>& index = grid->storeIndex_fromSrv[it->first]; 61 62 for (int n = 0; n < index.numElements(); n++) 62 63 packet->data(index(n)) = it->second(n); -
XIOS/trunk/src/node/field.cpp
r967 r988 310 310 311 311 map<int, CArray<double,1> >::iterator it; 312 for (it = data_srv.begin(); it != data_srv.end(); it++) 313 { 314 msgs.push_back(CMessage()); 315 CMessage& msg = msgs.back(); 316 msg << getId(); 317 if (hasData) 318 msg << getNStep() - 1 << it->second; 319 else 320 msg << int(-1); 321 event.push(it->first, grid->nbSenders[it->first], msg); 322 } 323 client->sendEvent(event); 312 if (!grid->doGridHaveDataDistributed()) 313 { 314 if (client->isServerLeader()) 315 { 316 if (!data_srv.empty()) 317 { 318 it = data_srv.begin(); 319 const std::list<int>& ranks = client->getRanksServerLeader(); 320 for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 321 { 322 msgs.push_back(CMessage()); 323 CMessage& msg = msgs.back(); 324 msg << getId(); 325 if (hasData) 326 msg << getNStep() - 1 << it->second; 327 else 328 msg << int(-1); 329 event.push(*itRank, 1, msg); 330 } 331 } 332 client->sendEvent(event); 333 } 334 else 335 { 336 // if (!data_srv.empty()) 337 // { 338 // it = data_srv.begin(); 339 // const std::list<int>& ranks = client->getRanksServerNotLeader(); 340 // for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 341 // { 342 // msgs.push_back(CMessage()); 343 // CMessage& msg = msgs.back(); 344 // msg << getId(); 345 // if (hasData) 346 // msg << getNStep() - 1 << it->second; 347 // else 348 // msg << int(-1); 349 // event.push(*itRank, 1, msg); 350 // } 351 // } 352 client->sendEvent(event); 353 } 354 } 355 else 356 { 357 for (it = data_srv.begin(); it != data_srv.end(); it++) 358 { 359 msgs.push_back(CMessage()); 360 CMessage& msg = msgs.back(); 361 msg << getId(); 362 if (hasData) 363 msg << getNStep() - 1 << it->second; 364 else 365 msg << int(-1); 366 event.push(it->first, grid->nbSenders[it->first], msg); 367 } 368 client->sendEvent(event); 369 } 324 370 } 325 371 -
XIOS/trunk/src/node/grid.cpp
r968 r988 1044 1044 int rank = *itRank; 1045 1045 int nb = 1; 1046 storeIndex_toSrv.insert(std::make_pair(rank, CArray<int,1>(nb))); 1046 storeIndex_toSrv.insert(std::make_pair(rank, CArray<int,1>(nb))); 1047 1047 listOutIndex.push_back(CArray<size_t,1>(nb)); 1048 1048 … … 1056 1056 } 1057 1057 1058 storeIndex_fromSrv.insert(std::make_pair(rank, CArray<int,1>(outLocalIndexToServer))); 1058 1059 listMsg.push_back(CMessage()); 1059 1060 listMsg.back() << getId( )<< isDataDistributed_ << isCompressible_ << listOutIndex.back(); … … 1064 1065 } 1065 1066 else 1067 { 1068 const std::list<int>& ranks = client->getRanksServerNotLeader(); 1069 for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 1070 { 1071 int rank = *itRank; 1072 int nb = 1; 1073 storeIndex_fromSrv.insert(std::make_pair(rank, CArray<int,1>(nb))); 1074 CArray<int, 1>& outLocalIndexToServer = storeIndex_fromSrv[rank]; 1075 for (int k = 0; k < nb; ++k) 1076 { 1077 outLocalIndexToServer(k) = 0; 1078 } 1079 } 1066 1080 client->sendEvent(event); 1081 } 1067 1082 } 1068 1083 … … 1092 1107 outLocalIndexToServer(idx) = itIndex->second; 1093 1108 } 1094 1095 //int nbClient = client->clientSize; // This stupid variable signals the servers the number of client connect to them 1109 1096 1110 const std::list<int>& ranks = client->getRanksServerLeader(); 1097 1111 for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 1098 1112 { 1099 1113 storeIndex_toSrv.insert(std::make_pair(*itRank, CArray<int,1>(outLocalIndexToServer))); 1114 storeIndex_fromSrv.insert(std::make_pair(*itRank, CArray<int,1>(outLocalIndexToServer))); 1100 1115 listOutIndex.push_back(CArray<size_t,1>(outGlobalIndexOnServer)); 1101 1116 … … 1107 1122 client->sendEvent(event); 1108 1123 } 1109 else 1124 else 1125 { 1126 int indexSize = globalLocalIndexSendToServer.size(); 1127 CArray<int,1> outLocalIndexToServer(indexSize); 1128 for (int idx = 0; itIndex != iteIndex; ++itIndex, ++idx) 1129 { 1130 outLocalIndexToServer(idx) = itIndex->second; 1131 } 1132 1133 const std::list<int>& ranks = client->getRanksServerNotLeader(); 1134 for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 1135 { 1136 storeIndex_fromSrv.insert(std::make_pair(*itRank, CArray<int,1>(outLocalIndexToServer))); 1137 } 1110 1138 client->sendEvent(event); 1139 } 1111 1140 } 1112 1141 else … … 1141 1170 nb = globalIndexTmp[rank].size(); 1142 1171 1143 storeIndex_toSrv.insert(make_pair(rank, CArray<int,1>(nb))); 1172 storeIndex_toSrv.insert(make_pair(rank, CArray<int,1>(nb))); 1144 1173 listOutIndex.push_back(CArray<size_t,1>(nb)); 1145 1174 … … 1153 1182 } 1154 1183 1184 storeIndex_fromSrv.insert(make_pair(rank, CArray<int,1>(outLocalIndexToServer))); 1155 1185 listMsg.push_back(CMessage()); 1156 1186 listMsg.back() << getId() << isDataDistributed_ << isCompressible_ << listOutIndex.back(); -
XIOS/trunk/src/node/grid.hpp
r976 r988 221 221 222 222 map<int, CArray<int, 1> > storeIndex_toSrv; 223 map<int, CArray<int, 1> > storeIndex_fromSrv; 223 224 map<int,int> nbSenders; 224 225
Note: See TracChangeset
for help on using the changeset viewer.