Ignore:
Timestamp:
01/10/18 16:17:57 (6 years ago)
Author:
ymipsl
Message:

2 update for spatial tranformations :

  • One bug fix introduce in r1389 concerning domain interpolation or other distributed spatial distransfomation
  • Specific optimisation for transformation on element wich is not distributed across processes

This optimisation is experimental and will be activated only when using a variable in xios context :

<variable id="activate_non_distributed_transformation" type="bool">true</variable>

Later when more succesfull test, the variable use will removed...

YM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/XIOS_DEV_CMIP6/src/transformation/grid_transformation.cpp

    r1158 r1399  
    1616#include "grid.hpp" 
    1717#include <boost/unordered_map.hpp> 
     18#include "timer.hpp" 
    1819 
    1920namespace xios { 
     
    389390      // ComputeTransformation of global index of each element 
    390391      int elementPosition = it->first; 
    391       algo->computeGlobalSourceIndex(elementPosition, 
    392                                      gridSource_, 
    393                                      tmpGridDestination_, 
    394                                      globaIndexWeightFromSrcToDst); 
    395  
    396       // Compute transformation of global indexes among grids 
    397       computeTransformationMapping(globaIndexWeightFromSrcToDst); 
    398  
     392      bool nonDistributedActivated = CXios::getin<bool>("activate_non_distributed_transformation",false); 
     393       
     394      if (nonDistributedActivated && !algo->isDistributedTransformation(elementPositionInGrid, gridSource_, tmpGridDestination_) ) 
     395      { 
     396        vector<int> localSrc ; 
     397        vector<int> localDst ; 
     398        vector<double> weight ; 
     399        localMaskOnGridDest_.push_back(vector<bool>()) ; 
     400        CTimer::get("computeTransformationMappingNonDistributed").resume();   
     401        algo->computeTransformationMappingNonDistributed(elementPosition, gridSource_, tmpGridDestination_,  
     402                                                         localSrc, localDst, weight, localMaskOnGridDest_.back()) ; 
     403        CTimer::get("computeTransformationMappingNonDistributed").suspend();   
     404 
     405        CTimer::get("computeTransformationMappingConvert").resume();   
     406        nbLocalIndexOnGridDest_.push_back(localMaskOnGridDest_.back().size()) ; 
     407        int clientRank=client->clientRank ; 
     408        { 
     409          SendingIndexGridSourceMap tmp; 
     410          localIndexToSendFromGridSource_.push_back(tmp) ; 
     411          SendingIndexGridSourceMap& src=localIndexToSendFromGridSource_.back() ; 
     412          CArray<int,1> arrayTmp ; 
     413          src.insert( pair<int,CArray<int,1> >(clientRank,arrayTmp)) ; 
     414          CArray<int,1>& array=src[clientRank] ; 
     415          array.resize(localSrc.size()) ; 
     416          for(int i=0;i< localSrc.size();++i) array(i)=localSrc[i]  ;     
     417        } 
     418        { 
     419          RecvIndexGridDestinationMap tmp; 
     420          localIndexToReceiveOnGridDest_.push_back(tmp) ; 
     421          RecvIndexGridDestinationMap& dst=localIndexToReceiveOnGridDest_.back() ; 
     422          vector<pair<int,double> > vectTmp ; 
     423          dst.insert( pair<int,vector<pair<int,double> >  >(clientRank,vectTmp)) ; 
     424          vector<pair<int,double> >& vect=dst[clientRank] ; 
     425          vect.resize(localDst.size()) ; 
     426          for(int i=0;i< localDst.size();++i) vect[i]=pair<int,double>(localDst[i],weight[i])  ;       
     427        } 
     428        CTimer::get("computeTransformationMappingConvert").suspend();   
     429      } 
     430      else 
     431      { 
     432        CTimer::get("computeGlobalSourceIndex").resume();            
     433        algo->computeGlobalSourceIndex(elementPosition, 
     434                                       gridSource_, 
     435                                       tmpGridDestination_, 
     436                                       globaIndexWeightFromSrcToDst); 
     437                                      
     438        CTimer::get("computeGlobalSourceIndex").suspend();            
     439        CTimer::get("computeTransformationMapping").resume();      
     440        // Compute transformation of global indexes among grids 
     441        computeTransformationMapping(globaIndexWeightFromSrcToDst); 
     442        CTimer::get("computeTransformationMapping").suspend();  
     443      }  
    399444      if (1 < nbNormalAlgos_) 
    400445      { 
Note: See TracChangeset for help on using the changeset viewer.