Ignore:
Timestamp:
11/23/21 13:12:46 (3 years ago)
Author:
ymipsl
Message:

Scalar can be now distributed on server side, avoiding incorrect result coming from redondant nature of scalar grid.
YM

Location:
XIOS/dev/dev_ym/XIOS_COUPLING/src/node
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/field.cpp

    r2230 r2264  
    100100      { 
    101101        case EVENT_ID_UPDATE_DATA : 
     102          // return true; // temporary 
    102103          recvUpdateData(event); 
    103104          return true; 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/grid.cpp

    r2236 r2264  
    14271427      else if (element.type==TYPE_SCALAR) posDistributed++ ; 
    14281428    } 
     1429    if (posDistributed==elements.size()) posDistributed=0 ; // grid composed only of scalar 
    14291430     
    14301431    vector<CLocalView*> localViews ; 
     
    14531454      { 
    14541455        CScalar* scalar = (CScalar*) elements[i].ptr ; 
    1455         scalar->computeRemoteElement(client, posDistributed==i ? EDistributionType::BANDS : EDistributionType::NONE) ; 
     1456        scalar->computeRemoteElement(client, posDistributed==i ? EDistributionType::ROOT : EDistributionType::NONE) ; 
    14561457        remoteViews.push_back(scalar->getRemoteElement(client)->getView(CElementView::FULL)) ; 
    14571458        localViews.push_back(scalar->getLocalView(CElementView::FULL)) ; 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/scalar.cpp

    r2206 r2264  
    112112    if (checkAttributes_done_) return ; 
    113113    checkAttributes_done_ = true ;  
    114  
     114     
     115    if (n.isEmpty()) n=1 ; 
    115116    if (mask.isEmpty()) mask=true ; 
    116117 
     
    342343      int rank = CContext::getCurrent()->getIntraCommRank() ; 
    343344       
    344       CArray<size_t,1> ind(1) ; 
    345       ind(0)=0 ; 
    346       localElement_ = new CLocalElement(rank, 1, ind) ; 
     345       
     346      CArray<size_t,1> index(n) ; 
     347      if (n==1) index(0)=0 ; 
     348      localElement_ = new CLocalElement(rank, 1, index) ; 
    347349   } 
    348350 
    349351   void CScalar::addFullView(void) 
    350352   { 
    351       CArray<int,1> index(1) ; 
    352       for(int i=0; i<1 ; i++) index(0)=0 ; 
     353      CArray<int,1> index(n) ; 
     354      if (n==1) index(0)=0 ; 
    353355      localElement_ -> addView(CElementView::FULL, index) ; 
    354356   } 
     
    357359   { 
    358360      CArray<int,1> index ; 
    359       if (mask)  
     361      if (mask && n==1) 
    360362      { 
    361363        index.resize(1) ; 
     
    386388    CContext* context = CContext::getCurrent(); 
    387389    map<int, CArray<size_t,1>> globalIndex ; 
    388  
    389     int nbServer = client->serverSize; 
    390390    size_t nglo=1 ; 
    391     CArray<size_t,1> indGlo(nglo) ; 
    392     for(size_t i=0;i<nglo;i++) indGlo(i) = i ; 
    393     for (auto& rankServer : client->getRanksServerLeader()) globalIndex[rankServer].reference(indGlo.copy()) ;  
    394  
     391 
     392    if (type==EDistributionType::ROOT) // Bands distribution to send to file server 
     393    { 
     394      for (auto& rankServer : client->getRanksServerLeader()) 
     395      { 
     396        auto& globalInd =  globalIndex[rankServer] ; 
     397        if (rankServer==0)  
     398        { 
     399          globalInd.resize(1) ; 
     400          globalInd(0)=0 ; 
     401        } 
     402      } 
     403    } 
     404    else if (type==EDistributionType::NONE) // domain is not distributed ie all servers get the same local domain 
     405    { 
     406      int nbServer = client->serverSize; 
     407      CArray<size_t,1> indGlo(nglo) ; 
     408      for(size_t i=0;i<nglo;i++) indGlo(i) = i ; 
     409      for (auto& rankServer : client->getRanksServerLeader()) globalIndex[rankServer].reference(indGlo.copy()) ;  
     410    } 
    395411    remoteElement_[client] = new CDistributedElement(nglo, globalIndex) ; 
    396412    remoteElement_[client]->addFullView() ; 
     
    477493      // construct the local dimension and indexes 
    478494      auto& globalIndex=localElement_->getGlobalIndex() ; 
    479       int nk=globalIndex.numElements() ; 
     495      n=globalIndex.numElements() ; 
    480496      // no distribution for scalar => nk ==1 or maybe 0 ? 
    481497    } 
     
    504520    CContext* context = CContext::getCurrent(); 
    505521    localElement_->addView(CElementView::WORKFLOW, serverMask) ; 
    506     mask = serverMask(0) ; 
     522    if (serverMask.numElements()==1) mask = serverMask(0) ; 
    507523  
    508524    serverFromClientConnector_ = new CGathererConnector(elementFrom_->getView(CElementView::FULL), localElement_->getView(CElementView::WORKFLOW)) ; 
Note: See TracChangeset for help on using the changeset viewer.