Changeset 1173


Ignore:
Timestamp:
06/19/17 16:00:48 (7 years ago)
Author:
mhnguyen
Message:

Fixing bug: Overlapped domains behave incorrectly

+) If local domains are overlapping on client, the re-constructed domain on server must take care of this overlapped region

Test
+) On Curie
+) test_client, test_complete work
+) Need to test with models

Location:
XIOS/dev/dev_olga
Files:
2 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_olga/inputs/COMPLETE/context_surface.xml

    r562 r1173  
    3232    </file> 
    3333 
    34     <file type="one_file" id="output_surface_1d" name="output_surface_1d" output_freq="1d"> 
    35       <field field_ref="field_A_srf"> 
     34    <file type="one_file" id="output_surface_1d" name="output_surface_1d" output_freq="1d" enabled="TRUE"> 
     35      <field field_ref="field_A_srf" indexed_output="TRUE"> 
    3636        <variable id="my_attribute1" type="string">surf_att</variable> 
    3737        <variable id="my_attribute2" type="int">10</variable> 
  • XIOS/dev/dev_olga/src/node/domain.cpp

    r1158 r1173  
    24632463    } 
    24642464     
     2465    globalLocalIndexMap_.rehash(std::ceil(nbIndGlob/globalLocalIndexMap_.max_load_factor())); 
    24652466    i_index.resize(nbIndGlob); 
    2466     j_index.resize(nbIndGlob); 
    2467  
    2468     globalLocalIndexMap_.rehash(std::ceil(nbIndGlob/globalLocalIndexMap_.max_load_factor())); 
     2467    j_index.resize(nbIndGlob);     
    24692468    nbIndGlob = 0; 
    24702469    for (i = 0; i < nbReceived; ++i) 
     
    24742473      { 
    24752474         index = tmp(ind); 
    2476          i_index(nbIndGlob) = index % ni_glo; 
    2477          j_index(nbIndGlob) = index / ni_glo; 
    2478          globalLocalIndexMap_[index] = nbIndGlob;   
    2479          ++nbIndGlob; 
     2475         if (0 == globalLocalIndexMap_.count(index)) 
     2476         { 
     2477           i_index(nbIndGlob) = index % ni_glo; 
     2478           j_index(nbIndGlob) = index / ni_glo; 
     2479           globalLocalIndexMap_[index] = nbIndGlob;   
     2480           ++nbIndGlob; 
     2481         }  
    24802482      }  
    24812483    }  
     2484 
     2485    i_index.resizeAndPreserve(nbIndGlob); 
     2486    j_index.resizeAndPreserve(nbIndGlob); 
    24822487  } 
    24832488 
     
    26302635  void CDomain::recvMask(std::map<int, CBufferIn*>& rankBuffers) 
    26312636  { 
    2632     int nbReceived = rankBuffers.size(), i, ind, index; 
     2637    int nbReceived = rankBuffers.size(), i, ind, index, lInd; 
    26332638    if (nbReceived != recvClientRanks_.size()) 
    2634       ERROR("void CDomain::recvArea(std::map<int, CBufferIn*>& rankBuffers)", 
     2639      ERROR("void CDomain::recvMask(std::map<int, CBufferIn*>& rankBuffers)", 
    26352640           << "The number of sending clients is not correct." 
    26362641           << "Expected number: " << recvClientRanks_.size() << " but received " << nbReceived); 
     
    26502655    } 
    26512656   
     2657    if (nbMaskInd != globalLocalIndexMap_.size()) 
     2658      info (0) << "If the domain " << this->getDomainOutputName() <<" does not have overlapped region between processes." 
     2659               << "Something shouble be wrong with mask index "<< std::endl; 
     2660 
     2661    nbMaskInd = globalLocalIndexMap_.size(); 
    26522662    mask_1d.resize(nbMaskInd); 
    2653     nbMaskInd = 0; 
     2663     
    26542664    for (i = 0; i < nbReceived; ++i) 
    26552665    { 
     2666      CArray<int,1>& tmpInd = indGlob_[recvClientRanks_[i]]; 
    26562667      CArray<bool,1>& tmp = recvMaskValue[i]; 
    26572668      for (ind = 0; ind < tmp.numElements(); ++ind) 
    26582669      { 
    2659         mask_1d(nbMaskInd) = tmp(ind);       
    2660         ++nbMaskInd; 
     2670        lInd = globalLocalIndexMap_[size_t(tmpInd(ind))]; 
     2671        mask_1d(lInd) = tmp(ind); 
    26612672      } 
    26622673    }     
     
    27172728     
    27182729      if (nbLonInd != globalLocalIndexMap_.size()) 
    2719         info (0) << "Something wrong with longitude index "<< std::endl; 
    2720  
     2730        info (0) << "If the domain " << this->getDomainOutputName() <<" does not have overlapped region between processes." 
     2731                 << "Something shouble be wrong with longitude index "<< std::endl; 
     2732 
     2733      nbLonInd = globalLocalIndexMap_.size(); 
    27212734      lonvalue.resize(nbLonInd); 
    27222735      if (hasBounds) 
     
    27992812     
    28002813      if (nbLatInd != globalLocalIndexMap_.size()) 
    2801         info (0) << "Something wrong with latitude index "<< std::endl; 
    2802  
     2814        info (0) << "If the domain " << this->getDomainOutputName() <<" does not have overlapped region between processes." 
     2815                << "Something shouble be wrong with latitude index "<< std::endl; 
     2816 
     2817      nbLatInd = globalLocalIndexMap_.size(); 
    28032818      latvalue.resize(nbLatInd); 
    28042819      if (hasBounds) 
     
    28702885    } 
    28712886 
    2872     int nbAreaInd = 0; 
    2873     for (i = 0; i < nbReceived; ++i) 
    2874     {       
    2875       nbAreaInd += recvAreaValue[i].numElements(); 
    2876     } 
    2877    
    2878     if (nbAreaInd != globalLocalIndexMap_.size()) 
    2879       info (0) << "Something wrong with latitude index "<< std::endl; 
    2880  
    28812887    if (hasArea) 
    28822888    { 
     2889      int nbAreaInd = 0; 
     2890      for (i = 0; i < nbReceived; ++i) 
     2891      {       
     2892        nbAreaInd += recvAreaValue[i].numElements(); 
     2893      } 
     2894 
     2895      if (nbAreaInd != globalLocalIndexMap_.size()) 
     2896        info (0) << "If the domain " << this->getDomainOutputName() <<" does not have overlapped region between processes." 
     2897                 << "Something shouble be wrong with area index "<< std::endl; 
     2898 
     2899      nbAreaInd = globalLocalIndexMap_.size(); 
    28832900      areavalue.resize(nbAreaInd); 
    28842901      nbAreaInd = 0;       
     
    29883005      { 
    29893006         lInd = globalLocalIndexMap_[size_t(tmpInd(ind))]; 
    2990          dataIIndex(lInd) = tmpI(ind); 
    2991          dataJIndex(lInd) = tmpJ(ind);          
     3007         dataIIndex(lInd) = (-1 == dataIIndex(lInd)) ? tmpI(ind) : dataIIndex(lInd); // Only fill in dataIndex if there is no data 
     3008         dataJIndex(lInd) = (-1 == dataJIndex(lInd)) ? tmpJ(ind) : dataJIndex(lInd);          
    29923009      }  
    29933010    } 
  • XIOS/dev/dev_olga/src/transformation/domain_algorithm_interpolate.cpp

    r1158 r1173  
    388388  } 
    389389 
    390   if (writeToFile_ && !readFromFile_) 
    391      writeRemapInfo(interpMapValue); 
    392   exchangeRemapInfo(interpMapValue); 
     390  if (writeToFile_ && !readFromFile_) writeRemapInfo(interpMapValue); 
     391//  exchangeRemapInfo(interpMapValue); 
     392  convertRemapInfo(interpMapValue) ; 
    393393 
    394394  delete [] globalSrc; 
     
    494494} 
    495495 
     496void CDomainAlgorithmInterpolate::convertRemapInfo(std::map<int,std::vector<std::pair<int,double> > >& interpMapValue) 
     497{ 
     498  CContext* context = CContext::getCurrent(); 
     499  CContextClient* client=context->client; 
     500  int clientRank = client->clientRank; 
     501 
     502  this->transformationMapping_.resize(1); 
     503  this->transformationWeight_.resize(1); 
     504 
     505  TransformationIndexMap& transMap = this->transformationMapping_[0]; 
     506  TransformationWeightMap& transWeight = this->transformationWeight_[0]; 
     507 
     508  std::map<int,std::vector<std::pair<int,double> > >::const_iterator itb = interpMapValue.begin(), it, 
     509                                                                     ite = interpMapValue.end(); 
     510   
     511  for (it = itb; it != ite; ++it) 
     512  {     
     513    const std::vector<std::pair<int,double> >& tmp = it->second; 
     514    for (int i = 0; i < tmp.size(); ++i) 
     515    { 
     516      transMap[it->first].push_back(tmp[i].first); 
     517      transWeight[it->first].push_back(tmp[i].second); 
     518    }       
     519  }       
     520} 
    496521 
    497522/*! 
  • XIOS/dev/dev_olga/src/transformation/domain_algorithm_interpolate.hpp

    r1158 r1173  
    4444  void writeRemapInfo(std::map<int,std::vector<std::pair<int,double> > >&); 
    4545  void exchangeRemapInfo(std::map<int,std::vector<std::pair<int,double> > >& interpMapValue); 
     46  void convertRemapInfo(std::map<int,std::vector<std::pair<int,double> > >& interpMapValue); 
    4647 
    4748private: 
  • XIOS/dev/dev_olga/src/transformation/generic_algorithm_transformation.cpp

    r1158 r1173  
    4545      { 
    4646        dataOut(localIndex[idx].first) += *(dataInput + idx) * localIndex[idx].second; 
    47       } 
    48     } 
    49  
    50     // for (int idx = 0; idx < nbLocalIndex; ++idx) 
    51     // { 
    52     //   if (!flagInitial[localIndex[idx].first]) 
    53     //     dataOut(localIndex[idx].first) = defaultValue; 
    54     // } 
     47        flagInitial[localIndex[idx].first] = true; // Reset flag to indicate not all data source are nan 
     48      } 
     49    } 
     50 
     51    for (int idx = 0; idx < nbLocalIndex; ++idx) 
     52    { 
     53      if (!flagInitial[localIndex[idx].first]) 
     54        dataOut(localIndex[idx].first) = defaultValue; 
     55    } 
    5556  } 
    5657  else 
Note: See TracChangeset for help on using the changeset viewer.