Changeset 2606 for XIOS3/trunk/src/node/domain.cpp
- Timestamp:
- 01/29/24 10:38:53 (5 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS3/trunk/src/node/domain.cpp
r2601 r2606 1807 1807 size_t CDomain::computeAttributesHash( MPI_Comm comm ) 1808 1808 { 1809 // Compute the hash of distributed attributs (value ...) 1810 int globalSize = this->ni_glo.getValue()*this->nj_glo.getValue(); 1811 CArray<size_t,1> globalIndex; // No redundancy globalIndex will be computed with the connector 1812 shared_ptr<CGridTransformConnector> gridTransformConnector; 1813 // Compute a without redundancy element FULL view to enable a consistent hash computation 1814 this->getLocalView(CElementView::FULL)->createWithoutRedundancyFullViewConnector( globalSize, comm, gridTransformConnector, globalIndex ); 1815 int localSize = globalIndex.numElements(); 1816 1817 CArray<double,1> lon_distributedValue, lat_distributedValue ; 1818 gridTransformConnector->transfer(this->lonvalue, lon_distributedValue ); 1819 gridTransformConnector->transfer(this->latvalue, lat_distributedValue ); 1820 1821 // Compute the distributed hash (v0) of the element 1822 // it will be associated to the default element name (= map key), and to the name really written 1823 size_t localHash = 0; 1824 for (int iloc=0; iloc<localSize ; iloc++ ) localHash+=globalIndex(iloc)*lon_distributedValue(iloc)*lat_distributedValue(iloc); 1809 int sz(1); 1810 MPI_Comm_size( comm, &sz ); 1825 1811 size_t distributedHash = 0; 1826 MPI_Allreduce( &localHash, &distributedHash, 1, MPI_UNSIGNED_LONG, MPI_SUM, comm ); 1827 1812 if (sz!=1) // compute the connector only if the element is distributed 1813 { 1814 // Compute the hash of distributed attributs (value ...) 1815 int globalSize = this->ni_glo.getValue()*this->nj_glo.getValue(); 1816 CArray<size_t,1> globalIndex; // No redundancy globalIndex will be computed with the connector 1817 shared_ptr<CGridTransformConnector> gridTransformConnector; 1818 // Compute a without redundancy element FULL view to enable a consistent hash computation 1819 this->getLocalView(CElementView::FULL)->createWithoutRedundancyFullViewConnector( globalSize, comm, gridTransformConnector, globalIndex ); 1820 int localSize = globalIndex.numElements(); 1821 1822 CArray<double,1> lon_distributedValue, lat_distributedValue ; 1823 gridTransformConnector->transfer(this->lonvalue, lon_distributedValue ); 1824 gridTransformConnector->transfer(this->latvalue, lat_distributedValue ); 1825 1826 // Compute the distributed hash (v0) of the element 1827 // it will be associated to the default element name (= map key), and to the name really written 1828 size_t localHash = 0; 1829 for (int iloc=0; iloc<localSize ; iloc++ ) localHash+=globalIndex(iloc)*lon_distributedValue(iloc)*lat_distributedValue(iloc); 1830 distributedHash = 0; 1831 MPI_Allreduce( &localHash, &distributedHash, 1, MPI_UNSIGNED_LONG, MPI_SUM, comm ); 1832 } 1833 else // if the element is not distributed, the local hash is valid 1834 { 1835 int globalSize = this->ni_glo.getValue()*this->nj_glo.getValue(); 1836 int localSize = globalSize; 1837 size_t localHash = 0; 1838 for (int iloc=0; iloc<localSize ; iloc++ ) localHash+=iloc*this->lonvalue(iloc)*this->latvalue(iloc); 1839 distributedHash = localHash; 1840 } 1841 1828 1842 // Compute the hash of global attributs (unit, prec ...) 1829 1843 vector<StdString> excludedAttr;
Note: See TracChangeset
for help on using the changeset viewer.