Changeset 2386 for XIOS3/trunk/src/node
- Timestamp:
- 07/26/22 15:26:52 (23 months ago)
- Location:
- XIOS3/trunk/src/node
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS3/trunk/src/node/axis.cpp
r2343 r2386 302 302 bounds.reset(); 303 303 label.reset() ; 304 } 305 306 int CAxis::computeAttributesHash( MPI_Comm comm ) 307 { 308 int axis_hash = 0; 309 310 // Compute the hash of distributed attributs (value ...) 311 int globalSize = this->n_glo.getValue(); 312 CArray<size_t,1> globalIndex; // No redundancy globalIndex will be computed with the connector 313 shared_ptr<CGridTransformConnector> gridTransformConnector; 314 // Compute a without redundancy element FULL view to enable a consistent hash computation (and a distributed globalIndex) 315 this->getLocalView(CElementView::FULL)->createWithoutRedundancyFullViewConnector( globalSize, comm, gridTransformConnector, globalIndex ); 316 int localSize = globalIndex.numElements(); 317 318 CArray<double,1> distributedValue ; 319 gridTransformConnector->transfer(this->value, distributedValue ); 320 321 int localHash = 0; 322 for (int iloc=0; iloc<localSize ; iloc++ ) localHash+=globalIndex(iloc)*distributedValue(iloc); 323 int distributedHash = 0; 324 MPI_Allreduce( &localHash, &distributedHash, 1, MPI_INT, MPI_SUM, comm ); 325 326 // Compute the hash of global attributs (unit, prec ...) 327 vector<StdString> excludedAttr; 328 //excludedAttr.push_back("name"); 329 // internal attributs 330 excludedAttr.insert(excludedAttr.end(), { "index", "data_n", "data_begin", "data_index" }); 331 excludedAttr.insert(excludedAttr.end(), { "begin", "n" }); 332 excludedAttr.push_back("axis_ref"); 333 // in distributed 334 excludedAttr.push_back("value"); 335 // should be considered in distributed 336 excludedAttr.push_back("bounds"); 337 excludedAttr.push_back("label"); 338 excludedAttr.push_back("mask"); // ??? 339 340 int globalHash = this->computeGlobalAttributesHash( excludedAttr ); 341 342 return distributedHash + globalHash; 304 343 } 305 344 -
XIOS3/trunk/src/node/axis.hpp
r2326 r2386 130 130 void resetGeometricAttributes(void) ; 131 131 132 int computeAttributesHash( MPI_Comm comm ); 133 132 134 size_t getGlobalWrittenSize(void) ; 133 135 -
XIOS3/trunk/src/node/domain.cpp
r2343 r2386 1770 1770 CATCH_DUMP_ATTR 1771 1771 1772 int CDomain::computeAttributesHash( MPI_Comm comm ) 1773 { 1774 int domain_hash = 0; 1775 1776 // Compute the hash of distributed attributs (value ...) 1777 int globalSize = this->ni_glo.getValue()*this->nj_glo.getValue(); 1778 CArray<size_t,1> globalIndex; // No redundancy globalIndex will be computed with the connector 1779 shared_ptr<CGridTransformConnector> gridTransformConnector; 1780 // Compute a without redundancy element FULL view to enable a consistent hash computation 1781 this->getLocalView(CElementView::FULL)->createWithoutRedundancyFullViewConnector( globalSize, comm, gridTransformConnector, globalIndex ); 1782 int localSize = globalIndex.numElements(); 1783 1784 CArray<double,1> lon_distributedValue, lat_distributedValue ; 1785 gridTransformConnector->transfer(this->lonvalue, lon_distributedValue ); 1786 gridTransformConnector->transfer(this->latvalue, lat_distributedValue ); 1787 1788 // Compute the distributed hash (v0) of the element 1789 // it will be associated to the default element name (= map key), and to the name really written 1790 int localHash = 0; 1791 for (int iloc=0; iloc<localSize ; iloc++ ) localHash+=globalIndex(iloc)*lon_distributedValue(iloc)*lat_distributedValue(iloc); 1792 int distributedHash = 0; 1793 MPI_Allreduce( &localHash, &distributedHash, 1, MPI_INT, MPI_SUM, comm ); 1794 1795 // Compute the hash of global attributs (unit, prec ...) 1796 vector<StdString> excludedAttr; 1797 //excludedAttr.push_back("name"); 1798 // internal attributs 1799 excludedAttr.insert(excludedAttr.end(), { "ibegin", "jbegin", "ni", "nj", "i_index", "j_index" }); 1800 excludedAttr.insert(excludedAttr.end(), { "data_ni", "data_nj", "data_ibegin", "data_jbegin" }); 1801 excludedAttr.insert(excludedAttr.end(), { "data_i_index", "data_j_index", "domain_ref" }); 1802 // in distributed through lonvalue and latvalue 1803 excludedAttr.insert(excludedAttr.end(), { "lonvalue_1d", "latvalue_1d", "lonvalue_2d", "latvalue_2d" }); 1804 // should be considered in distributed 1805 excludedAttr.insert(excludedAttr.end(), { "mask_1d", "mask_2d" }); // ??? 1806 excludedAttr.insert(excludedAttr.end(), { "bounds_lon_1d", "bounds_lat_1d", "bounds_lon_2d", "bounds_lat_2d" }); 1807 excludedAttr.insert(excludedAttr.end(), { "area" }); 1808 // private 1809 excludedAttr.insert(excludedAttr.end(), { "lon_start", "lon_end", "lat_start", "lat_end" }); 1810 excludedAttr.insert(excludedAttr.end(), { "bounds_lon_start", "bounds_lon_end", "bounds_lat_start", "bounds_lat_end" }); 1811 excludedAttr.insert(excludedAttr.end(), { "has_lat_in_read_file", "has_lon_in_read_file", "has_bounds_lat_in_read_file", "has_bounds_lon_in_read_file" }); 1812 excludedAttr.insert(excludedAttr.end(), { "lonvalue_rectilinear_read_from_file", "latvalue_rectilinear_read_from_file", "lonvalue_curvilinear_read_from_file", "latvalue_curvilinear_read_from_file" }); 1813 excludedAttr.insert(excludedAttr.end(), { "bounds_lonvalue_curvilinear_read_from_file", "bounds_latvalue_curvilinear_read_from_file", "lonvalue_unstructured_read_from_file", "latvalue_unstructured_read_from_file" }); 1814 excludedAttr.insert(excludedAttr.end(), { "bounds_lonvalue_unstructured_read_from_file", "bounds_latvalue_unstructured_read_from_file" }); 1815 1816 int globalHash = this->computeGlobalAttributesHash( excludedAttr ); 1817 1818 return distributedHash + globalHash; 1819 } 1772 1820 1773 1821 void CDomain::initializeLocalElement(void) -
XIOS3/trunk/src/node/domain.hpp
r2326 r2386 91 91 bool checkAttributes_done_ = false ; 92 92 93 int computeAttributesHash( MPI_Comm comm ); 93 94 94 95 //////////////////////////
Note: See TracChangeset
for help on using the changeset viewer.