Ignore:
Timestamp:
05/22/17 18:11:12 (7 years ago)
Author:
mhnguyen
Message:

Updating compressed index output on using 2-level server

+) Update compressed index output with new grid distribution

Test
+) On Curie
+) test_complete:

  • Mode: classical and 2 level server
  • config: 4 clients + 4 servers
  • passed
File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_olga/src/node/domain.cpp

    r1132 r1143  
    3131      : CObjectTemplate<CDomain>(), CDomainAttributes() 
    3232      , isChecked(false), relFiles(), isClientChecked(false), nbConnectedClients_(), indSrv_(), connectedServerRank_(), connectedServerZoomRank_() 
    33       , hasBounds(false), hasArea(false), isDistributed_(false), isCompressible_(false), isUnstructed_(false) 
     33      , hasBounds(false), hasArea(false), isCompressible_(false), isUnstructed_(false) 
    3434      , isClientAfterTransformationChecked(false), hasLonLat(false) 
    3535      , isRedistributed_(false), hasPole(false), doZoomByIndex_(false) 
     
    4242      : CObjectTemplate<CDomain>(id), CDomainAttributes() 
    4343      , isChecked(false), relFiles(), isClientChecked(false), nbConnectedClients_(), indSrv_(), connectedServerRank_(), connectedServerZoomRank_() 
    44       , hasBounds(false), hasArea(false), isDistributed_(false), isCompressible_(false), isUnstructed_(false) 
     44      , hasBounds(false), hasArea(false), isCompressible_(false), isUnstructed_(false) 
    4545      , isClientAfterTransformationChecked(false), hasLonLat(false) 
    4646      , isRedistributed_(false), hasPole(false), doZoomByIndex_(false) 
     
    235235   bool CDomain::isDistributed(void) const 
    236236   { 
    237       return isDistributed_; 
     237      return !((!ni.isEmpty() && (ni == ni_glo) && !nj.isEmpty() && (nj == nj_glo)) || 
     238              (!i_index.isEmpty() && i_index.numElements() == ni_glo*nj_glo)); 
    238239   } 
    239240 
     
    741742     }      
    742743     checkZoom(); 
    743  
    744      isDistributed_ = !((!ni.isEmpty() && (ni == ni_glo) && !nj.isEmpty() && (nj == nj_glo)) || 
    745                         (!i_index.isEmpty() && i_index.numElements() == ni_glo*nj_glo)); 
    746744   } 
    747745 
     
    18351833      computedWrittenIndex_ = true; 
    18361834 
    1837       CContext* context=CContext::getCurrent() ; 
    1838       CContextClient* client = context->client;  
     1835      CContext* context=CContext::getCurrent();       
     1836      CContextServer* server = context->server;  
    18391837 
    18401838      std::vector<int> nBegin(2), nSize(2), nBeginGlobal(2), nGlob(2); 
     
    18431841      nBeginGlobal[0] = 0; nBeginGlobal[1] = 0; 
    18441842      nGlob[0]        = ni_glo;   nGlob[1] = nj_glo; 
    1845       CDistributionServer srvDist(client->clientSize, nBegin, nSize, nBeginGlobal, nGlob);  
     1843      CDistributionServer srvDist(server->intraCommSize, nBegin, nSize, nBeginGlobal, nGlob);  
    18461844      const CArray<size_t,1>& writtenGlobalIndex  = srvDist.getGlobalIndex(); 
    18471845 
     
    18511849      CArray<size_t,1>::const_iterator itSrvb = writtenGlobalIndex.begin(), 
    18521850                                       itSrve = writtenGlobalIndex.end(), itSrv; 
    1853       localIndexToWriteOnServer.resize(writtenGlobalIndex.numElements()); 
     1851 
     1852      for (itSrv = itSrvb; itSrv != itSrve; ++itSrv) 
     1853      { 
     1854        indGlo = *itSrv; 
     1855        if (ite != globalLocalIndexMap_.find(indGlo)) 
     1856        {           
     1857          ++nbWritten; 
     1858        }                  
     1859      } 
     1860 
     1861      localIndexToWriteOnServer.resize(nbWritten); 
     1862 
     1863      nbWritten = 0; 
    18541864      for (itSrv = itSrvb; itSrv != itSrve; ++itSrv) 
    18551865      { 
     
    18611871        }                  
    18621872      } 
     1873       
     1874      if (isCompressible()) 
     1875      { 
     1876        nbWritten = 0; 
     1877        boost::unordered_map<size_t,size_t> localGlobalIndexMap; 
     1878        for (itSrv = itSrvb; itSrv != itSrve; ++itSrv) 
     1879        { 
     1880          indGlo = *itSrv; 
     1881          if (ite != globalLocalIndexMap_.find(indGlo)) 
     1882          { 
     1883            localGlobalIndexMap[localIndexToWriteOnServer(nbWritten)] = indGlo; 
     1884            ++nbWritten; 
     1885          }                  
     1886        } 
     1887 
     1888        nbWritten = 0; 
     1889        for (int idx = 0; idx < data_i_index.numElements(); ++idx) 
     1890        { 
     1891          if (localGlobalIndexMap.end() != localGlobalIndexMap.find(data_i_index(idx))) 
     1892          { 
     1893            ++nbWritten; 
     1894          } 
     1895        } 
     1896 
     1897        compressedIndexToWriteOnServer.resize(nbWritten); 
     1898        nbWritten = 0; 
     1899        for (int idx = 0; idx < data_i_index.numElements(); ++idx) 
     1900        { 
     1901          if (localGlobalIndexMap.end() != localGlobalIndexMap.find(data_i_index(idx))) 
     1902          { 
     1903            compressedIndexToWriteOnServer(nbWritten) = localGlobalIndexMap[data_i_index(idx)]; 
     1904            ++nbWritten; 
     1905          } 
     1906        } 
     1907 
     1908        numberWrittenIndexes_ = nbWritten; 
     1909        if (isDistributed()) 
     1910        {             
     1911          MPI_Allreduce(&numberWrittenIndexes_, &totalNumberWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm); 
     1912          MPI_Scan(&numberWrittenIndexes_, &offsetWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm); 
     1913          offsetWrittenIndexes_ -= numberWrittenIndexes_; 
     1914        } 
     1915        else 
     1916          totalNumberWrittenIndexes_ = numberWrittenIndexes_; 
     1917      }       
    18631918   } 
    18641919 
     
    29883043    CArray<int,1> dataIIndex(nbIndex), dataJIndex(nbIndex); 
    29893044    dataIIndex = -1; dataJIndex = -1; 
    2990  
     3045      
    29913046    nbIndex = 0; 
    29923047    for (i = 0; i < nbReceived; ++i) 
Note: See TracChangeset for help on using the changeset viewer.