Changeset 2507
- Timestamp:
- 06/01/23 10:58:08 (12 months ago)
- Location:
- XIOS3/trunk/src
- Files:
-
- 25 added
- 50 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS3/trunk/src/config/domain_attribute.conf
r2479 r2507 62 62 63 63 DECLARE_ARRAY(double, 2, area, false) 64 DECLARE_ARRAY(double, 2, area_2d, false) 65 DECLARE_ARRAY(double, 1, area_1d, false) 64 66 DECLARE_ATTRIBUTE(double, radius) 65 67 -
XIOS3/trunk/src/config/node_type.conf
r2458 r2507 132 132 #endif //__XIOS_CServiceNode__ 133 133 134 #ifdef __XIOS_CRedistributeDomain__ 135 DECLARE_NODE(RedistributeDomain, redistribute_domain) 136 #endif //__XIOS_CRedistributeDomain__ 137 138 #ifdef __XIOS_CRedistributeAxis__ 139 DECLARE_NODE(RedistributeAxis, redistribute_axis) 140 #endif //__XIOS_CRedistributeAxis__ 141 142 #ifdef __XIOS_CRedistributeScalar__ 143 DECLARE_NODE(RedistributeScalar, redistribute_scalar) 144 #endif //__XIOS_CRedistributeScalar__ 145 134 146 #ifdef __XIOS_CContext__ 135 147 DECLARE_NODE_PAR(Context, context) -
XIOS3/trunk/src/distribution/grid_remote_connector.cpp
r2397 r2507 99 99 size_t globalIndexSize = globalIndex.numElements() ; 100 100 101 size_t allEqual ; 102 MPI_Allreduce(&globalIndexSize, &allEqual, 1, MPI_SIZE_T, MPI_BXOR, localComm_) ; 103 if (allEqual!=0) 101 size_t minVal,maxVal ; 102 MPI_Allreduce(&globalIndexSize, &minVal, 1, MPI_SIZE_T, MPI_MIN, localComm_) ; 103 MPI_Allreduce(&globalIndexSize, &maxVal, 1, MPI_SIZE_T, MPI_MAX, localComm_) ; 104 if (minVal!=maxVal) 104 105 { 105 106 isSrcViewDistributed_[i]=true ; … … 110 111 size_t hashValue=0 ; 111 112 for(size_t ind=0;ind<globalIndexSize;ind++) hashValue += hashGlobalIndex(globalIndex(ind)) ; 112 MPI_Allreduce(&hashValue, &allEqual, 1, MPI_SIZE_T, MPI_BXOR, localComm_) ; 113 if (allEqual!=0) isSrcViewDistributed_[i]=true ; 113 MPI_Allreduce(&hashValue, &minVal, 1, MPI_SIZE_T, MPI_MIN, localComm_) ; 114 MPI_Allreduce(&hashValue, &maxVal, 1, MPI_SIZE_T, MPI_MAX, localComm_) ; 115 if (minVal!=maxVal) isSrcViewDistributed_[i]=true ; 114 116 else isSrcViewDistributed_[i]=false ; 115 117 } -
XIOS3/trunk/src/distribution/transform_connector.hpp
r2267 r2507 32 32 33 33 public: 34 35 34 36 template<typename T> 35 void transfer(int repeat, int sizeT, const CArray<T,1>& dataIn, CArray<T,1>& dataOut )37 void transfer(int repeat, int sizeT, const CArray<T,1>& dataIn, CArray<T,1>& dataOut, bool useMissingValue, T missingValue) 36 38 { 37 39 map<int,CArray<T,1>> tmpArrayIn ; … … 58 60 MPI_Waitall(requests.size(), requests.data(),status.data()) ; 59 61 60 const double nanValue = std::numeric_limits<double>::quiet_NaN(); 61 gathererConnector_->transfer(repeat, sizeT , tmpArrayOut, dataOut, nanValue) ; 62 if (useMissingValue) gathererConnector_->transfer(repeat, sizeT , tmpArrayOut, dataOut, missingValue) ; 63 else gathererConnector_->transfer(repeat, sizeT , tmpArrayOut, dataOut) ; 64 // const double nanValue = std::numeric_limits<double>::quiet_NaN(); 65 // gathererConnector_->transfer(repeat, sizeT , tmpArrayOut, dataOut, nanValue) ; 66 } 67 68 template<typename T> 69 void transfer(int repeat, int sizeT, const CArray<T,1>& dataIn, CArray<T,1>& dataOut) 70 { 71 T missingValue ; 72 transfer(1, sizeT, dataIn, dataOut, false, missingValue) ; 73 } 74 75 template<typename T> 76 void transfer(int repeat, int sizeT, const CArray<T,1>& dataIn, CArray<T,1>& dataOut, T missingValue) 77 { 78 transfer(1, sizeT, dataIn, dataOut, true, missingValue) ; 62 79 } 63 80 … … 66 83 { 67 84 transfer(1, sizeT, dataIn, dataOut) ; 85 } 86 87 template<typename T> 88 void transfer(int sizeT, const CArray<T,1>& dataIn, CArray<T,1>& dataOut, T missingValue) 89 { 90 transfer(1, sizeT, dataIn, dataOut, missingValue) ; 68 91 } 69 92 … … 74 97 } 75 98 99 template<typename T> 100 void transfer(const CArray<T,1>& dataIn, CArray<T,1>& dataOut, T missingValue) 101 { 102 transfer(1, 1, dataIn, dataOut, missingValue) ; 103 } 104 76 105 }; 77 106 -
XIOS3/trunk/src/filter/file_writer_store_filter.cpp
r2143 r2507 29 29 if (!field->prec.isEmpty() && field->prec == 2) hasRounding_ = true ; 30 30 if (!field->default_value.isEmpty()) {hasDefaultValue_=true ; defaultValue_ = field->default_value ;} 31 context->registerFileToWrite(file_) ; 31 32 } 32 33 -
XIOS3/trunk/src/filter/output_pin.hpp
r2143 r2507 30 30 * \param inputSlot the input slot number 31 31 */ 32 void connectOutput(std::shared_ptr<CInputPin> inputPin, size_t inputSlot);32 void virtual connectOutput(std::shared_ptr<CInputPin> inputPin, size_t inputSlot); 33 33 34 34 /*! -
XIOS3/trunk/src/generate_fortran_interface.cpp
r2338 r2507 53 53 CDuplicateScalarToAxis duplicateScalarToAxis; 54 54 CReduceScalarToScalar reduceScalarToScalar; 55 56 CRedistributeDomain redistributeDomain ; 57 CRedistributeAxis redistributeAxis ; 58 CRedistributeScalar redistributeScalar ; 55 59 56 60 ostringstream oss; … … 329 333 file.open((path+"ireorder_domain_attr.F90").c_str()); 330 334 reorderDomain.generateFortranInterface(file); 335 file.close(); 336 337 file.open((path+"iredistribute_domain_attr.F90").c_str()); 338 redistributeDomain.generateFortranInterface(file); 331 339 file.close(); 332 340 … … 435 443 duplicateScalarToAxis.generateFortranInterface(file); 436 444 file.close(); 445 446 file.open((path+"iredistribute_axis_attr.F90").c_str()); 447 redistributeAxis.generateFortranInterface(file); 448 file.close(); 449 437 450 /*! 438 451 Scalar transformations … … 488 501 file.close(); 489 502 503 file.open((path+"iredistribute_scalar_attr.F90").c_str()); 504 redistributeScalar.generateFortranInterface(file); 505 file.close(); 490 506 491 507 -
XIOS3/trunk/src/group_factory_decl.cpp
r2458 r2507 50 50 macro(CPoolNodeGroup) 51 51 macro(CServiceNodeGroup) 52 macro(CRedistributeDomainGroup) 53 macro(CRedistributeAxisGroup) 54 macro(CRedistributeScalarGroup) 52 55 53 56 } -
XIOS3/trunk/src/group_template_decl.cpp
r2458 r2507 39 39 macro(PoolNode) 40 40 macro(ServiceNode) 41 macro(RedistributeDomain) 42 macro(RedistributeAxis) 43 macro(RedistributeScalar) 41 44 42 45 } -
XIOS3/trunk/src/io/nc4_data_input.cpp
r2338 r2507 81 81 if ((domain->type) != CDomain::type_attr::unstructured) 82 82 { 83 start.push_back(domain->jbegin );84 count.push_back(domain->nj );83 start.push_back(domain->jbeginValue_); 84 count.push_back(domain->njValue_); 85 85 } 86 start.push_back(domain->ibegin );87 count.push_back(domain->ni );86 start.push_back(domain->ibeginValue_); 87 count.push_back(domain->niValue_); 88 88 --idxDomain; 89 89 } … … 131 131 // Verify the compatibility of dimension of declared grid and real grid in file 132 132 int realGridDim = 1; 133 bool isUnstructuredGrid = ((gridDim < 2 ) ? false : SuperClassWriter::isUnstructured(fieldId));133 bool isUnstructuredGrid = ((gridDim < 2 || domainP.size()==0) ? false : SuperClassWriter::isUnstructured(fieldId)); 134 134 std::map<StdString, StdSize> dimSizeMap = SuperClassWriter::getDimensions(&fieldId); 135 135 std::list<StdString> dimList = SuperClassWriter::getDimensionsList(&fieldId); -
XIOS3/trunk/src/io/nc4_data_output.cpp
r2481 r2507 202 202 else bounds_latid = "bounds_"+latName+appendDomid; 203 203 204 SuperClassWriter::addDimension(dimXid, domain->ni );205 SuperClassWriter::addDimension(dimYid, domain->nj );204 SuperClassWriter::addDimension(dimXid, domain->niValue_); 205 SuperClassWriter::addDimension(dimYid, domain->njValue_); 206 206 207 207 if (domain->hasBounds) … … 210 210 if (context->intraCommSize_ > 1) 211 211 { 212 this->writeLocalAttributes(domain->ibegin ,213 domain->ni ,214 domain->jbegin ,215 domain->nj ,212 this->writeLocalAttributes(domain->ibeginValue_, 213 domain->niValue_, 214 domain->jbeginValue_, 215 domain->njValue_, 216 216 appendDomid); 217 217 218 218 if (singleDomain) 219 219 this->writeLocalAttributes_IOIPSL(dimXid, dimYid, 220 domain->ibegin ,221 domain->ni ,222 domain->jbegin ,223 domain->nj ,220 domain->ibeginValue_, 221 domain->niValue_, 222 domain->jbeginValue_, 223 domain->njValue_, 224 224 domain->ni_glo,domain->nj_glo, 225 225 context->intraCommRank_,context->intraCommSize_); … … 373 373 std::vector<StdSize> start(2) ; 374 374 std::vector<StdSize> count(2) ; 375 start[1]=domain->ibegin ;376 start[0]=domain->jbegin ;377 count[1]=domain->ni ; count[0]=domain->nj;375 start[1]=domain->ibeginValue_; 376 start[0]=domain->jbeginValue_; 377 count[1]=domain->niValue_ ; count[0]=domain->njValue_ ; 378 378 379 379 if (domain->hasLonLat) … … 391 391 std::vector<StdSize> count(1) ; 392 392 393 start[0]=domain->jbegin ;394 count[0]=domain->nj ;393 start[0]=domain->jbeginValue_; 394 count[0]=domain->njValue_; 395 395 CArray<double,1> lat; 396 lat.resize( domain->nj .getValue());397 for (int j=0;j<domain->nj .getValue();j++) lat(j) = domain->latvalue(j*domain->ni.getValue());396 lat.resize( domain->njValue_); 397 for (int j=0;j<domain->njValue_;j++) lat(j) = domain->latvalue(j*domain->niValue_); 398 398 SuperClassWriter::writeData(CArray<double,1>(lat.copy()), latid, isCollective, 0,&start,&count); 399 399 400 start[0]=domain->ibegin ;401 count[0]=domain->ni ;402 CArray<double,1> lon = domain->lonvalue(Range(0,domain->ni -1));400 start[0]=domain->ibeginValue_; 401 count[0]=domain->niValue_; 402 CArray<double,1> lon = domain->lonvalue(Range(0,domain->niValue_-1)); 403 403 SuperClassWriter::writeData(CArray<double,1>(lon.copy()), lonid, isCollective, 0,&start,&count); 404 404 } … … 419 419 { 420 420 start[2] = 0; 421 start[1] = domain->ibegin ;422 start[0] = domain->jbegin ;421 start[1] = domain->ibeginValue_; 422 start[0] = domain->jbeginValue_; 423 423 count[2] = domain->nvertex; 424 count[1] = domain->ni ;425 count[0] = domain->nj ;424 count[1] = domain->niValue_; 425 count[0] = domain->njValue_; 426 426 } 427 427 … … 435 435 std::vector<StdSize> count(2); 436 436 437 start[1] = domain->ibegin ;438 start[0] = domain->jbegin ;439 count[1] = domain->ni ;440 count[0] = domain->nj ;437 start[1] = domain->ibeginValue_; 438 start[0] = domain->jbeginValue_; 439 count[1] = domain->niValue_; 440 count[0] = domain->njValue_; 441 441 442 442 SuperClassWriter::writeData(domain->areavalue, areaId, isCollective, 0, &start, &count); … … 703 703 else 704 704 { 705 startNodes[0] = domain->ibegin ;706 countNodes[0] = domain->ni ;705 startNodes[0] = domain->ibeginValue_; 706 countNodes[0] = domain->niValue_ ; 707 707 } 708 708 … … 726 726 else 727 727 { 728 startEdges[0] = domain->ibegin ;729 countEdges[0] = domain->ni ;728 startEdges[0] = domain->ibeginValue_; 729 countEdges[0] = domain->niValue_; 730 730 startNodes[0] = domain->mesh->node_start; 731 731 countNodes[0] = domain->mesh->node_count; 732 732 if (countNodes[0]==0) startNodes[0]=0 ; // for netcdf error 733 startEdgeNodes[0] = domain->ibegin ;733 startEdgeNodes[0] = domain->ibeginValue_; 734 734 startEdgeNodes[1] = 0; 735 countEdgeNodes[0] = domain->ni ;735 countEdgeNodes[0] = domain->niValue_; 736 736 countEdgeNodes[1] = 2; 737 737 } … … 763 763 else 764 764 { 765 startFaces[0] = domain->ibegin ;766 countFaces[0] = domain->ni ;765 startFaces[0] = domain->ibeginValue_; 766 countFaces[0] = domain->niValue_ ; 767 767 startNodes[0] = domain->mesh->node_start; 768 768 countNodes[0] = domain->mesh->node_count; … … 785 785 countEdgeFaces[1]= 2; 786 786 787 startFaceConctv[0] = domain->ibegin ;788 countFaceConctv[0] = domain->ni ;787 startFaceConctv[0] = domain->ibeginValue_; 788 countFaceConctv[0] = domain->niValue_; 789 789 startFaceConctv[1] = 0; 790 790 countFaceConctv[1] = domain->nvertex; … … 998 998 else 999 999 { 1000 start[0]=domain->ibegin ;1001 count[0]=domain->ni ;1002 startBounds[0]=domain->ibegin ;1000 start[0]=domain->ibeginValue_; 1001 count[0]=domain->niValue_; 1002 startBounds[0]=domain->ibeginValue_; 1003 1003 startBounds[1]=0 ; 1004 countBounds[0]=domain->ni ;1004 countBounds[0]=domain->niValue_; 1005 1005 countBounds[1]=nvertex ; 1006 1006 } … … 1110 1110 if (!axis->label.isEmpty() && !SuperClassWriter::dimExist(strId)) SuperClassWriter::addDimension(strId, stringArrayLen); 1111 1111 1112 if (axis->hasValue || !axis->label.isEmpty())1112 if (axis->hasValue() || !axis->label.isEmpty()) 1113 1113 { 1114 1114 if (!axis->label.isEmpty()) dims.push_back(strId); … … 1499 1499 } 1500 1500 1501 firstGlobalIndex = domain->ibegin + domain->jbegin* domain->ni_glo;1501 firstGlobalIndex = domain->ibeginValue_ + domain->jbeginValue_ * domain->ni_glo; 1502 1502 1503 1503 domain->addRelFileCompressed(this->filename); … … 2323 2323 if ((domain->type) != CDomain::type_attr::unstructured) 2324 2324 { 2325 start.push_back(domain->jbegin );2326 count.push_back(domain->nj );2325 start.push_back(domain->jbeginValue_); 2326 count.push_back(domain->njValue_); 2327 2327 } 2328 2328 --idx; 2329 start.push_back(domain->ibegin );2330 count.push_back(domain->ni );2329 start.push_back(domain->ibeginValue_); 2330 count.push_back(domain->niValue_); 2331 2331 --idx; 2332 2332 } … … 2383 2383 if ((domain->type) != CDomain::type_attr::unstructured) 2384 2384 { 2385 start.push_back(domain->jbegin );2386 count.push_back(domain->nj );2385 start.push_back(domain->jbeginValue_); 2386 count.push_back(domain->njValue_); 2387 2387 } 2388 2388 --idx ; 2389 2389 2390 start.push_back(domain->ibegin );2391 count.push_back(domain->ni );2390 start.push_back(domain->ibeginValue_); 2391 count.push_back(domain->niValue_); 2392 2392 --idx ; 2393 2393 --idxDomain; -
XIOS3/trunk/src/manager/services_manager.cpp
r2498 r2507 227 227 int leader ; 228 228 229 services_.clear() ;230 229 int nbServices ; 231 230 buffer>>nbServices ; 231 bool newServices = nbServices != services_.size() ; 232 233 services_.clear() ; 232 234 233 235 for(int i=0;i<nbServices;i++) … … 235 237 buffer>>poolId>>serviceId>>partitionId>>type>>size>>nbPartitions>>leader ; 236 238 services_[std::tuple<std::string,std::string,int>(poolId,serviceId,partitionId)]=std::make_tuple(type,size,nbPartitions,leader) ; 239 if (newServices) 240 info(40)<<"Receive new services informations : "<<poolId<<"::"<<serviceId<<"::"<<partitionId<<" => type : "<<type<<" size : "<<size<<" nbPartitions : "<<nbPartitions<<" leader : "<<leader<<endl ; 237 241 } 238 242 } … … 256 260 int& size, int& nbPartitions, int& leader, bool wait) 257 261 { 258 259 262 winServices_->lockWindowShared(managerGlobalLeader_) ; 260 263 winServices_->updateFromLockedWindow(managerGlobalLeader_, this, &CServicesManager::servicesDumpIn) ; 261 264 winServices_->unlockWindow(managerGlobalLeader_) ; 262 265 266 if (wait) waitServiceRegistration(poolId, serviceId, partitionId) ; 263 267 auto it=services_.find(std::tuple<std::string,std::string,int>(poolId,serviceId,partitionId)) ; 264 if ( it == services_.end() && !wait) return false ;268 if ( it == services_.end()) return false ; 265 269 else 266 270 { 267 if (wait) waitServiceRegistration(poolId, serviceId, partitionId) ;268 271 type= std::get<0>(it->second); 269 272 size= std::get<1>(it->second); … … 279 282 int size ; 280 283 int nbPartitions; 281 //return getServiceInfo(poolId, serviceId, partitionId, type, size, nbPartitions, leader, wait) ; 282 return getServiceInfo(poolId, serviceId, partitionId, type, size, nbPartitions, leader) ; 284 return getServiceInfo(poolId, serviceId, partitionId, type, size, nbPartitions, leader, wait) ; 283 285 } 284 286 … … 288 290 int nbPartitions; 289 291 int leader; 290 //return getServiceInfo(poolId, serviceId, partitionId, type, size, nbPartitions, leader, wait) ; 291 return getServiceInfo(poolId, serviceId, partitionId, type, size, nbPartitions, leader) ; 292 return getServiceInfo(poolId, serviceId, partitionId, type, size, nbPartitions, leader, wait) ; 292 293 } 293 294 … … 297 298 int type; 298 299 int leader; 299 //return getServiceInfo(poolId, serviceId, partitionId, type, size, nbPartitions, leader, wait) ; 300 return getServiceInfo(poolId, serviceId, partitionId, type, size, nbPartitions, leader) ; 300 return getServiceInfo(poolId, serviceId, partitionId, type, size, nbPartitions, leader, wait) ; 301 301 } 302 302 303 303 bool CServicesManager::hasService(const std::string& poolId, const std::string& serviceId, const int& partitionId) 304 304 { 305 winServices_->lockWindow (managerGlobalLeader_,0) ;306 winServices_->updateFrom Window(managerGlobalLeader_, this, &CServicesManager::servicesDumpIn) ;307 winServices_->unlockWindow(managerGlobalLeader_ ,0) ;305 winServices_->lockWindowShared(managerGlobalLeader_) ; 306 winServices_->updateFromLockedWindow(managerGlobalLeader_, this, &CServicesManager::servicesDumpIn) ; 307 winServices_->unlockWindow(managerGlobalLeader_) ; 308 308 auto it=services_.find(std::tuple<std::string, std::string, int>(poolId, serviceId, partitionId)) ; 309 309 if ( it == services_.end()) return false ; -
XIOS3/trunk/src/mpi_tools.cpp
r2118 r2507 28 28 29 29 template<> 30 MPI_Datatype MPI_GetType<bool>(void) { return MPI_CXX_BOOL ;} 31 32 template<> 30 33 MPI_Datatype MPI_GetType<char>(void) { return MPI_CHAR ;} 31 34 -
XIOS3/trunk/src/node/axis.cpp
r2397 r2507 24 24 : CObjectTemplate<CAxis>() 25 25 , CAxisAttributes(), isChecked(false), relFiles() 26 , hasBounds (false), isCompressible_(false)27 , transformationMap_() , hasValue(false), hasLabel(false)26 , hasBounds_(false), isCompressible_(false) 27 , transformationMap_() 28 28 , clients() 29 29 { … … 33 33 : CObjectTemplate<CAxis>(id) 34 34 , CAxisAttributes(), isChecked(false), relFiles() 35 , hasBounds (false), isCompressible_(false)36 , transformationMap_() , hasValue(false), hasLabel(false)35 , hasBounds_(false), isCompressible_(false) 36 , transformationMap_() 37 37 , clients() 38 38 { … … 56 56 m["temporal_splitting"] = TRANS_TEMPORAL_SPLITTING; 57 57 m["duplicate_scalar"] = TRANS_DUPLICATE_SCALAR_TO_AXIS; 58 m["redistribute_axis"] = TRANS_REDISTRIBUTE_AXIS; 59 58 60 return true; 59 61 } … … 165 167 size += CArray<bool,1>::size(n_glo); 166 168 size += CArray<double,1>::size(n_glo); 167 if (hasBounds )169 if (hasBounds_) 168 170 size += CArray<double,2>::size(2*n_glo); 169 if (hasLabel )171 if (hasLabel_) 170 172 size += CArray<StdString,1>::size(n_glo); 171 173 } … … 198 200 size += CArray<bool,1>::size(it->second.size()); 199 201 size += CArray<double,1>::size(it->second.size()); 200 if (hasBounds )202 if (hasBounds_) 201 203 size += CArray<double,2>::size(2 * it->second.size()); 202 if (hasLabel )204 if (hasLabel_) 203 205 size += CArray<StdString,1>::size(it->second.size()); 204 206 … … 457 459 << ") than the one defined by the \'size\' attribute (" << n.getValue() << ").") 458 460 else return false ; 459 this->hasValue = true;461 this->hasValue_ = true; 460 462 } 461 463 … … 567 569 << "Bounds size is "<< bounds.extent(0) << " x " << bounds.extent(1) << ".") 568 570 else return false ; 569 hasBounds = true;570 } 571 else hasBounds = false;571 hasBounds_ = true; 572 } 573 else hasBounds_ = false; 572 574 return true ; 573 575 } … … 585 587 << "label size is "<< label.extent(0)<< " .") 586 588 else return false ; 587 hasLabel = true;588 } 589 else hasLabel = false;589 hasLabel_ = true; 590 } 591 else hasLabel_ = false; 590 592 return true ; 591 593 } … … 1163 1165 CContext* context = CContext::getCurrent(); 1164 1166 1165 if (hasValue )1167 if (hasValue_) 1166 1168 { 1167 1169 { // send level value … … 1173 1175 } 1174 1176 1175 if (hasBounds )1177 if (hasBounds_) 1176 1178 { 1177 1179 { // send bounds level value … … 1183 1185 } 1184 1186 1185 if (hasLabel )1187 if (hasLabel_) 1186 1188 { 1187 1189 { // send label -
XIOS3/trunk/src/node/axis.hpp
r2397 r2507 175 175 bool isEqual(CAxis* axis); 176 176 177 public: 178 bool hasValue; 179 bool hasBounds; 180 bool hasLabel; 177 private: 178 bool hasValue_= false; 179 bool hasBounds_= false; 180 bool hasLabel_= false; 181 public: 182 bool hasValue(void) { return hasValue_ ;} 183 bool hasBounds(void) { return hasBounds_ ;} 184 bool hasLabel(void) { return hasLabel_ ;} 181 185 182 186 private: -
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 -
XIOS3/trunk/src/node/context.hpp
r2458 r2507 141 141 void initReadFiles(void); 142 142 void prepareTimeseries(void); 143 void postProcessFilterGraph();144 143 void startPrefetchingOfEnabledReadModeFiles(); 145 void doPreTimestepOperationsForEnabledReadModeFiles();146 144 void doPostTimestepOperationsForEnabledReadModeFiles(); 147 145 void findFieldsWithReadAccess(void); … … 298 296 // Determine context on server or not 299 297 bool hasServer; 300 298 public: 299 void registerFileToWrite(CFile* file) { filesToWrite_.insert(file); } // Add a file that need to be write for example to create headers 300 private: 301 std::set<CFile*> filesToWrite_ ; 301 302 302 303 private: 304 CContextClient* onlineContextClient_=nullptr ; 305 303 306 std::string defaultPoolWriterId_ ; 304 307 std::string defaultPoolReaderId_ ; -
XIOS3/trunk/src/node/domain.cpp
r2424 r2507 293 293 \param [in] nbLocalDomain number of local domain on the domain destination 294 294 */ 295 295 296 void CDomain::redistribute(int nbLocalDomain) 296 297 TRY … … 862 863 863 864 864 if (!area.isEmpty()) area.transposeSelf(1, 0); // => to be checked why is it transposed865 // if (!area.isEmpty()) area.transposeSelf(1, 0); // => to be checked why is it transposed 865 866 } 866 867 … … 914 915 CATCH_DUMP_ATTR 915 916 917 void CDomain::compute2dBox(void) 918 { 919 if (i_index.numElements()==0) 920 { 921 ibeginValue_= 0 ; 922 jbeginValue_= 0 ; 923 niValue_= 0 ; 924 njValue_= 0 ; 925 } 926 else 927 { 928 int maxI=0 ; 929 int maxJ=0 ; 930 int minI=nj_glo*ni_glo ; 931 int minJ=nj_glo*ni_glo ; 932 int i,j,k,ij ; 933 for(int k=0; k<i_index.numElements(); k++) 934 { 935 ij=j_index(k)*ni_glo + i_index(k) ; 936 i=ij%ni_glo ; 937 j=ij/ni_glo ; 938 if (i<minI) minI=i; 939 if (j<minJ) minJ=j; 940 if (i>maxI) maxI=i; 941 if (j>maxJ) maxJ=j; 942 } 943 ibeginValue_=minI ; 944 jbeginValue_=minJ ; 945 niValue_=maxI-minI+1 ; 946 njValue_=maxJ-minJ+1 ; 947 } 948 } 949 916 950 size_t CDomain::getGlobalWrittenSize(void) 917 951 { … … 943 977 { 944 978 // No information about ni 945 int minIndex = ni_glo - 1;979 int minIndex = ni_glo*nj_glo - 1; 946 980 int maxIndex = 0; 947 981 for (int idx = 0; idx < i_index.numElements(); ++idx) … … 950 984 if (i_index(idx) > maxIndex) maxIndex = i_index(idx); 951 985 } 952 if (i_index.numElements()) { 986 if (i_index.numElements()) 987 { 953 988 ni = maxIndex - minIndex + 1; 954 989 minIIndex = minIndex; 955 990 } 956 else { 957 ni = 0; 958 } 959 } 991 else ni = 0; 992 } 960 993 961 994 // It's not so correct but if ibegin is not the first value of i_index … … 1010 1043 { 1011 1044 // No information about nj 1012 int minIndex = n j_glo - 1;1045 int minIndex = ni_glo*nj_glo - 1; 1013 1046 int maxIndex = 0; 1014 1047 for (int idx = 0; idx < j_index.numElements(); ++idx) … … 1354 1387 } 1355 1388 else if (!lonvalue_1d.isEmpty() && !lonlatValueExisted) 1389 { 1390 if (type_attr::rectilinear == type) 1391 { 1392 if (ni == lonvalue_1d.numElements() && nj == latvalue_1d.numElements()) 1393 { 1394 lonvalue.resize(ni * nj); 1395 latvalue.resize(ni * nj); 1396 if (hasBounds) 1397 { 1398 bounds_lonvalue.resize(nvertex, ni * nj); 1399 bounds_latvalue.resize(nvertex, ni * nj); 1400 } 1401 1402 for (int j = 0; j < nj; ++j) 1403 { 1404 for (int i = 0; i < ni; ++i) 1405 { 1406 int k = j * ni + i; 1407 1408 lonvalue(k) = lonvalue_1d(i); 1409 latvalue(k) = latvalue_1d(j); 1410 1411 if (hasBounds) 1412 { 1413 for (int n = 0; n < nvertex; ++n) 1414 { 1415 bounds_lonvalue(n,k) = bounds_lon_1d(n,i); 1416 bounds_latvalue(n,k) = bounds_lat_1d(n,j); 1417 } 1418 } 1419 } 1420 } 1421 } 1422 else if (i_index.numElements() == lonvalue_1d.numElements() && j_index.numElements() == latvalue_1d.numElements() && !lonlatValueExisted) 1423 { 1424 lonvalue.reference(lonvalue_1d.copy()); 1425 latvalue.reference(latvalue_1d.copy()); 1426 if (hasBounds) 1427 { 1428 bounds_lonvalue.reference(bounds_lon_1d.copy()); 1429 bounds_latvalue.reference(bounds_lat_1d.copy()); 1430 } 1431 } 1432 else 1433 ERROR("CDomain::completeLonClient(void)", 1434 << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " 1435 << "'lonvalue_1d' and 'latvalue_1d' does not have the same size as the local domain." << std::endl 1436 << "'lonvalue_1d' size is " << lonvalue_1d.numElements() 1437 << " and 'latvalue_1d' size is " << latvalue_1d.numElements() << std::endl 1438 << " They should be correspondingly " << ni.getValue() << " and " << nj.getValue() << " or " << std::endl 1439 << i_index.numElements() << " and " << j_index.numElements() << "."); 1440 } 1441 else if (type == type_attr::curvilinear || type == type_attr::unstructured && !lonlatValueExisted) 1442 { 1443 lonvalue.reference(lonvalue_1d.copy()); 1444 latvalue.reference(latvalue_1d.copy()); 1445 if (hasBounds) 1446 { 1447 bounds_lonvalue.reference(bounds_lon_1d.copy()); 1448 bounds_latvalue.reference(bounds_lat_1d.copy()); 1449 } 1450 } 1451 } 1452 1453 if (!area_2d.isEmpty() && areavalue.isEmpty()) 1454 { 1455 areavalue.resize(ni*nj); 1456 for (int j = 0; j < nj; ++j) 1457 { 1458 for (int i = 0; i < ni; ++i) 1459 { 1460 int k = j * ni + i; 1461 areavalue(k) = area_2d(i,j); 1462 } 1463 } 1464 } 1465 else if (!area_1d.isEmpty() && areavalue.isEmpty()) areavalue.reference(area_1d.copy()); 1466 1467 } 1468 CATCH_DUMP_ATTR 1469 1470 /* 1471 Convert internal longitude latitude value used by XIOS to "lonvalue_*" which can be retrieved with Fortran interface 1472 */ 1473 void CDomain::convertLonLatValue(void) 1474 TRY 1475 { 1476 bool lonlatValueExisted = (0 != lonvalue.numElements()) || (0 != latvalue.numElements()); 1477 if (!lonvalue_2d.isEmpty() && lonlatValueExisted) 1478 { 1479 lonvalue_2d.resize(ni,nj); 1480 latvalue_2d.resize(ni,nj); 1481 if (hasBounds) 1482 { 1483 bounds_lon_2d.resize(nvertex, ni, nj); 1484 bounds_lat_2d.resize(nvertex, ni, nj); 1485 } 1486 1487 for (int j = 0; j < nj; ++j) 1488 { 1489 for (int i = 0; i < ni; ++i) 1490 { 1491 int k = j * ni + i; 1492 1493 lonvalue_2d(i,j) = lonvalue(k); 1494 latvalue_2d(i,j) = latvalue(k); 1495 1496 if (hasBounds) 1497 { 1498 for (int n = 0; n < nvertex; ++n) 1499 { 1500 bounds_lon_2d(n,i,j) = bounds_lonvalue(n,k); 1501 bounds_lat_2d(n,i,j) = bounds_latvalue(n,k); 1502 } 1503 } 1504 } 1505 } 1506 } 1507 else if (!lonvalue_1d.isEmpty() && lonlatValueExisted) 1356 1508 { 1357 1509 if (type_attr::rectilinear == type) … … 1417 1569 } 1418 1570 } 1419 1420 if (!area.isEmpty() && areavalue.isEmpty())1421 {1422 areavalue.resize(ni*nj);1423 for (int j = 0; j < nj; ++j)1424 {1425 for (int i = 0; i < ni; ++i)1426 {1427 int k = j * ni + i;1428 areavalue(k) = area(i,j);1429 }1430 }1431 }1432 }1433 CATCH_DUMP_ATTR1434 1435 /*1436 Convert internal longitude latitude value used by XIOS to "lonvalue_*" which can be retrieved with Fortran interface1437 */1438 void CDomain::convertLonLatValue(void)1439 TRY1440 {1441 bool lonlatValueExisted = (0 != lonvalue.numElements()) || (0 != latvalue.numElements());1442 if (!lonvalue_2d.isEmpty() && lonlatValueExisted)1443 {1444 lonvalue_2d.resize(ni,nj);1445 latvalue_2d.resize(ni,nj);1446 if (hasBounds)1447 {1448 bounds_lon_2d.resize(nvertex, ni, nj);1449 bounds_lat_2d.resize(nvertex, ni, nj);1450 }1451 1452 for (int j = 0; j < nj; ++j)1453 {1454 for (int i = 0; i < ni; ++i)1455 {1456 int k = j * ni + i;1457 1458 lonvalue_2d(i,j) = lonvalue(k);1459 latvalue_2d(i,j) = latvalue(k);1460 1461 if (hasBounds)1462 {1463 for (int n = 0; n < nvertex; ++n)1464 {1465 bounds_lon_2d(n,i,j) = bounds_lonvalue(n,k);1466 bounds_lat_2d(n,i,j) = bounds_latvalue(n,k);1467 }1468 }1469 }1470 }1471 }1472 else if (!lonvalue_1d.isEmpty() && lonlatValueExisted)1473 {1474 if (type_attr::rectilinear == type)1475 {1476 if (ni == lonvalue_1d.numElements() && nj == latvalue_1d.numElements())1477 {1478 lonvalue.resize(ni * nj);1479 latvalue.resize(ni * nj);1480 if (hasBounds)1481 {1482 bounds_lonvalue.resize(nvertex, ni * nj);1483 bounds_latvalue.resize(nvertex, ni * nj);1484 }1485 1486 for (int j = 0; j < nj; ++j)1487 {1488 for (int i = 0; i < ni; ++i)1489 {1490 int k = j * ni + i;1491 1492 lonvalue(k) = lonvalue_1d(i);1493 latvalue(k) = latvalue_1d(j);1494 1495 if (hasBounds)1496 {1497 for (int n = 0; n < nvertex; ++n)1498 {1499 bounds_lonvalue(n,k) = bounds_lon_1d(n,i);1500 bounds_latvalue(n,k) = bounds_lat_1d(n,j);1501 }1502 }1503 }1504 }1505 }1506 else if (i_index.numElements() == lonvalue_1d.numElements() && j_index.numElements() == latvalue_1d.numElements() && !lonlatValueExisted)1507 {1508 lonvalue.reference(lonvalue_1d);1509 latvalue.reference(latvalue_1d);1510 if (hasBounds)1511 {1512 bounds_lonvalue.reference(bounds_lon_1d);1513 bounds_latvalue.reference(bounds_lat_1d);1514 }1515 }1516 else1517 ERROR("CDomain::completeLonClient(void)",1518 << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] "1519 << "'lonvalue_1d' and 'latvalue_1d' does not have the same size as the local domain." << std::endl1520 << "'lonvalue_1d' size is " << lonvalue_1d.numElements()1521 << " and 'latvalue_1d' size is " << latvalue_1d.numElements() << std::endl1522 << " They should be correspondingly " << ni.getValue() << " and " << nj.getValue() << " or " << std::endl1523 << i_index.numElements() << " and " << j_index.numElements() << ".");1524 }1525 else if (type == type_attr::curvilinear || type == type_attr::unstructured && !lonlatValueExisted)1526 {1527 lonvalue.reference(lonvalue_1d);1528 latvalue.reference(latvalue_1d);1529 if (hasBounds)1530 {1531 bounds_lonvalue.reference(bounds_lon_1d);1532 bounds_latvalue.reference(bounds_lat_1d);1533 }1534 }1535 }1536 1571 } 1537 1572 CATCH_DUMP_ATTR … … 1636 1671 { 1637 1672 bool hasAreaValue = (!areavalue.isEmpty() && 0 != areavalue.numElements()); 1638 hasArea = !area .isEmpty();1673 hasArea = !area_1d.isEmpty() || !area_2d.isEmpty(); 1639 1674 if (hasArea && !hasAreaValue) 1640 1675 { 1641 if ( area.extent(0) != ni || area.extent(1) != nj)1676 if (!area_2d.isEmpty() && (area_2d.extent(0) != ni || area_2d.extent(1) != nj)) 1642 1677 { 1643 1678 ERROR("CDomain::checkArea(void)", … … 1645 1680 << "The area does not have the same size as the local domain." << std::endl 1646 1681 << "Local size is " << ni.getValue() << " x " << nj.getValue() << "." << std::endl 1647 << "Area size is " << area.extent(0) << " x " << area.extent(1) << "."); 1648 } 1649 // if (areavalue.isEmpty()) 1650 // { 1651 // areavalue.resize(ni*nj); 1652 // for (int j = 0; j < nj; ++j) 1653 // { 1654 // for (int i = 0; i < ni; ++i) 1655 // { 1656 // int k = j * ni + i; 1657 // areavalue(k) = area(i,j); 1658 // } 1659 // } 1660 // } 1682 << "Area size is " << area_2d.extent(0) << " x " << area_2d.extent(1) << "."); 1683 } 1684 1685 if (!area_1d.isEmpty() && area_1d.extent(0) != ni*nj) 1686 { 1687 ERROR("CDomain::checkArea(void)", 1688 << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " 1689 << "The area does not have the same size as the local domain." << std::endl 1690 << "Local size is " << ni.getValue() << " x " << nj.getValue() << "." << std::endl 1691 << "Area size is " << area_1d.extent(0) << " but must be ni*nj=" << ni*nj << " ."); 1692 } 1693 1661 1694 } 1662 1695 } … … 1731 1764 if (this->checkAttributes_done_) return; 1732 1765 this->checkDomain(); 1766 this->compute2dBox() ; 1733 1767 this->checkLonLat(); 1734 1768 this->checkBounds(); … … 1803 1837 excludedAttr.insert(excludedAttr.end(), { "mask_1d", "mask_2d" }); // ??? 1804 1838 excludedAttr.insert(excludedAttr.end(), { "bounds_lon_1d", "bounds_lat_1d", "bounds_lon_2d", "bounds_lat_2d" }); 1805 excludedAttr.insert(excludedAttr.end(), { "area " });1839 excludedAttr.insert(excludedAttr.end(), { "area_1d", "area_2d" }); 1806 1840 // private 1807 1841 excludedAttr.insert(excludedAttr.end(), { "lon_start", "lon_end", "lat_start", "lat_end" }); … … 1952 1986 CContext* context = CContext::getCurrent(); 1953 1987 map<int, CArray<size_t,1>> globalIndex ; 1954 /* old method 1955 if (type==EDistributionType::BANDS) // Bands distribution to send to file server 1956 { 1957 int nbServer = client->getRemoteSize(); 1958 std::vector<int> nGlobDomain(2); 1959 nGlobDomain[0] = this->ni_glo; 1960 nGlobDomain[1] = this->nj_glo; 1961 1962 // to be changed in future, need to rewrite more simply domain distribution 1963 CServerDistributionDescription serverDescription(nGlobDomain, nbServer); 1964 int distributedPosition ; 1965 if (isUnstructed_) distributedPosition = 0 ; 1966 else distributedPosition = 1 ; 1967 1968 std::vector<std::vector<int> > serverIndexBegin = serverDescription.getServerIndexBegin(); 1969 std::vector<std::vector<int> > serverDimensionSizes = serverDescription.getServerDimensionSizes(); 1970 vector<unordered_map<size_t,vector<int>>> indexServerOnElement ; 1971 CArray<int,1> axisDomainOrder(1) ; axisDomainOrder(0)=2 ; 1972 auto zeroIndex=serverDescription.computeServerGlobalByElement(indexServerOnElement, context->getIntraCommRank(), context->getIntraCommSize(), 1973 axisDomainOrder,distributedPosition) ; 1974 // distribution is very bad => to redo 1975 // convert indexServerOnElement => map<int,CArray<size_t,1>> - need to be changed later 1976 map<int, vector<size_t>> vectGlobalIndex ; 1977 for(auto& indexRanks : indexServerOnElement[0]) 1978 { 1979 size_t index=indexRanks.first ; 1980 auto& ranks=indexRanks.second ; 1981 for(int rank : ranks) vectGlobalIndex[rank].push_back(index) ; 1982 } 1983 for(auto& vect : vectGlobalIndex ) globalIndex.emplace(vect.first, CArray<size_t,1>(vect.second.data(), shape(vect.second.size()),duplicateData)) ; 1984 // some servers receves no index (zeroIndex array) => root process take them into account. 1985 if (context->getIntraCommRank()==0) 1986 for(auto& rank : zeroIndex) globalIndex[rank] = CArray<size_t,1>() ; 1987 } 1988 */ 1988 1989 1989 if (distType==EDistributionType::BANDS && isUnstructed_) distType=EDistributionType::COLUMNS ; 1990 1990 … … 2134 2134 CATCH 2135 2135 2136 2137 2138 2136 void CDomain::distributeToServer(CContextClient* client, bool inOut, map<int, CArray<size_t,1>>& globalIndexOut, std::map<int, CArray<size_t,1>>& globalIndexIn, 2139 2137 shared_ptr<CScattererConnector> &scattererConnector, const string& domainId) … … 2409 2407 CArray<double,1> value ; 2410 2408 gathererConnector_->transfer(event, value, 0.); 2411 area .resize(ni,nj) ;2412 if (area .numElements()>0) area=CArray<double,2>(value.dataFirst(),shape(ni,nj),neverDeleteData) ;2409 area_2d.resize(ni,nj) ; 2410 if (area_2d.numElements()>0) area_2d=CArray<double,2>(value.dataFirst(),shape(ni,nj),neverDeleteData) ; 2413 2411 } 2414 2412 } … … 2491 2489 m["reorder_domain"] = TRANS_REORDER_DOMAIN; 2492 2490 m["extract_domain"] = TRANS_EXTRACT_DOMAIN; 2491 m["redistribute_domain"] = TRANS_REDISTRIBUTE_DOMAIN; 2493 2492 return true; 2494 2493 } -
XIOS3/trunk/src/node/domain.hpp
r2397 r2507 214 214 CArray<double, 2> bounds_lonvalue, bounds_latvalue; 215 215 CArray<double, 1> areavalue; 216 int niValue_ ; 217 int njValue_ ; 218 int ibeginValue_ ; 219 int jbeginValue_ ; 216 220 217 221 … … 241 245 void checkArea(void); 242 246 void checkLonLat(); 247 void compute2dBox(void) ; 243 248 244 249 public: -
XIOS3/trunk/src/node/field.cpp
r2433 r2507 20 20 #include "temporal_filter.hpp" 21 21 #include "server_from_client_source_filter.hpp" 22 #include "client_online_reader_filter.hpp" 22 23 #include "file_reader_source_filter.hpp" 24 #include "grid_redistribute_filter.hpp" 23 25 #include "tracer.hpp" 24 26 #include "graph_package.hpp" … … 205 207 TRY 206 208 { 207 return clientFromServerSourceFilter_->sendReadDataRequest(tsDataRequested) ; 209 if (clientFromServerSourceFilter_) return clientFromServerSourceFilter_->sendReadDataRequest(tsDataRequested) ; 210 else if (clientOnlineReaderFilter_) return clientOnlineReaderFilter_->sendReadDataRequest(tsDataRequested) ; 211 else ERROR("bool CField::sendReadDataRequest(const CDate& tsDataRequested)", << "uninitialized source filter"); 208 212 } 209 213 CATCH_DUMP_ATTR … … 217 221 TRY 218 222 { 219 return clientFromServerSourceFilter_->sendReadDataRequestIfNeeded() ; 223 if (clientFromServerSourceFilter_) return clientFromServerSourceFilter_->sendReadDataRequestIfNeeded() ; 224 else if (clientOnlineReaderFilter_) return clientOnlineReaderFilter_->sendReadDataRequestIfNeeded() ; 225 else ERROR("bool CField::sendReadDataRequestIfNeeded(void)", << "uninitialized source filter"); 220 226 } 221 227 CATCH_DUMP_ATTR … … 304 310 TRY 305 311 { 306 clientFromServerSourceFilter_->checkForLateData() ; 312 if (clientFromServerSourceFilter_) return clientFromServerSourceFilter_->checkForLateData() ; 313 else if (clientOnlineReaderFilter_) return clientOnlineReaderFilter_->checkForLateData() ; 314 else ERROR("void CField::checkForLateDataFromServer(void)", << "uninitialized source filter"); 307 315 } 308 316 CATCH_DUMP_ATTR … … 315 323 { 316 324 checkForLateDataFromServer() ; 317 clientFromServerSourceFilter_->trigger(CContext::getCurrent()->getCalendar()->getCurrentDate()) ; 325 if (clientFromServerSourceFilter_) clientFromServerSourceFilter_->trigger(CContext::getCurrent()->getCalendar()->getCurrentDate()) ; 326 else if (clientOnlineReaderFilter_) clientOnlineReaderFilter_->trigger(CContext::getCurrent()->getCalendar()->getCurrentDate()) ; 318 327 } 319 328 else if (hasCouplerIn()) … … 325 334 CATCH_DUMP_ATTR 326 335 327 328 void CField::checkIfMustAutoTrigger(void) 329 TRY 330 { 331 mustAutoTrigger = clientFromServerSourceFilter_ ? clientFromServerSourceFilter_->mustAutoTrigger() : false; 332 } 333 CATCH_DUMP_ATTR 334 335 void CField::autoTriggerIfNeeded(void) 336 TRY 337 { 338 if (mustAutoTrigger) 339 clientFromServerSourceFilter_->trigger(CContext::getCurrent()->getCalendar()->getCurrentDate()); 340 } 341 CATCH_DUMP_ATTR 342 336 343 337 344 338 //---------------------------------------------------------------- … … 506 500 bool bufferForWriting) 507 501 { 508 auto& contextBufferSize = bufferSize[client ] ;509 auto& contextMaxEventSize = maxEventSize[client ] ;510 const std::map<int, size_t> mapSize = grid_->getDataBufferSize(client , getId(), bufferForWriting);502 auto& contextBufferSize = bufferSize[client_] ; 503 auto& contextMaxEventSize = maxEventSize[client_] ; 504 const std::map<int, size_t> mapSize = grid_->getDataBufferSize(client_, getId(), bufferForWriting); 511 505 for(auto& it : mapSize ) 512 506 { … … 525 519 bool bufferForWriting) 526 520 { 527 auto& contextBufferSize = bufferSize[client ] ;528 auto& contextMaxEventSize = maxEventSize[client ] ;529 const std::map<int, size_t> mapSize = grid_->getAttributesBufferSize(client , bufferForWriting);521 auto& contextBufferSize = bufferSize[client_] ; 522 auto& contextMaxEventSize = maxEventSize[client_] ; 523 const std::map<int, size_t> mapSize = grid_->getAttributesBufferSize(client_, bufferForWriting); 530 524 for(auto& it : mapSize ) 531 525 { … … 797 791 { 798 792 // insert temporal filter before sending to files 799 clientToServerStoreFilter_ = std::shared_ptr<CClientToServerStoreFilter>(new CClientToServerStoreFilter(gc, this, client ));793 clientToServerStoreFilter_ = std::shared_ptr<CClientToServerStoreFilter>(new CClientToServerStoreFilter(gc, this, client_)); 800 794 // insert temporal filter before sending to files 801 795 getTemporalDataFilter(gc, fileOut_->output_freq)->connectOutput(clientToServerStoreFilter_, 0); … … 809 803 } 810 804 805 /* 806 void CField::connectToOnlineWriter(CGarbageCollector& gc) 807 { 808 // insert temporal filter before sending to files 809 CField* fieldOut ; 810 redistributeFilter_ = std::shared_ptr<CGridRedistributeFilter>(new CGridRedistributeFilter(gc, this, fieldOut)); 811 fieldOut->setFileOut(this->getFileOut()); 812 fileOut_->replaceEnabledFields(this, fieldOut) ; 813 // insert temporal filter before sending to files 814 getTemporalDataFilter(gc, fileOut_->output_freq)->connectOutput(redistributeFilter_, 0); 815 fieldOut->inputFilter = std::shared_ptr<CPassThroughFilter>(new CPassThroughFilter(gc)); 816 fieldOut->instantDataFilter = fieldOut->inputFilter ; 817 redistributeFilter_->connectOutput(fieldOut->inputFilter, 0); 818 fieldOut->connectToFileWriter(gc) ; 819 fieldOut->solveServerOperation() ; // might not be called, create a new time functor.... find a better solution later 820 const bool buildGraph_ = !build_workflow_graph.isEmpty() && build_workflow_graph == true ; 821 822 if(buildGraph_) 823 { 824 clientToServerStoreFilter_->graphPackage = new CGraphPackage; 825 clientToServerStoreFilter_->graphEnabled = true; 826 clientToServerStoreFilter_->graphPackage->inFields.push_back(this); 827 } 828 } 829 */ 830 void CField::connectToOnlineWriter(CGarbageCollector& gc) 831 { 832 // insert temporal filter before sending to files 833 clientOnlineWriterFilter_ = std::shared_ptr<CClientOnlineWriterFilter>(new CClientOnlineWriterFilter(gc,this)) ; 834 getTemporalDataFilter(gc, fileOut_->output_freq)->connectOutput(clientOnlineReaderFilter_, 0); 835 836 const bool buildGraph_ = !build_workflow_graph.isEmpty() && build_workflow_graph == true ; 837 838 if(buildGraph_) 839 { 840 // to do 841 } 842 } 843 844 void CField::connectToOnlineReader(CGarbageCollector& gc) 845 { 846 // insert temporal filter before sending to files 847 clientOnlineReaderFilter_ = std::shared_ptr<CClientOnlineReaderFilter>(new CClientOnlineReaderFilter(gc,this)) ; 848 clientOnlineReaderFilter_ -> connectOutput(inputFilter,0) ; 849 } 850 811 851 void CField::connectToCouplerOut(CGarbageCollector& gc) 812 852 { 813 853 // insert temporal filter before sending to files 814 clientToServerStoreFilter_ = std::shared_ptr<CClientToServerStoreFilter>(new CClientToServerStoreFilter(gc, this, client ));854 clientToServerStoreFilter_ = std::shared_ptr<CClientToServerStoreFilter>(new CClientToServerStoreFilter(gc, this, client_)); 815 855 instantDataFilter->connectOutput(clientToServerStoreFilter_, 0); 816 856 const bool buildGraph_ = !build_workflow_graph.isEmpty() && build_workflow_graph == true ; … … 951 991 void CField::connectToServerToClient(CGarbageCollector& gc) 952 992 { 953 serverToClientStoreFilter_ = std::shared_ptr<CServerToClientStoreFilter>(new CServerToClientStoreFilter(gc, this, client ));993 serverToClientStoreFilter_ = std::shared_ptr<CServerToClientStoreFilter>(new CServerToClientStoreFilter(gc, this, client_)); 954 994 instantDataFilter->connectOutput(serverToClientStoreFilter_, 0); 955 995 const bool buildGraph_ = !build_workflow_graph.isEmpty() && build_workflow_graph == true ; … … 1435 1475 { 1436 1476 CContext* context = CContext::getCurrent(); 1437 client = contextClient;1477 client_ = contextClient; 1438 1478 1439 1479 // A grid is sent by a client (both for read or write) or by primary server (write only) … … 1441 1481 { 1442 1482 if (getRelFile()->mode.isEmpty() || (!getRelFile()->mode.isEmpty() && getRelFile()->mode == CFile::mode_attr::write)) 1443 grid_->setContextClient(contextClient);1483 /*grid_->setContextClient(contextClient) */; // => nothing to do with thats now, to remove... 1444 1484 } 1445 1485 else if (context->getServiceType()==CServicesManager::CLIENT) 1446 1486 { 1447 1487 if (grid_) 1448 grid_->setContextClient(contextClient);1488 /*grid_->setContextClient(contextClient)*/; // => nothing to do with thats now, to remove... 1449 1489 else 1490 1450 1491 ERROR( "CField::setContextClient(contextClient)", 1451 1492 << "Grid not defined for " << getId() … … 1459 1500 void CField::sendFieldToFileServer(void) 1460 1501 { 1461 CContext::getCurrent()->sendContextToFileServer(client );1462 getRelFile()->sendFileToFileServer(client );1502 CContext::getCurrent()->sendContextToFileServer(client_); 1503 getRelFile()->sendFileToFileServer(client_); 1463 1504 sentGrid_ = grid_-> duplicateSentGrid() ; 1464 sentGrid_->sendGridToFileServer(client , false);1505 sentGrid_->sendGridToFileServer(client_, false); 1465 1506 name = getFieldOutputName() ; 1466 this->sendAllAttributesToServer(client );1467 this->sendAddAllVariables(client );1507 this->sendAllAttributesToServer(client_); 1508 this->sendAddAllVariables(client_); 1468 1509 } 1469 1510 1470 1511 void CField::sendFieldToInputFileServer(void) 1471 1512 { 1472 CContext::getCurrent()->sendContextToFileServer(client );1473 getRelFile()->sendFileToFileServer(client );1513 CContext::getCurrent()->sendContextToFileServer(client_); 1514 getRelFile()->sendFileToFileServer(client_); 1474 1515 sentGrid_ = grid_-> duplicateSentGrid() ; 1475 sentGrid_->sendGridToFileServer(client , true);1516 sentGrid_->sendGridToFileServer(client_, true); 1476 1517 read_access=true ; // not the best solution, but on server side, the field must be a starting point of the workflow 1477 1518 // must be replace by a better solution when implementing filters for reading and send to client 1478 1519 // on server side 1479 this->sendAllAttributesToServer(client );1480 this->sendAddAllVariables(client );1520 this->sendAllAttributesToServer(client_); 1521 this->sendAddAllVariables(client_); 1481 1522 } 1482 1523 … … 1486 1527 else sendFieldToCouplerOut_done_=true ; 1487 1528 sentGrid_ = grid_-> duplicateSentGrid() ; 1488 sentGrid_->sendGridToCouplerOut(client , this->getId());1529 sentGrid_->sendGridToCouplerOut(client_, this->getId()); 1489 1530 this->sendGridCompleted(); 1490 1531 … … 1502 1543 CEventClient event(getType(),EVENT_ID_GRID_COMPLETED); 1503 1544 1504 if (client ->isServerLeader())1545 if (client_->isServerLeader()) 1505 1546 { 1506 1547 CMessage msg; 1507 1548 msg<<this->getId(); 1508 for (auto& rank : client ->getRanksServerLeader()) event.push(rank,1,msg);1509 client ->sendEvent(event);1510 } 1511 else client ->sendEvent(event);1549 for (auto& rank : client_->getRanksServerLeader()) event.push(rank,1,msg); 1550 client_->sendEvent(event); 1551 } 1552 else client_->sendEvent(event); 1512 1553 } 1513 1554 CATCH_DUMP_ATTR -
XIOS3/trunk/src/node/field.hpp
r2406 r2507 28 28 #include "client_to_server_store_filter.hpp" 29 29 #include "file_reader_source_filter.hpp" 30 #include "client_online_reader_filter.hpp" 31 #include "client_online_writer_filter.hpp" 30 32 31 33 … … 56 58 class CSourceFilter; 57 59 class CServerToClientFilter; 60 class CGridRedistributeFilter; 58 61 ///-------------------------------------------------------------- 59 62 … … 199 202 void checkForLateDataFromCoupler(void) ; 200 203 201 void checkIfMustAutoTrigger(void); // ym obsolete202 void autoTriggerIfNeeded(void); //ym obsolete203 204 void triggerLateField(void) ; 204 205 … … 237 238 void connectToFileReader(CGarbageCollector& gc) ; 238 239 void connectToServerToClient(CGarbageCollector& gc) ; 240 void connectToOnlineWriter(CGarbageCollector& gc) ; 241 void connectToOnlineReader(CGarbageCollector& gc) ; 239 242 240 243 void setContextClientDataBufferSize(map<CContextClient*,map<int,size_t>>& bufferSize, … … 267 270 CGrid* grid_=nullptr; 268 271 CGrid* getGrid(void) { return grid_; } 272 void setGrid(CGrid* grid) { grid_=grid; } 269 273 270 274 private: … … 327 331 328 332 private: 329 CContextClient* client ;333 CContextClient* client_; 330 334 public: 331 335 void setContextClient(CContextClient* newContextClient); 332 CContextClient* getContextClient(void) {return client ;}336 CContextClient* getContextClient(void) {return client_;} 333 337 334 338 private: … … 372 376 std::shared_ptr<COutputPin> selfReferenceFilter; // probably redondant with inputFilter 373 377 374 //! The source filter for data provided by the client375 // std::shared_ptr<CSourceFilter> clientSourceFilter; // obsolete to remove376 378 377 379 //! The source filter for data provided by the model to enter the client workflow … … 393 395 std::shared_ptr<CFileReaderSourceFilter> fileReaderSourceFilter_; 394 396 395 //! The source filter for data provided by the server396 // std::shared_ptr<CSourceFilter> serverSourceFilter; // obsolete to remove397 398 397 //! The terminal filter which send data to server for writing 399 398 std::shared_ptr<CClientToServerStoreFilter> clientToServerStoreFilter_; … … 405 404 std::shared_ptr<CServerToClientStoreFilter> serverToClientStoreFilter_; 406 405 406 //! the filter to redistribute data before to call the fileWriterStoreFilter ==> to remove 407 std::shared_ptr<CGridRedistributeFilter> redistributeFilter_ ; 408 409 //! the filter to connect to online reader 410 std::shared_ptr<CClientOnlineReaderFilter> clientOnlineReaderFilter_ ; 411 412 //! the filter to connect to online writer 413 std::shared_ptr<CClientOnlineWriterFilter> clientOnlineWriterFilter_ ; 414 407 415 408 416 }; // class CField -
XIOS3/trunk/src/node/file.cpp
r2458 r2507 178 178 179 179 return (this->enabledFields); 180 } 181 CATCH_DUMP_ATTR 182 183 void CFile::replaceEnabledFields(CField* fieldIn, CField* fieldOut) 184 TRY 185 { 186 for(auto& enableField : enabledFields) if (enableField==fieldIn) enableField=fieldOut ; 180 187 } 181 188 CATCH_DUMP_ATTR … … 979 986 980 987 /*! 981 * Post-process the filter graph for each active field.982 */983 void CFile::postProcessFilterGraph()984 TRY985 {986 int size = this->enabledFields.size();987 for (int i = 0; i < size; ++i)988 {989 this->enabledFields[i]->checkIfMustAutoTrigger();990 }991 }992 CATCH_DUMP_ATTR993 994 /*!995 988 Prefetching the data for enabled fields read from file. 996 989 */ … … 1004 997 for (int i = 0; i < size; ++i) 1005 998 this->enabledFields[i]->sendReadDataRequest(CContext::getCurrent()->getCalendar()->getCurrentDate()); 1006 }1007 CATCH_DUMP_ATTR1008 1009 /*!1010 Do all pre timestep operations for enabled fields in read mode:1011 - Check that the data excepted from server has been received1012 - Check if some filters must auto-trigger1013 */1014 void CFile::doPreTimestepOperationsForEnabledReadModeFields(void)1015 TRY1016 {1017 if (mode.isEmpty() || mode.getValue() != mode_attr::read)1018 return;1019 1020 int size = this->enabledFields.size();1021 for (int i = 0; i < size; ++i)1022 {1023 this->enabledFields[i]->checkForLateDataFromServer();1024 this->enabledFields[i]->autoTriggerIfNeeded();1025 }1026 999 } 1027 1000 CATCH_DUMP_ATTR -
XIOS3/trunk/src/node/file.hpp
r2458 r2507 83 83 int default_level = 1, 84 84 bool default_enabled = true); 85 void replaceEnabledFields(CField* fieldIn, CField* fieldOut) ; 85 86 86 87 StdString dumpClassAttributes(void); … … 112 113 void processEnabledFile(void); 113 114 114 void postProcessFilterGraph();115 115 void prefetchEnabledReadModeFields(); 116 void doPreTimestepOperationsForEnabledReadModeFields();117 116 void doPostTimestepOperationsForEnabledReadModeFields(); 118 117 … … 212 211 213 212 private: 214 215 213 bool isOnline_=false; 214 public: 215 bool isOnline(void) { return isOnline_ ;} 216 void setOnline(bool online=true) { isOnline_=online ;} 216 217 public: 217 218 // virtual void toBinary (StdOStream& os) const; -
XIOS3/trunk/src/node/grid.cpp
r2397 r2507 29 29 #include "generic_algorithm_transformation.hpp" 30 30 #include "algo_types.hpp" 31 #include "redistribute_domain.hpp" 32 #include "redistribute_axis.hpp" 33 #include "redistribute_scalar.hpp" 34 31 35 32 36 #include <regex> … … 48 52 , axisPositionInGrid_(), hasDomainAxisBaseRef_(false) 49 53 , gridSrc_(), order_() 50 , clients()51 54 { 52 55 setVirtualDomainGroup(CDomainGroup::create(getId() + "_virtual_domain_group")); … … 66 69 , axisPositionInGrid_(), hasDomainAxisBaseRef_(false) 67 70 , gridSrc_(), order_() 68 , clients()69 71 { 70 72 setVirtualDomainGroup(CDomainGroup::create(getId() + "_virtual_domain_group")); … … 1468 1470 distributeGridToServer(client, false, fieldId) ; 1469 1471 } 1472 1473 CGrid* CGrid::redistributeGridToWriter(void) 1474 { 1475 CContext* context = CContext::getCurrent(); 1476 CGrid* redistributedGrid ; 1477 string redistributeGridId="redistributedToWriter__"+getId() ; 1478 if (has(redistributeGridId)) redistributedGrid = get(redistributeGridId) ; 1479 else 1480 { 1481 redistributedGrid = CGrid::create(redistributeGridId) ; 1482 // simple Distribution for now 1483 // distribute over the fisrt element except if it is a scalar 1484 auto& elements = getElements() ; 1485 int posDistributed = 0 ; 1486 for(auto& element : elements) 1487 { 1488 if (element.type==TYPE_DOMAIN) break ; 1489 else if (element.type==TYPE_AXIS) break ; 1490 else if (element.type==TYPE_SCALAR) posDistributed++ ; 1491 } 1492 if (posDistributed==elements.size()) posDistributed=0 ; // grid composed only of scalar 1493 1494 for(int i=0 ; i<elements.size() ; i++) 1495 { 1496 if (elements[i].type==TYPE_DOMAIN) 1497 { 1498 CDomain* domain = redistributedGrid->addDomain() ; 1499 domain->domain_ref=elements[i].domain->getId() ; 1500 domain->name = elements[i].domain->getDomainOutputName() ; 1501 CRedistributeDomain* redistributeDomain = dynamic_cast<CRedistributeDomain *>(domain->addTransformation(TRANS_REDISTRIBUTE_DOMAIN, "")) ; 1502 redistributeDomain->type.setValue(posDistributed==i ? CRedistributeDomain::type_attr::bands : CRedistributeDomain::type_attr::full); 1503 } 1504 else if (elements[i].type==TYPE_AXIS) 1505 { 1506 CAxis* axis = redistributedGrid->addAxis() ; 1507 axis->axis_ref=elements[i].axis->getId() ; 1508 axis->name = elements[i].axis->getAxisOutputName() ; 1509 CRedistributeAxis* redistributeAxis = dynamic_cast<CRedistributeAxis *>(axis->addTransformation(TRANS_REDISTRIBUTE_AXIS, "")) ; 1510 redistributeAxis->type.setValue(posDistributed==i ? CRedistributeAxis::type_attr::bands : CRedistributeAxis::type_attr::full); 1511 } 1512 else if (elements[i].type==TYPE_SCALAR) 1513 { 1514 CScalar* scalar = redistributedGrid->addScalar() ; 1515 scalar->scalar_ref=elements[i].scalar->getId() ; 1516 scalar->name = elements[i].scalar->getScalarOutputName() ; 1517 CRedistributeScalar* redistributeScalar = dynamic_cast<CRedistributeScalar *>(scalar->addTransformation(TRANS_REDISTRIBUTE_SCALAR, "")) ; 1518 redistributeScalar->type.setValue(posDistributed==i ? CRedistributeScalar::type_attr::root : CRedistributeScalar::type_attr::full); 1519 } 1520 } 1521 } 1522 1523 return redistributedGrid ; 1524 } 1525 1526 1470 1527 1471 1528 … … 2369 2426 TRY 2370 2427 { 2371 if (clientsSet.find(contextClient)==clientsSet.end())2372 {2373 clients.push_back(contextClient) ;2374 clientsSet.insert(contextClient);2375 }2376 2428 for (auto domain : getDomains()) domain->setContextClient(contextClient); 2377 2429 for (auto axis : getAxis()) axis->setContextClient(contextClient); 2378 2430 for (auto scalar : getScalars()) scalar->setContextClient(contextClient); 2379 2380 2431 } 2381 2432 CATCH_DUMP_ATTR … … 2473 2524 } 2474 2525 2526 void CGrid::computeRedistributeToWriterConnector(CGrid* gridSrc) 2527 { 2528 CContext* context = CContext::getCurrent(); 2529 2530 vector<shared_ptr<CLocalView>> srcViews ; 2531 vector<shared_ptr<CLocalView>> dstViews ; 2532 2533 for(auto& element : gridSrc->getElements()) 2534 { 2535 if (element.type==TYPE_DOMAIN) srcViews.push_back(element.domain->getLocalView(CElementView::WORKFLOW)) ; 2536 else if (element.type==TYPE_AXIS) srcViews.push_back(element.axis->getLocalView(CElementView::WORKFLOW)) ; 2537 else if (element.type==TYPE_SCALAR) srcViews.push_back(element.scalar->getLocalView(CElementView::WORKFLOW)) ; 2538 } 2539 2540 for(auto& element : this->getElements()) 2541 { 2542 if (element.type==TYPE_DOMAIN) dstViews.push_back(element.domain->getLocalView(CElementView::WORKFLOW)) ; 2543 else if (element.type==TYPE_AXIS) dstViews.push_back(element.axis->getLocalView(CElementView::WORKFLOW)) ; 2544 else if (element.type==TYPE_SCALAR) dstViews.push_back(element.scalar->getLocalView(CElementView::WORKFLOW)) ; 2545 } 2546 2547 redistributeToWriterConnector_ = make_shared<CGridTransformConnector>(srcViews, dstViews, context->getIntraComm()) ; 2548 redistributeToWriterConnector_ -> computeConnector(true) ; 2549 } 2475 2550 2476 2551 } // namespace xios -
XIOS3/trunk/src/node/grid.hpp
r2397 r2507 279 279 280 280 bool isDataDistributed(void) ; 281 private:282 283 /** Clients that have to send a grid. There can be multiple clients in case of secondary server, otherwise only one client. */284 std::list<CContextClient*> clients;285 std::set<CContextClient*> clientsSet;286 281 287 282 private: … … 327 322 ////////////////////////////////////////////////////////////////////////////////////// 328 323 public: 324 CGrid* redistributeGridToWriter(void) ; 325 public: 329 326 CGrid* duplicateSentGrid(void) ; 330 327 private: … … 402 399 void computeServerFromClientConnector(void) ; 403 400 401 private: 402 shared_ptr<CGridTransformConnector> redistributeToWriterConnector_ = nullptr ; 403 public: 404 shared_ptr<CGridTransformConnector> getRedistributeToWriterConnector(CGrid* gridSrc) { if (redistributeToWriterConnector_==nullptr) computeRedistributeToWriterConnector(gridSrc) ; return redistributeToWriterConnector_;} 405 void computeRedistributeToWriterConnector(CGrid* gridSrc) ; 406 407 404 408 }; // class CGrid 405 409 -
XIOS3/trunk/src/node/node_enum.hpp
r2458 r2507 45 45 ePoolNode,gPoolNode, 46 46 eServiceNode,gServiceNode, 47 // eService, gService 47 eRedistributeDomain, gRedistributeDomain, 48 eRedistributeAxis, gRedistributeAxis, 49 eRedistributeScalar, gRedistributeScalar, 48 50 } ENodeType; 49 51 -
XIOS3/trunk/src/node/node_type.hpp
r2458 r2507 35 35 #include "pool_node.hpp" 36 36 #include "service_node.hpp" 37 #include "redistribute_domain.hpp" 38 #include "redistribute_axis.hpp" 39 #include "redistribute_scalar.hpp" 37 40 38 41 -
XIOS3/trunk/src/node/scalar.cpp
r2397 r2507 47 47 m["reduce_domain"] = TRANS_REDUCE_DOMAIN_TO_SCALAR; 48 48 m["reduce_scalar"] = TRANS_REDUCE_SCALAR_TO_SCALAR; 49 m["redistribute_scalar"] = TRANS_REDISTRIBUTE_SCALAR; 49 50 return true; 50 51 } … … 122 123 if (n.isEmpty()) n=1 ; 123 124 if (mask.isEmpty()) mask=true ; 125 126 hasValue_ = (value.isEmpty()) ? false :true ; 127 hasBounds_ = (bounds.isEmpty()) ? false :true ; 128 hasLabel_ = (label.isEmpty()) ? false :true ; 129 124 130 125 131 initializeLocalElement() ; -
XIOS3/trunk/src/node/scalar.hpp
r2397 r2507 143 143 144 144 bool isEqual(CScalar* scalar); 145 146 public: 147 bool hasValue() { return hasValue_; } 148 bool hasBounds() { return hasBounds_; } 149 bool hasLabel() { return hasLabel_; } 150 private: 151 bool hasValue_ = false ; 152 bool hasBounds_ = false ; 153 bool hasLabel_ = false ; 145 154 private: 146 155 /** Clients that have to send a scalar. There can be multiple clients in case of secondary server, otherwise only one client. */ -
XIOS3/trunk/src/object_factory_decl2.cpp
r2458 r2507 23 23 macro(CPoolNode) 24 24 macro(CServiceNode) 25 macro(CRedistributeDomain) 26 macro(CRedistributeAxis) 27 macro(CRedistributeScalar) 25 28 } 26 29 -
XIOS3/trunk/src/object_factory_decl4.cpp
r1591 r2507 19 19 macro(CReorderDomainGroup) 20 20 macro(CExtractDomainGroup) 21 macro(CRedistributeDomainGroup) 22 macro(CRedistributeAxisGroup) 23 macro(CRedistributeScalarGroup) 21 24 } 22 25 -
XIOS3/trunk/src/object_template_decl.cpp
r2458 r2507 38 38 template class CObjectTemplate<CPoolNode>; 39 39 template class CObjectTemplate<CServiceNode>; 40 template class CObjectTemplate<CRedistributeDomain>; 41 template class CObjectTemplate<CRedistributeAxis>; 42 template class CObjectTemplate<CRedistributeScalar>; 43 40 44 41 45 template class CObjectTemplate<CContextGroup>; … … 71 75 template class CObjectTemplate<CPoolNodeGroup>; 72 76 template class CObjectTemplate<CServiceNodeGroup>; 77 template class CObjectTemplate<CRedistributeDomainGroup>; 78 template class CObjectTemplate<CRedistributeAxisGroup>; 79 template class CObjectTemplate<CRedistributeScalarGroup>; 73 80 74 81 } -
XIOS3/trunk/src/transformation/algo_types.cpp
r2011 r2507 10 10 if (!first) return ; 11 11 bool ret ; 12 std::cout<<"register Transformation"<<std::endl ;13 12 ret=CScalarAlgorithmReduceAxis::registerTrans(); 14 13 ret=CScalarAlgorithmExtractAxis::registerTrans(); 15 14 ret=CScalarAlgorithmReduceDomain::registerTrans(); 16 15 ret=CScalarAlgorithmReduceScalar::registerTrans(); 17 16 ret=CScalarAlgorithmRedistribute::registerTrans() ; 18 17 //! Axis 19 18 ret=CAxisAlgorithmZoom::registerTrans(); … … 27 26 ret=CAxisAlgorithmTemporalSplitting::registerTrans(); 28 27 ret=CAxisAlgorithmDuplicateScalar::registerTrans(); 28 ret=CAxisAlgorithmRedistribute::registerTrans() ; 29 29 30 30 //! Domain … … 36 36 ret=CDomainAlgorithmExtract::registerTrans(); 37 37 ret=CDomainAlgorithmGenerateRectilinear::registerTrans() ; 38 ret=CDomainAlgorithmRedistribute::registerTrans() ; 38 39 first=false ; 39 40 } -
XIOS3/trunk/src/transformation/algo_types.hpp
r2018 r2507 14 14 #include "scalar_algorithm_reduce_domain.hpp" 15 15 #include "scalar_algorithm_reduce_scalar.hpp" 16 #include "scalar_algorithm_redistribute.hpp" 16 17 17 18 #include "axis_algorithm_inverse.hpp" … … 25 26 #include "axis_algorithm_temporal_splitting.hpp" 26 27 #include "axis_algorithm_duplicate_scalar.hpp" 27 28 #include "axis_algorithm_redistribute.hpp" 28 29 29 30 #include "domain_algorithm_zoom.hpp" … … 34 35 #include "domain_algorithm_reorder.hpp" 35 36 #include "domain_algorithm_extract.hpp" 37 #include "domain_algorithm_redistribute.hpp" 36 38 37 39 namespace xios -
XIOS3/trunk/src/transformation/axis_algorithm/axis_algorithm_extract.cpp
r2270 r2507 92 92 } 93 93 94 if (axisSrc_->hasValue ) axisDest_->value.resize(nDest);95 if (axisSrc_->hasLabel ) axisDest_->label.resize(nDest);96 if (axisSrc_->hasBounds ) axisDest_->bounds.resize(2,nDest);94 if (axisSrc_->hasValue()) axisDest_->value.resize(nDest); 95 if (axisSrc_->hasLabel()) axisDest_->label.resize(nDest); 96 if (axisSrc_->hasBounds()) axisDest_->bounds.resize(2,nDest); 97 97 98 98 auto& transMap = this->transformationMapping_; … … 142 142 // ----------------------------------------------------------------------------- 143 143 144 if (axisSrc_->hasValue )144 if (axisSrc_->hasValue()) 145 145 { 146 146 axisDest_->value(countDest) = axisSrc_->value(countSrc); 147 147 } 148 if (axisSrc_->hasLabel )148 if (axisSrc_->hasLabel()) 149 149 { 150 150 axisDest_->label(countDest) = axisSrc_->label(countSrc); 151 151 } 152 if (axisSrc_->hasBounds )152 if (axisSrc_->hasBounds()) 153 153 { 154 154 axisDest_->bounds(0,countDest) = axisSrc_->bounds(0,countSrc); -
XIOS3/trunk/src/transformation/axis_algorithm/axis_algorithm_inverse.cpp
r2270 r2507 123 123 } 124 124 125 if (axisSrc_->hasValue )125 if (axisSrc_->hasValue()) 126 126 { 127 127 axisDestination->value.resize(indexSize); … … 132 132 } 133 133 134 if (axisSrc_->hasBounds )134 if (axisSrc_->hasBounds()) 135 135 { 136 136 axisDestination->bounds.resize(2,indexSize); -
XIOS3/trunk/src/transformation/axis_algorithm/axis_algorithm_zoom.cpp
r2270 r2507 79 79 80 80 axisDest_->mask.resize(nDest); 81 if (axisSrc_->hasValue ) axisDest_->value.resize(nDest);82 if (axisSrc_->hasLabel ) axisDest_->label.resize(nDest);83 if (axisSrc_->hasBounds ) axisDest_->bounds.resize(2,nDest);81 if (axisSrc_->hasValue()) axisDest_->value.resize(nDest); 82 if (axisSrc_->hasLabel()) axisDest_->label.resize(nDest); 83 if (axisSrc_->hasBounds()) axisDest_->bounds.resize(2,nDest); 84 84 85 85 auto& transMap = this->transformationMapping_; … … 92 92 axisDest_->mask(iDest) = axisSrc_->mask(iSrc); 93 93 94 if (axisSrc_->hasValue )94 if (axisSrc_->hasValue()) 95 95 axisDest_->value(iDest) = axisSrc_->value(iSrc); 96 if (axisSrc_->hasLabel )96 if (axisSrc_->hasLabel()) 97 97 axisDest_->label(iDest) = axisSrc_->label(iSrc); 98 if (axisSrc_->hasBounds )98 if (axisSrc_->hasBounds()) 99 99 { 100 100 axisDest_->bounds(0,iDest) = axisSrc_->bounds(0,iSrc); -
XIOS3/trunk/src/transformation/domain_algorithm/domain_algorithm_extract.cpp
r2340 r2507 76 76 domainDestination->bounds_lon_2d.reset(); 77 77 domainDestination->bounds_lat_2d.reset(); 78 domainDestination->area.reset(); 78 domainDestination->area_1d.reset(); 79 domainDestination->area_2d.reset(); 79 80 domainDestination->radius.reset(); 80 81 … … 175 176 } 176 177 } 177 if (domainSrc_->hasArea) domainDest_->area.resize(niDest,njDest); 178 178 if (domainSrc_->hasArea) 179 { 180 if (!domainSrc_->area_2d.isEmpty()) domainDest_->area_2d.resize(niDest,njDest); 181 else if (!domainSrc_->area_1d.isEmpty()) domainDest_->area_1d.resize(niDest*njDest); 182 } 179 183 // Set attributes required to define domainDestination->localElement_ and associated views, full and workflow) 180 184 CArray<size_t,1> sourceGlobalIdx = domainSource->getLocalElement()->getGlobalIndex(); … … 241 245 242 246 // area 243 if (!domainSrc_->area.isEmpty()) 244 { 245 domainDest_->area(iIdxDestLocal,jIdxDestLocal) = domainSrc_->area(iIdxSrcLocal,jIdxSrcLocal); 246 } 247 if (!domainSrc_->area_2d.isEmpty()) domainDest_->area_2d(iIdxDestLocal,jIdxDestLocal) = domainSrc_->area_2d(iIdxSrcLocal,jIdxSrcLocal); 248 else if (!domainSrc_->area_1d.isEmpty()) domainDest_->area_1d(countDest) = domainSrc_->area_1d(countSrc); 247 249 248 250 // bounds -
XIOS3/trunk/src/transformation/domain_algorithm/domain_algorithm_reorder.cpp
r2270 r2507 128 128 else if (!domainSource->lonvalue_2d.isEmpty() ) 129 129 { 130 domainDestination->latvalue_2d.resize( domainSource->latvalue_2d. numElements() );131 domainDestination->lonvalue_2d.resize( domainSource->lonvalue_2d. numElements() );130 domainDestination->latvalue_2d.resize( domainSource->latvalue_2d.shape() ); 131 domainDestination->lonvalue_2d.resize( domainSource->lonvalue_2d.shape() ); 132 132 domainDestination->latvalue_2d = domainSource->latvalue_2d; 133 133 domainDestination->lonvalue_2d = domainSource->lonvalue_2d; … … 145 145 else if (!domainSource->bounds_lon_2d.isEmpty() ) 146 146 { 147 domainDestination->bounds_lon_2d.resize( domainSource->bounds_lon_2d. numElements() );148 domainDestination->bounds_lat_2d.resize( domainSource->bounds_lat_2d. numElements() );147 domainDestination->bounds_lon_2d.resize( domainSource->bounds_lon_2d.shape() ); 148 domainDestination->bounds_lat_2d.resize( domainSource->bounds_lat_2d.shape() ); 149 149 domainDestination->bounds_lon_2d = domainSource->bounds_lon_2d; 150 150 domainDestination->bounds_lat_2d = domainSource->bounds_lat_2d; 151 151 } 152 152 // set area 153 if (!domainSource->area.isEmpty() ) 154 { 155 domainDestination->area.resize( domainSource->area.numElements() ); 156 domainDestination->area = domainSource->area; 157 } 153 if (!domainSource->area_1d.isEmpty() ) 154 { 155 domainDestination->area_1d.resize( domainSource->area_1d.numElements() ); 156 domainDestination->area_1d = domainSource->area_1d; 157 } 158 else if (!domainSource->area_2d.isEmpty() ) 159 { 160 domainDestination->area_2d.resize( domainSource->area_2d.shape() ); 161 domainDestination->area_2d = domainSource->area_2d; 162 } 163 158 164 if (!domainSource->radius.isEmpty() ) 159 165 domainDestination->radius = domainSource->radius; -
XIOS3/trunk/src/transformation/domain_algorithm/domain_algorithm_zoom.cpp
r2270 r2507 173 173 } 174 174 } 175 if (domainSrc_->hasArea) domainDest_->area.resize(niDest,njDest); 176 175 if (domainSrc_->hasArea) 176 { 177 if (!domainSrc_->area_1d.isEmpty()) domainDest_->area_1d.resize(niDest*njDest); 178 else if (!domainSrc_->area_2d.isEmpty()) domainDest_->area_2d.resize(niDest,njDest); 179 } 177 180 178 181 for (int iDest = 0; iDest < niDest; iDest++) … … 196 199 197 200 if (domainSrc_->hasArea) 198 domainDest_->area(iDest,jDest) = domainSrc_->area(iSrc,jSrc); 201 { 202 if (!domainSrc_->area_1d.isEmpty()) domainDest_->area_1d(indLocDest) = domainSrc_->area_1d(ind); 203 else if (!domainSrc_->area_2d.isEmpty()) domainDest_->area_2d(iDest,jDest) = domainSrc_->area_2d(iSrc,jSrc); 204 } 199 205 200 206 if (domainSrc_->hasLonLat) -
XIOS3/trunk/src/transformation/scalar_algorithm/scalar_algorithm_extract_axis.cpp
r2303 r2507 108 108 } 109 109 110 if (axisSource->hasValue )110 if (axisSource->hasValue()) 111 111 { 112 112 scalarDestination->value = axisSource->value(idxSrc); -
XIOS3/trunk/src/transformation/transformation_enum.hpp
r1984 r2507 26 26 TRANS_REORDER_DOMAIN = 17, 27 27 TRANS_EXTRACT_DOMAIN = 18, 28 TRANS_EXTRACT_AXIS = 19 28 TRANS_EXTRACT_AXIS = 19, 29 TRANS_REDISTRIBUTE_DOMAIN = 20, 30 TRANS_REDISTRIBUTE_AXIS = 21, 31 TRANS_REDISTRIBUTE_SCALAR = 22 29 32 } ETranformationType; 30 33 -
XIOS3/trunk/src/transport/context_client.cpp
r2343 r2507 18 18 #include "one_sided_context_client.hpp" 19 19 #include "legacy_context_client.hpp" 20 #include "online_context_client.hpp" 21 20 22 21 23 namespace xios … … 61 63 if (defaultProtocol=="one_sided") return getNew<CContextClient::oneSided>(parent, intraComm, interComm) ; 62 64 else if (defaultProtocol=="legacy") return getNew<CContextClient::legacy>(parent, intraComm, interComm) ; 65 else if (defaultProtocol=="online") return getNew<CContextClient::online>(parent, intraComm, interComm) ; 63 66 else if (defaultProtocol=="default") return getNew<CContextClient::legacy>(parent, intraComm, interComm) ; 64 67 else ERROR("CContextClient* CContextClient::getNew<CContextClient::generic>(CContext* parent, MPI_Comm intraComm, MPI_Comm interComm, CContext* parentServer)", … … 76 79 { 77 80 return new CLegacyContextClient(parent, intraComm, interComm, parentServer); 81 } 82 83 template<> 84 CContextClient* CContextClient::getNew<CContextClient::online>(CContext* parent, MPI_Comm intraComm, MPI_Comm interComm, CContext* parentServer) 85 { 86 return new COnlineContextClient(parent, intraComm, interComm, parentServer); 78 87 } 79 88 -
XIOS3/trunk/src/transport/context_client.hpp
r2343 r2507 28 28 { 29 29 public: 30 enum ETransport { generic, legacy, oneSided } ;30 enum ETransport { generic, legacy, oneSided, online} ; 31 31 32 32 template<ETransport transport=generic> … … 56 56 57 57 58 virtual ETransport getType(void) = 0 ; 58 59 // Send event to server 59 60 virtual void sendEvent(CEventClient& event)=0; … … 68 69 virtual void setBufferSize(const std::map<int,StdSize>& mapSize)=0; 69 70 70 71 public: 72 static CContextClient* ONLINE(void) { return reinterpret_cast<CContextClient*>(0xdeaddead);} 71 73 protected: 72 74 … … 104 106 CContextClient* CContextClient::getNew<CContextClient::legacy>(CContext* parent, MPI_Comm intraComm, MPI_Comm interComm, CContext* parentServer) ; 105 107 108 template<> 109 CContextClient* CContextClient::getNew<CContextClient::online>(CContext* parent, MPI_Comm intraComm, MPI_Comm interComm, CContext* parentServer) ; 110 106 111 107 112 } -
XIOS3/trunk/src/transport/legacy_context_client.cpp
r2458 r2507 40 40 } 41 41 42 CContextClient::ETransport getType(void) {return CContextClient::legacy ;} 42 43 43 44 /*! -
XIOS3/trunk/src/transport/legacy_context_client.hpp
r2458 r2507 31 31 32 32 // Send event to server 33 ETransport getType(void) {return legacy ;} 33 34 void sendEvent(CEventClient& event); 34 35 void eventLoop(void) ; -
XIOS3/trunk/src/transport/legacy_context_server.cpp
r2458 r2507 323 323 { 324 324 eventScheduler_->registerEvent(currentTimeLine,hashId); 325 info(100)<<"Context id "<<context->getId()<<"Schedule event : "<< currentTimeLine <<" "<<hashId<<endl ; 325 326 scheduled=true; 326 327 } … … 342 343 if (!flag) return ; 343 344 eventScheduled_=false ; 345 } 346 347 if (CXios::checkEventSync) 348 { 349 int typeId, classId, typeId_in, classId_in; 350 long long timeLine_out; 351 long long timeLine_in( currentTimeLine ); 352 typeId_in=event->type ; 353 classId_in=event->classId ; 354 // MPI_Allreduce(&timeLine,&timeLine_out, 1, MPI_UINT64_T, MPI_SUM, intraComm) ; // MPI_UINT64_T standardized by MPI 3 355 MPI_Allreduce(&timeLine_in,&timeLine_out, 1, MPI_LONG_LONG_INT, MPI_SUM, intraComm) ; 356 MPI_Allreduce(&typeId_in,&typeId, 1, MPI_INT, MPI_SUM, intraComm) ; 357 MPI_Allreduce(&classId_in,&classId, 1, MPI_INT, MPI_SUM, intraComm) ; 358 if (typeId/intraCommSize!=event->type || classId/intraCommSize!=event->classId || timeLine_out/intraCommSize!=currentTimeLine) 359 { 360 ERROR("void CLegacyContextClient::sendEvent(CEventClient& event)", 361 << "Event are not coherent between client for timeline = "<<currentTimeLine); 362 } 344 363 } 345 364 -
XIOS3/trunk/src/transport/one_sided_context_client.hpp
r2458 r2507 30 30 COneSidedContextClient(CContext* parent, MPI_Comm intraComm, MPI_Comm interComm, CContext* parentServer = 0); 31 31 32 ETransport getType(void) {return oneSided ;} 32 33 // Send event to server 33 34 void sendEvent(CEventClient& event); -
XIOS3/trunk/src/type/type_util.hpp
r2458 r2507 70 70 class CServiceNode ; 71 71 class CServiceNodeGroup ; 72 72 class CRedistributeDomain; 73 class CRedistributeDomainGroup; 74 class CRedistributeAxis; 75 class CRedistributeAxisGroup; 76 class CRedistributeScalar; 77 class CRedistributeScalarGroup; 78 73 79 template <typename T> inline string getStrType(void); 74 80 … … 158 164 macro(CServiceNode) 159 165 macro(CServiceNodeGroup) 160 166 macro(CRedistributeDomain) 167 macro(CRedistributeDomainGroup) 168 macro(CRedistributeAxis) 169 macro(CRedistributeAxisGroup) 170 macro(CRedistributeScalar) 171 macro(CRedistributeScalarGroup) 172 161 173 #undef macro 162 174 } -
XIOS3/trunk/src/xml_parser_decl.cpp
r2458 r2507 44 44 macro( PoolNode ) 45 45 macro( ServiceNode ) 46 macro( RedistributeDomain ) 47 macro( RedistributeAxis ) 48 macro( RedistributeScalar ) 49 46 50 } 47 51 }
Note: See TracChangeset
for help on using the changeset viewer.