Changeset 1184
- Timestamp:
- 06/26/17 16:44:24 (7 years ago)
- Location:
- XIOS/dev/dev_olga/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_olga/src/context_client.cpp
r1158 r1184 94 94 list<CBufferOut*> buffList; 95 95 bool couldBuffer = getBuffers(ranks, sizes, buffList, (!CXios::isClient && (CServer::serverLevel == 0) )); 96 //bool couldBuffer = getBuffers(ranks, sizes, buffList, false);96 // bool couldBuffer = getBuffers(ranks, sizes, buffList, CXios::isServer ); 97 97 98 98 if (couldBuffer) -
XIOS/dev/dev_olga/src/node/context.cpp
r1180 r1184 289 289 } 290 290 291 void CContext::setClientServerBuffer( )291 void CContext::setClientServerBuffer(CContextClient* contextClient) 292 292 { 293 293 size_t minBufferSize = CXios::minBufferSize; … … 300 300 301 301 std::map<int, StdSize> maxEventSize; 302 std::map<int, StdSize> bufferSize = getAttributesBufferSize(maxEventSize );303 std::map<int, StdSize> dataBufferSize = getDataBufferSize(maxEventSize );302 std::map<int, StdSize> bufferSize = getAttributesBufferSize(maxEventSize, contextClient); 303 std::map<int, StdSize> dataBufferSize = getDataBufferSize(maxEventSize, contextClient); 304 304 305 305 std::map<int, StdSize>::iterator it, ite = dataBufferSize.end(); … … 319 319 if (it->second < minBufferSize) it->second = minBufferSize; 320 320 321 if (c lient->isServerLeader())322 { 323 const std::list<int>& ranks = c lient->getRanksServerLeader();321 if (contextClient->isServerLeader()) 322 { 323 const std::list<int>& ranks = contextClient->getRanksServerLeader(); 324 324 for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 325 325 if (!bufferSize.count(*itRank)) bufferSize[*itRank] = maxEventSize[*itRank] = minBufferSize; 326 326 } 327 client->setBufferSize(bufferSize, maxEventSize); 328 329 // If it is primary server pool, also set buffer for clientPrimServer. 330 if (hasClient && hasServer) 331 { 332 for (int i = 0; i < clientPrimServer.size(); ++i) 333 { 334 if (clientPrimServer[i]->isServerLeader()) 335 { 336 const std::list<int>& ranks = clientPrimServer[i]->getRanksServerLeader(); 337 for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 338 if (!bufferSize.count(*itRank)) bufferSize[*itRank] = maxEventSize[*itRank] = minBufferSize; 339 } 340 clientPrimServer[i]->setBufferSize(bufferSize, maxEventSize); 341 } 342 } 327 contextClient->setBufferSize(bufferSize, maxEventSize); 328 343 329 } 344 330 … … 536 522 checkGridEnabledFields(); 537 523 538 setClientServerBuffer(); 524 setClientServerBuffer(client); 525 if (hasServer) 526 for (int i = 0; i < clientPrimServer.size(); ++i) 527 setClientServerBuffer(clientPrimServer[i]); 528 539 529 540 530 if (hasClient) … … 1197 1187 * \param maxEventSize [in/out] the size of the bigger event for each connected server 1198 1188 */ 1199 std::map<int, StdSize> CContext::getAttributesBufferSize(std::map<int, StdSize>& maxEventSize )1189 std::map<int, StdSize> CContext::getAttributesBufferSize(std::map<int, StdSize>& maxEventSize, CContextClient* contextClient) 1200 1190 { 1201 1191 std::map<int, StdSize> attributesSize; … … 1207 1197 { 1208 1198 CFile* file = this->enabledFiles[i]; 1209 1210 std::vector<CField*> enabledFields = file->getEnabledFields(); 1211 size_t numEnabledFields = enabledFields.size(); 1212 for (size_t j = 0; j < numEnabledFields; ++j) 1199 if (file->getContextClient() == contextClient) 1213 1200 { 1214 const std::map<int, StdSize> mapSize = enabledFields[j]->getGridAttributesBufferSize();1215 s td::map<int, StdSize>::const_iterator it = mapSize.begin(), itE = mapSize.end();1216 for ( ; it != itE; ++it)1201 std::vector<CField*> enabledFields = file->getEnabledFields(); 1202 size_t numEnabledFields = enabledFields.size(); 1203 for (size_t j = 0; j < numEnabledFields; ++j) 1217 1204 { 1218 // If attributesSize[it->first] does not exist, it will be zero-initialized 1219 // so we can use it safely without checking for its existance 1220 if (attributesSize[it->first] < it->second) 1221 attributesSize[it->first] = it->second; 1222 1223 if (maxEventSize[it->first] < it->second) 1224 maxEventSize[it->first] = it->second; 1205 const std::map<int, StdSize> mapSize = enabledFields[j]->getGridAttributesBufferSize(); 1206 std::map<int, StdSize>::const_iterator it = mapSize.begin(), itE = mapSize.end(); 1207 for (; it != itE; ++it) 1208 { 1209 // If attributesSize[it->first] does not exist, it will be zero-initialized 1210 // so we can use it safely without checking for its existance 1211 if (attributesSize[it->first] < it->second) 1212 attributesSize[it->first] = it->second; 1213 1214 if (maxEventSize[it->first] < it->second) 1215 maxEventSize[it->first] = it->second; 1216 } 1225 1217 } 1226 1218 } … … 1236 1228 * \param maxEventSize [in/out] the size of the bigger event for each connected server 1237 1229 */ 1238 std::map<int, StdSize> CContext::getDataBufferSize(std::map<int, StdSize>& maxEventSize )1230 std::map<int, StdSize> CContext::getDataBufferSize(std::map<int, StdSize>& maxEventSize, CContextClient* contextClient) 1239 1231 { 1240 1232 CFile::mode_attr::t_enum mode = hasClient ? CFile::mode_attr::write : CFile::mode_attr::read; … … 1247 1239 { 1248 1240 CFile* file = this->enabledFiles[i]; 1249 CFile::mode_attr::t_enum fileMode = file->mode.isEmpty() ? CFile::mode_attr::write : file->mode.getValue(); 1250 1251 if (fileMode == mode) 1241 if (file->getContextClient() == contextClient) 1252 1242 { 1253 std::vector<CField*> enabledFields = file->getEnabledFields();1254 size_t numEnabledFields = enabledFields.size(); 1255 for (size_t j = 0; j < numEnabledFields; ++j)1243 CFile::mode_attr::t_enum fileMode = file->mode.isEmpty() ? CFile::mode_attr::write : file->mode.getValue(); 1244 1245 if (fileMode == mode) 1256 1246 { 1257 const std::vector<std::map<int, StdSize> > mapSize = enabledFields[j]->getGridDataBufferSize(); 1258 for (size_t c = 0; c < mapSize.size(); ++c) 1247 std::vector<CField*> enabledFields = file->getEnabledFields(); 1248 size_t numEnabledFields = enabledFields.size(); 1249 for (size_t j = 0; j < numEnabledFields; ++j) 1259 1250 { 1260 std::map<int, StdSize>::const_iterator it = mapSize[c].begin(), itE = mapSize[c].end();1261 for ( ; it != itE; ++it)1251 const std::vector<std::map<int, StdSize> > mapSize = enabledFields[j]->getGridDataBufferSize(); 1252 for (size_t c = 0; c < mapSize.size(); ++c) 1262 1253 { 1263 // If dataSize[it->first] does not exist, it will be zero-initialized 1264 // so we can use it safely without checking for its existance 1265 if (CXios::isOptPerformance) 1266 dataSize[it->first] += it->second; 1267 else if (dataSize[it->first] < it->second) 1268 dataSize[it->first] = it->second; 1269 1270 if (maxEventSize[it->first] < it->second) 1271 maxEventSize[it->first] = it->second; 1254 std::map<int, StdSize>::const_iterator it = mapSize[c].begin(), itE = mapSize[c].end(); 1255 for (; it != itE; ++it) 1256 { 1257 // If dataSize[it->first] does not exist, it will be zero-initialized 1258 // so we can use it safely without checking for its existance 1259 if (CXios::isOptPerformance) 1260 dataSize[it->first] += it->second; 1261 else if (dataSize[it->first] < it->second) 1262 dataSize[it->first] = it->second; 1263 1264 if (maxEventSize[it->first] < it->second) 1265 maxEventSize[it->first] = it->second; 1266 } 1272 1267 } 1273 1268 } -
XIOS/dev/dev_olga/src/node/context.hpp
r1144 r1184 131 131 void sendGridEnabledFields(); 132 132 133 std::map<int, StdSize> getAttributesBufferSize(std::map<int, StdSize>& maxEventSize); 134 std::map<int, StdSize> getDataBufferSize(std::map<int, StdSize>& maxEventSize); 135 void setClientServerBuffer(); 133 // std::map<int, StdSize> getAttributesBufferSize(std::map<int, StdSize>& maxEventSize); 134 // std::map<int, StdSize> getDataBufferSize(std::map<int, StdSize>& maxEventSize); 135 // void setClientServerBuffer(); 136 std::map<int, StdSize> getAttributesBufferSize(std::map<int, StdSize>& maxEventSize, CContextClient* contextClient); 137 std::map<int, StdSize> getDataBufferSize(std::map<int, StdSize>& maxEventSize, CContextClient* contextClient); 138 void setClientServerBuffer(CContextClient* contextClient); 136 139 137 140 // Send context close definition -
XIOS/dev/dev_olga/src/server.cpp
r1180 r1184 267 267 interCommLeft.push_back(newComm) ; 268 268 } 269 delete [] srvGlobalRanks ; 270 271 oasis_enddef() ; 269 if (CXios::usingServer2) delete [] srvGlobalRanks ; 270 oasis_enddef() ; 272 271 } 272 273 273 274 274 MPI_Comm_rank(intraComm, &rank) ;
Note: See TracChangeset
for help on using the changeset viewer.