Changeset 1294
- Timestamp:
- 10/06/17 13:41:57 (7 years ago)
- Location:
- XIOS/dev/XIOS_DEV_CMIP6/src/node
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/XIOS_DEV_CMIP6/src/node/field.cpp
r1292 r1294 951 951 { 952 952 if (!instantDataFilter) 953 // instantDataFilter = clientSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, false, NoneDu, false, 954 // detectMissingValues, defaultValue)); 953 955 instantDataFilter = clientSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid,true)); 954 956 955 // If the field data is to be read by the client or/and written to a file 957 958 // If the field data is to be read by the client or/and written to a file 956 959 if (enableOutput && !storeFilter && !fileWriterFilter) 957 960 { … … 966 969 { 967 970 if (!instantDataFilter) 971 // instantDataFilter = clientSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, false, NoneDu, false, 972 // detectMissingValues, defaultValue)); 968 973 instantDataFilter = clientSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, true)); 969 974 … … 1502 1507 } 1503 1508 1509 void CField::setContextClient(CContextClient* contextClient) 1510 { 1511 client = contextClient; 1512 grid->setContextClient(contextClient); 1513 } 1514 1515 CContextClient* CField::getContextClient() 1516 { 1517 return client; 1518 } 1519 1504 1520 void CField::sendAddAllVariables(CContextClient* client) 1505 1521 { -
XIOS/dev/XIOS_DEV_CMIP6/src/node/field.hpp
r1278 r1294 102 102 std::map<int, StdSize> getGridAttributesBufferSize(CContextClient* client); 103 103 std::map<int, StdSize> getGridDataBufferSize(CContextClient* client); // Grid data buffer size for each connection of contextclient 104 105 void setContextClient(CContextClient* newContextClient); 106 CContextClient* getContextClient(); 104 107 105 108 public: … … 236 239 237 240 private: 241 CContextClient* client; 242 238 243 bool areAllReferenceSolved; 239 244 bool isReferenceSolved; -
XIOS/dev/XIOS_DEV_CMIP6/src/node/file.cpp
r1278 r1294 944 944 { 945 945 client = newContextClient; 946 size_t size = this->enabledFields.size(); 947 for (size_t i = 0; i < size; ++i) 948 { 949 this->enabledFields[i]->setContextClient(newContextClient); 950 } 946 951 } 947 952 -
XIOS/dev/XIOS_DEV_CMIP6/src/node/grid.cpp
r1263 r1294 36 36 , gridSrc_(), hasTransform_(false), isGenerated_(false), order_(), globalIndexOnServer_() 37 37 , computedWrittenIndex_(false) 38 , clients() 38 39 { 39 40 setVirtualDomainGroup(CDomainGroup::create(getId() + "_virtual_domain_group")); … … 55 56 , gridSrc_(), hasTransform_(false), isGenerated_(false), order_(), globalIndexOnServer_() 56 57 , computedWrittenIndex_(false) 58 , clients() 57 59 { 58 60 setVirtualDomainGroup(CDomainGroup::create(getId() + "_virtual_domain_group")); … … 643 645 } 644 646 } 645 646 647 } 647 648 … … 649 650 650 651 /* 651 Compute the global index and its local index on taking account of mask,data index.652 These global index then will be used to compute the connection of this client to other clients in the different group652 Compute the global index and its local index taking account mask and data index. 653 These global indexes will be used to compute the connection of this client (sender) to its servers (receivers) 653 654 (via function computeConnectedClient) 654 These global index also corresponding to data sent to other clients (if any)655 These global indexes also correspond to data sent to servers (if any) 655 656 */ 656 657 void CGrid::computeClientIndex() … … 1347 1348 { 1348 1349 CContext* context = CContext::getCurrent(); 1349 int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 0) : 1;1350 1350 storeIndex_toSrv.clear(); 1351 1352 for (int p = 0; p < nbSrvPools; ++p) 1353 { 1354 CContextClient* client = context->hasServer ? context->clientPrimServer[p] : context->client; 1351 std::set<CContextClient*>::iterator it; 1352 1353 for (it=clients.begin(); it!=clients.end(); ++it) 1354 { 1355 CContextClient* client = *it; 1355 1356 int receiverSize = client->serverSize; 1356 1357 … … 1412 1413 { 1413 1414 CContext* context = CContext::getCurrent(); 1414 int nbSrvPools = (context->clientPrimServer.size() == 0) ? 1 : context->clientPrimServer.size();1415 1415 storeIndex_toSrv.clear(); 1416 for (int p = 0; p < nbSrvPools; ++p) 1417 { 1418 CContextClient* client = (context->clientPrimServer.size() == 0) ? context->client : context->clientPrimServer[p]; 1416 std::set<CContextClient*>::iterator it; 1417 1418 for (it=clients.begin(); it!=clients.end(); ++it) 1419 { 1420 CContextClient* client = *it; 1419 1421 int receiverSize = client->serverSize; 1420 1422 … … 2502 2504 } 2503 2505 2506 void CGrid::setContextClient(CContextClient* contextClient) 2507 { 2508 clients.insert(contextClient); 2509 } 2510 2504 2511 /*! 2505 2512 Parse a grid, for now, it contains only domain, axis and scalar -
XIOS/dev/XIOS_DEV_CMIP6/src/node/grid.hpp
r1263 r1294 161 161 void sendIndex(void); 162 162 void sendIndexScalarGrid(); 163 164 void setContextClient(CContextClient* contextClient); 163 165 164 166 void computeDomConServer(); … … 215 217 map<int, CArray<int, 1> > storeIndex_fromSrv; // Support, for now, reading with level-1 server 216 218 217 218 map<int, CArray<size_t, 1> > outIndexFromClient, compressedOutIndexFromClient, outGlobalIndexFromClient; 219 220 // A client receives global index from other clients (via recvIndex) 221 // then does mapping these index into local index of STORE_CLIENTINDEX 222 // In this way, store_clientIndex can be used as an input of a source filter 223 // Maybe we need a flag to determine whether a client wants to write. TODO 219 map<int, CArray<size_t, 1> > outIndexFromClient; // Deprecated 220 221 map<int, CArray<size_t, 1> > compressedOutIndexFromClient; 222 223 /** Map storing received indexes. Key = sender rank, value = index array. */ 224 map<int, CArray<size_t, 1> > outGlobalIndexFromClient; 225 226 // Manh Ha's comment: " A client receives global index from other clients (via recvIndex) 227 // then does mapping these index into local index of STORE_CLIENTINDEX 228 // In this way, store_clientIndex can be used as an input of a source filter 229 // Maybe we need a flag to determine whether a client wants to write. TODO " 230 231 /** Map storing received data. Key = sender rank, value = data array. 232 * The map is created in CGrid::computeClientIndex and filled upon receiving data in CField::recvUpdateData() */ 224 233 map<int, CArray<size_t, 1> > outLocalIndexStoreOnClient; 225 234 226 /** Indexes calculated based on server distribution (serverDistribution_). They are used for writing data into a file. */ 235 /** Indexes calculated based on server-like distribution. 236 * They are used for writing/reading data and only calculated for server level that does the writing/reading. 237 * Along with localIndexToWriteOnClient, these indexes are used to correctly place incoming data. */ 227 238 CArray<size_t,1> localIndexToWriteOnServer; 228 239 229 /** Indexes calculated based on client distribution (clientDistribution_). They are not used at all. 230 They should be the same as localIndexToWriteOnServer and potentially can be used as an additional check.*/ 240 /** Indexes calculated based on client-like distribution. 241 * They are used for writing/reading data and only calculated for server level that does the writing/reading. 242 * Along with localIndexToWriteOnServer, these indexes are used to correctly place incoming data. */ 231 243 CArray<size_t,1> localIndexToWriteOnClient; 232 244 233 245 CArray<size_t,1> indexFromClients; 246 234 247 void checkMask(void); 235 248 void createMask(void); … … 289 302 290 303 private: 291 bool isChecked; 292 bool isDomainAxisChecked; 293 bool isIndexSent; 304 305 /** Clients that have to send a grid. There can be multiple clients in case of secondary server, otherwise only one client. */ 306 std::set<CContextClient*> clients; 307 308 bool isChecked; 309 bool isDomainAxisChecked; 310 bool isIndexSent; 294 311 295 312 CDomainGroup* vDomainGroup_; … … 299 316 bool isAxisListSet, isDomListSet, isScalarListSet; 300 317 301 /** Distribution calculated in computeClientIndex()based on the knowledge of the entire grid */318 /** Client-like distribution calculated based on the knowledge of the entire grid */ 302 319 CDistributionClient* clientDistribution_; 303 320 304 /** Distribution calculated upon receiving indexes */321 /** Server-like distribution calculated upon receiving indexes */ 305 322 CDistributionServer* serverDistribution_; 306 323 … … 345 362 void CGrid::inputField(const CArray<double,n>& field, CArray<double,1>& stored) const 346 363 { 364 //#ifdef __XIOS_DEBUG 347 365 if (this->getDataSize() != field.numElements()) 348 366 ERROR("void CGrid::inputField(const CArray<double,n>& field, CArray<double,1>& stored) const", … … 351 369 << "The data array does not have the right size! " 352 370 << "Grid = " << this->GetName()) 371 //#endif 353 372 this->storeField_arr(field.dataFirst(), stored); 354 373 } … … 357 376 void CGrid::outputField(const CArray<double,1>& stored, CArray<double,n>& field) const 358 377 { 378 //#ifdef __XIOS_DEBUG 359 379 if (this->getDataSize() != field.numElements()) 360 380 ERROR("void CGrid::outputField(const CArray<double,1>& stored, CArray<double,n>& field) const", … … 363 383 << "The ouput array does not have the right size! " 364 384 << "Grid = " << this->GetName()) 385 //#endif 365 386 this->restoreField_arr(stored, field.dataFirst()); 366 387 }
Note: See TracChangeset
for help on using the changeset viewer.