Changeset 2507 for XIOS3/trunk/src/node/context.cpp
- Timestamp:
- 06/01/23 10:58:08 (13 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS3/trunk/src/node/context.cpp
r2498 r2507 7 7 #include "duration.hpp" 8 8 9 #include "online_context_client.hpp" 9 10 #include "legacy_context_client.hpp" 10 11 #include "legacy_context_server.hpp" … … 662 663 663 664 int serviceType ; 664 //if (intraCommRank_==0) CXios::getServicesManager()->getServiceType(poolId, serviceId, 0, serviceType, true) ; 665 if (intraCommRank_==0) CXios::getServicesManager()->getServiceType(poolId, serviceId, 0, serviceType) ; 665 if (intraCommRank_==0) CXios::getServicesManager()->getServiceType(poolId, serviceId, 0, serviceType, true) ; 666 666 MPI_Bcast(&serviceType,1,MPI_INT,0,intraComm_) ; 667 667 … … 679 679 vector<CContextClient*> CContext::getContextClient(const string& poolId, const string& serviceId) 680 680 { 681 vector<pair<CContextClient*,CContextServer*>> clientServers ; 682 getServerInterComm(poolId, serviceId, clientServers ) ; 683 vector<CContextClient*> ret ; 684 for(auto& clientServer : clientServers) ret.push_back(clientServer.first) ; 681 vector<CContextClient*> ret ; 682 683 if (serviceId=="attached") ret.push_back(onlineContextClient_) ; 684 else 685 { 686 vector<pair<CContextClient*,CContextServer*>> clientServers ; 687 getServerInterComm(poolId, serviceId, clientServers ) ; 688 for(auto& clientServer : clientServers) ret.push_back(clientServer.first) ; 689 } 685 690 return ret ; 686 691 } … … 808 813 if (serviceType_==CServicesManager::CLIENT) 809 814 { 810 //ym doPreTimestepOperationsForEnabledReadModeFiles(); // For now we only use server level 1 to read data811 815 triggerLateFields() ; 812 816 … … 986 990 987 991 CTimer::get("Context : close definition").resume() ; 992 993 onlineContextClient_=CContextClient::getNew<CContextClient::online>(this,intraComm_, intraComm_); 988 994 989 995 // create intercommunicator with servers. … … 1146 1152 { 1147 1153 for(auto field : fileInField) 1148 { 1149 field->sendFieldToInputFileServer() ; 1150 field->connectToServerInput(garbageCollector) ; // connect the field to server filter 1154 if (field->getContextClient()->getType() != CContextClient::online) field->sendFieldToInputFileServer() ; 1155 1156 for(auto field : fileInField) 1157 { 1158 if (field->getContextClient()->getType() == CContextClient::online) field->connectToOnlineReader(garbageCollector) ; 1159 else field->connectToServerInput(garbageCollector) ; // connect the field to server filter 1151 1160 fileInFields_.push_back(field) ; 1152 1161 } … … 1158 1167 for(auto field : fileOutField) 1159 1168 { 1160 field->connectToFileServer(garbageCollector) ; // connect the field to server filter 1161 } 1162 for(auto field : fileOutField) field->sendFieldToFileServer() ; 1169 if (field->getContextClient()->getType() == CContextClient::online) field->connectToOnlineWriter(garbageCollector) ; 1170 else field->connectToFileServer(garbageCollector) ; // connect the field to server filter 1171 } 1172 for(auto field : fileOutField) 1173 if (field->getContextClient()->getType() != CContextClient::online) field->sendFieldToFileServer() ; 1163 1174 } 1164 1175 … … 1177 1188 for(auto field : fileInField) 1178 1189 { 1179 field->connectToServerToClient(garbageCollector) ; 1190 if (field->getContextClient()->getType() == CContextClient::online) field->connectToOnlineReader(garbageCollector) ; 1191 else field->connectToServerToClient(garbageCollector) ; 1180 1192 } 1181 1193 } … … 1232 1244 if (serviceType_==CServicesManager::CLIENT) 1233 1245 { 1234 for(auto field : fileOutField) slaves[clientsId_[field->getContextClient()]] = field->getContextClient() ; 1235 for(auto field : fileInField) slaves[clientsId_[field->getContextClient()]] = field->getContextClient() ; 1246 for(auto field : fileOutField) 1247 if (field->getContextClient()->getType()!=CContextClient::online) slaves[clientsId_[field->getContextClient()]] = field->getContextClient() ; 1248 for(auto field : fileInField) 1249 if (field->getContextClient()->getType()!=CContextClient::online) slaves[clientsId_[field->getContextClient()]] = field->getContextClient() ; 1236 1250 } 1237 1251 else if (serviceType_==CServicesManager::GATHERER) … … 1242 1256 for(auto& slaveServer : slaveServers_) sendCloseDefinition(slaveServer) ; 1243 1257 1244 if (serviceType_==CServicesManager::WRITER) 1245 { 1246 createFileHeader(); 1247 } 1248 1249 if (serviceType_==CServicesManager::CLIENT) startPrefetchingOfEnabledReadModeFiles(); 1258 createFileHeader(); 1259 1260 //if (serviceType_==CServicesManager::CLIENT) startPrefetchingOfEnabledReadModeFiles(); 1261 if (serviceType_==CServicesManager::CLIENT) 1262 for(auto field : fileInField) field->sendReadDataRequest(getCalendar()->getCurrentDate()); 1250 1263 1251 1264 // send signal to couplerIn context that definition phasis is done … … 1356 1369 CATCH_DUMP_ATTR 1357 1370 1358 1359 void CContext::postProcessFilterGraph()1360 TRY1361 {1362 int size = enabledFiles.size();1363 for (int i = 0; i < size; ++i)1364 {1365 enabledFiles[i]->postProcessFilterGraph();1366 }1367 }1368 CATCH_DUMP_ATTR1369 1370 1371 void CContext::startPrefetchingOfEnabledReadModeFiles() 1371 1372 TRY … … 1375 1376 { 1376 1377 enabledReadModeFiles[i]->prefetchEnabledReadModeFields(); 1377 }1378 }1379 CATCH_DUMP_ATTR1380 1381 void CContext::doPreTimestepOperationsForEnabledReadModeFiles()1382 TRY1383 {1384 int size = enabledReadModeFiles.size();1385 for (int i = 0; i < size; ++i)1386 {1387 enabledReadModeFiles[i]->doPreTimestepOperationsForEnabledReadModeFields();1388 1378 } 1389 1379 } … … 2177 2167 if (serviceType_==CServicesManager::CLIENT) // For now we only use server level 1 to read data 2178 2168 { 2179 doPostTimestepOperationsForEnabledReadModeFiles(); 2169 // doPostTimestepOperationsForEnabledReadModeFiles(); 2170 for(auto& field : fileInFields_) field->sendReadDataRequestIfNeeded() ; 2180 2171 garbageCollector.invalidate(calendar->getCurrentDate()); 2181 2172 } … … 2202 2193 CATCH_DUMP_ATTR 2203 2194 2204 //! Server side:Create header of netcdf file2195 //! Create header of netcdf file 2205 2196 void CContext::createFileHeader(void) 2206 2197 TRY 2207 2198 { 2208 vector<CFile*>::const_iterator it; 2209 2210 //for (it=enabledFiles.begin(); it != enabledFiles.end(); it++) 2211 for (it=enabledWriteModeFiles.begin(); it != enabledWriteModeFiles.end(); it++) 2212 { 2213 (*it)->initWrite(); 2214 } 2199 for(auto& file : filesToWrite_) file->initWrite(); 2215 2200 } 2216 2201 CATCH_DUMP_ATTR
Note: See TracChangeset
for help on using the changeset viewer.