Changeset 906


Ignore:
Timestamp:
07/28/16 10:56:52 (8 years ago)
Author:
mhnguyen
Message:

Fixing bug: Ticket 98

+) Correct the way to distribute index of domain (axis) in case there are more
clients than number of index

Test
+) On Curie
+) Small grid (2x2x1) and 6 clients - 1 server: Pass

Location:
XIOS/trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/client_server_mapping_distributed.cpp

    r860 r906  
    1313#include "utils.hpp" 
    1414#include "mpi_tag.hpp" 
     15#include "context.hpp" 
     16#include "context_client.hpp" 
    1517 
    1618namespace xios 
     
    3638void CClientServerMappingDistributed::computeServerIndexMapping(const CArray<size_t,1>& globalIndexOnClient) 
    3739{ 
     40  CContext* context=CContext::getCurrent() ; 
     41  CContextClient* client=context->client ; 
     42  int nbServer=client->serverSize; 
     43 
    3844  ccDHT_->computeIndexInfoMapping(globalIndexOnClient); 
    3945  const CClientClientDHTInt::Index2VectorInfoTypeMap& infoIndexMap = (ccDHT_->getInfoIndexMap()); 
    4046  CClientClientDHTInt::Index2VectorInfoTypeMap::const_iterator itb = infoIndexMap.begin(), ite = infoIndexMap.end(), it; 
    41   std::vector<size_t> nbInfoIndex(ccDHT_->getNbClient(),0); 
     47  std::vector<size_t> nbInfoIndex(nbServer,0); 
    4248 
    4349  for (it = itb; it != ite; ++it) 
  • XIOS/trunk/src/node/axis.cpp

    r895 r906  
    400400    int nbServer = client->serverSize; 
    401401    int range, clientSize = client->clientSize; 
     402    int rank = client->clientRank; 
    402403 
    403404    size_t ni = this->n.getValue(); 
     
    453454      for (int i = 0; i < nGlobAxis.size(); ++i) globalSizeIndex *= nGlobAxis[i]; 
    454455      indexBegin = 0; 
    455       for (int i = 0; i < clientSize; ++i) 
    456       { 
    457         range = globalSizeIndex / clientSize; 
    458         if (i < (globalSizeIndex%clientSize)) ++range; 
    459         if (i == client->clientRank) break; 
    460         indexBegin += range; 
    461       } 
    462       indexEnd = indexBegin + range - 1; 
     456      if (globalSizeIndex <= clientSize) 
     457      { 
     458        indexBegin = rank%globalSizeIndex; 
     459        indexEnd = indexBegin; 
     460      } 
     461      else 
     462      { 
     463        for (int i = 0; i < clientSize; ++i) 
     464        { 
     465          range = globalSizeIndex / clientSize; 
     466          if (i < (globalSizeIndex%clientSize)) ++range; 
     467          if (i == client->clientRank) break; 
     468          indexBegin += range; 
     469        } 
     470        indexEnd = indexBegin + range - 1; 
     471      } 
    463472 
    464473      CServerDistributionDescription serverDescription(nGlobAxis, nbServer); 
  • XIOS/trunk/src/node/domain.cpp

    r899 r906  
    532532       if (bounds_lon_end.isEmpty()) bounds_lon_end=180.-1e-8 ; 
    533533     } 
    534       
     534 
    535535     for(j=0;j<nj;++j) 
    536536       for(i=0;i<ni;++i) 
     
    921921     size_t zoom_jend=global_zoom_jbegin+global_zoom_nj-1 ; 
    922922 
    923       
     923 
    924924     size_t dn=data_i_index.numElements() ; 
    925925     int i,j ; 
    926926     size_t k,ind ; 
    927       
     927 
    928928     for(k=0;k<dn;k++) 
    929929     { 
     
    936936       { 
    937937          i=(data_i_index(k)+data_ibegin)%ni ; 
    938           j=(data_i_index(k)+data_ibegin)/ni ;           
     938          j=(data_i_index(k)+data_ibegin)/ni ; 
    939939       } 
    940940 
     
    947947     } 
    948948   } 
    949         
    950           
    951       
    952  
    953       
    954  
    955     
     949 
     950 
     951 
     952 
     953 
     954 
     955 
    956956   void CDomain::checkEligibilityForCompressedOutput(void) 
    957957   { 
     
    13581358    CContextClient* client=context->client ; 
    13591359    int nbServer=client->serverSize; 
     1360    int rank = client->clientRank; 
    13601361    bool doComputeGlobalIndexServer = true; 
    13611362 
     
    14451446    for (int i = 0; i < nGlobDomain_.size(); ++i) globalSizeIndex *= nGlobDomain_[i]; 
    14461447    indexBegin = 0; 
    1447     for (int i = 0; i < clientSize; ++i) 
    1448     { 
    1449       range = globalSizeIndex / clientSize; 
    1450       if (i < (globalSizeIndex%clientSize)) ++range; 
    1451       if (i == client->clientRank) break; 
    1452       indexBegin += range; 
    1453     } 
    1454     indexEnd = indexBegin + range - 1; 
     1448    if (globalSizeIndex <= clientSize) 
     1449    { 
     1450      indexBegin = rank%globalSizeIndex; 
     1451      indexEnd = indexBegin; 
     1452    } 
     1453    else 
     1454    { 
     1455      for (int i = 0; i < clientSize; ++i) 
     1456      { 
     1457        range = globalSizeIndex / clientSize; 
     1458        if (i < (globalSizeIndex%clientSize)) ++range; 
     1459        if (i == client->clientRank) break; 
     1460        indexBegin += range; 
     1461      } 
     1462      indexEnd = indexBegin + range - 1; 
     1463    } 
    14551464 
    14561465    CServerDistributionDescription serverDescription(nGlobDomain_, nbServer); 
Note: See TracChangeset for help on using the changeset viewer.