Ignore:
Timestamp:
12/14/18 11:20:33 (5 years ago)
Author:
oabramkina
Message:

Bugfix for NEMO-like land processes elimination.

Values describing a domain (latitude, longitude, bounds,...) are set to -1 on land processes.

Location:
XIOS/branchs/xios-2.5/src/node
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • XIOS/branchs/xios-2.5/src/node/axis.cpp

    r1566 r1624  
    657657          connectedServerRank_[nbServer].push_back(client->clientRank % client->serverSize); 
    658658 
    659          nbSenders[nbServer] = CClientServerMapping::computeConnectedClients(client->serverSize, client->clientSize, client->intraComm, connectedServerRank_[nbServer]); 
     659        nbSenders[nbServer] = CClientServerMapping::computeConnectedClients(client->serverSize, client->clientSize, client->intraComm, connectedServerRank_[nbServer]); 
    660660 
    661661        delete clientServerMap; 
     
    703703        }                  
    704704      } 
     705 
     706//    localIndexToWriteOnServer.resize(writtenGlobalIndex.numElements()); 
     707//    nbWritten = 0; 
     708//    for (itSrv = itSrvb; itSrv != itSrve; ++itSrv) 
     709//    { 
     710//      indGlo = *itSrv; 
     711//      if (ite != globalLocalIndexMap_.find(indGlo)) 
     712//      { 
     713//        localIndexToWriteOnServer(nbWritten) = globalLocalIndexMap_[indGlo]; 
     714//      } 
     715//      else 
     716//      { 
     717//        localIndexToWriteOnServer(nbWritten) = -1; 
     718//      } 
     719//      ++nbWritten; 
     720//    } 
    705721 
    706722      localIndexToWriteOnServer.resize(writtenGlobalIndex.numElements()); 
     
    12931309         if (0 == globalLocalIndexMap_.count(gloInd)) 
    12941310         { 
    1295            index(nbIndLoc) = gloInd % n_glo;            
    1296            globalLocalIndexMap_[gloInd] = nbIndLoc;   
     1311           index(nbIndexGlob) = gloInd % n_glo; 
     1312           globalLocalIndexMap_[gloInd] = nbIndexGlob; 
     1313//           index(nbIndLoc) = gloInd % n_glo;  
     1314//           globalLocalIndexMap_[gloInd] = nbIndLoc;   
    12971315           ++nbIndexGlob; 
    12981316         }  
     
    13451363    } 
    13461364     
    1347     int nbCompressedData = 0;  
     1365    int nbCompressedData = 0; 
    13481366    for (idx = 0; idx < nonCompressedData.numElements(); ++idx) 
    13491367    { 
    13501368      if (0 <= nonCompressedData(idx)) 
    1351         ++nbCompressedData;         
     1369        ++nbCompressedData; 
    13521370    } 
    13531371 
     
    13591377      { 
    13601378        data_index(nbCompressedData) = idx % n; 
    1361         ++nbCompressedData;         
     1379        ++nbCompressedData; 
    13621380      } 
    13631381    } 
     
    14761494      clientsSet.insert(contextClient); 
    14771495    } 
    1478 } 
     1496  } 
    14791497 
    14801498  void CAxis::parse(xml::CXMLNode & node) 
  • XIOS/branchs/xios-2.5/src/node/axis.hpp

    r1371 r1624  
    124124 
    125125      public:  
    126         bool hasValue;         
    127         CArray<size_t,1> localIndexToWriteOnServer;         
     126        bool hasValue; 
     127        CArray<int,1> localIndexToWriteOnServer; 
    128128 
    129129      private: 
  • XIOS/branchs/xios-2.5/src/node/domain.cpp

    r1565 r1624  
    3333      , lonvalue(), latvalue(), bounds_lonvalue(), bounds_latvalue() 
    3434      , globalLocalIndexMap_(), computedWrittenIndex_(false) 
    35           , clients() 
     35      , clients() 
    3636   { 
    3737   } 
     
    4545      , lonvalue(), latvalue(), bounds_lonvalue(), bounds_latvalue() 
    4646      , globalLocalIndexMap_(), computedWrittenIndex_(false) 
    47           , clients() 
     47      , clients() 
    4848   { 
    4949    } 
     
    160160       // size estimation for sendIndex (and sendArea which is always smaller or equal) 
    161161       size_t sizeIndexEvent = 2 * sizeof(size_t) + 2 * CArray<int,1>::size(idxCount); 
    162        // if (isCompressible_) 
    163        // { 
    164        //   std::map<int, std::vector<int> >::const_iterator itWritten = indWrittenSrv_.find(rank); 
    165        //   size_t writtenIdxCount = (itWritten != itWrittenIndexEnd) ? itWritten->second.size() : 0; 
    166        //   sizeIndexEvent += CArray<int,1>::size(writtenIdxCount); 
    167        // } 
    168162 
    169163       // size estimation for sendLonLat 
     
    184178   bool CDomain::isEmpty(void) const 
    185179   { 
    186       return ((this->zoom_i_index.isEmpty()) || (0 == this->zoom_i_index.numElements())); 
    187  
     180     return ((this->i_index.isEmpty()) || (0 == this->i_index.numElements())); 
    188181   } 
    189182 
     
    14551448               << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " 
    14561449               << "'bounds_lon_1d' dimension is not compatible with 'nvertex'." << std::endl 
    1457                << "'bounds_lon_1d' dimension is " << bounds_lon_1d.extent(1) 
     1450               << "'bounds_lon_1d' dimension is " << bounds_lon_1d.extent(0) 
    14581451               << " but nvertex is " << nvertex.getValue() << "."); 
    14591452 
     
    14621455               << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " 
    14631456               << "'bounds_lon_2d' dimension is not compatible with 'nvertex'." << std::endl 
    1464                << "'bounds_lon_2d' dimension is " << bounds_lon_2d.extent(2) 
     1457               << "'bounds_lon_2d' dimension is " << bounds_lon_2d.extent(0) 
    14651458               << " but nvertex is " << nvertex.getValue() << "."); 
    14661459 
     
    14791472               << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " 
    14801473               << "'bounds_lat_1d' dimension is not compatible with 'nvertex'." << std::endl 
    1481                << "'bounds_lat_1d' dimension is " << bounds_lat_1d.extent(1) 
     1474               << "'bounds_lat_1d' dimension is " << bounds_lat_1d.extent(0) 
    14821475               << " but nvertex is " << nvertex.getValue() << "."); 
    14831476 
     
    14861479               << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " 
    14871480               << "'bounds_lat_2d' dimension is not compatible with 'nvertex'." << std::endl 
    1488                << "'bounds_lat_2d' dimension is " << bounds_lat_2d.extent(2) 
     1481               << "'bounds_lat_2d' dimension is " << bounds_lat_2d.extent(0) 
    14891482               << " but nvertex is " << nvertex.getValue() << "."); 
    14901483 
     
    19011894                                       itSrve = writtenGlobalIndex.end(), itSrv; 
    19021895 
    1903 //      for (itSrv = itSrvb; itSrv != itSrve; ++itSrv) 
    1904 //      { 
    1905 //        indGlo = *itSrv; 
    1906 //        if (ite != globalLocalIndexMap_.find(indGlo)) 
    1907 //        { 
    1908 //          ++nbWritten; 
    1909 //        } 
    1910 //      } 
    1911  
    1912 //      localIndexToWriteOnServer.resize(nbWritten); 
    19131896      localIndexToWriteOnServer.resize(writtenGlobalIndex.numElements()); 
    1914  
    19151897      nbWritten = 0; 
    19161898      for (itSrv = itSrvb; itSrv != itSrve; ++itSrv) 
     
    19201902        { 
    19211903          localIndexToWriteOnServer(nbWritten) = globalLocalIndexMap_[indGlo]; 
    1922           ++nbWritten; 
    19231904        } 
    19241905        else 
    19251906        { 
    1926           localIndexToWriteOnServer(nbWritten) = 0; 
    1927           ++nbWritten; 
    1928         } 
    1929       } 
    1930        
    1931       // if (isCompressible()) 
    1932       // { 
    1933       //   nbWritten = 0; 
    1934       //   boost::unordered_map<size_t,size_t> localGlobalIndexMap; 
    1935       //   for (itSrv = itSrvb; itSrv != itSrve; ++itSrv) 
    1936       //   { 
    1937       //     indGlo = *itSrv; 
    1938       //     if (ite != globalLocalIndexMap_.find(indGlo)) 
    1939       //     { 
    1940       //       localGlobalIndexMap[localIndexToWriteOnServer(nbWritten)] = indGlo; 
    1941       //       ++nbWritten; 
    1942       //     }                  
    1943       //   } 
    1944  
    1945       //   nbWritten = 0; 
    1946       //   for (int idx = 0; idx < data_i_index.numElements(); ++idx) 
    1947       //   { 
    1948       //     if (localGlobalIndexMap.end() != localGlobalIndexMap.find(data_i_index(idx))) 
    1949       //     { 
    1950       //       ++nbWritten; 
    1951       //     } 
    1952       //   } 
    1953  
    1954       //   compressedIndexToWriteOnServer.resize(nbWritten); 
    1955       //   nbWritten = 0; 
    1956       //   for (int idx = 0; idx < data_i_index.numElements(); ++idx) 
    1957       //   { 
    1958       //     if (localGlobalIndexMap.end() != localGlobalIndexMap.find(data_i_index(idx))) 
    1959       //     { 
    1960       //       compressedIndexToWriteOnServer(nbWritten) = localGlobalIndexMap[data_i_index(idx)]; 
    1961       //       ++nbWritten; 
    1962       //     } 
    1963       //   } 
    1964  
    1965       //   numberWrittenIndexes_ = nbWritten; 
    1966       //   if (isDistributed()) 
    1967       //   {             
    1968       //     MPI_Allreduce(&numberWrittenIndexes_, &totalNumberWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm); 
    1969       //     MPI_Scan(&numberWrittenIndexes_, &offsetWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm); 
    1970       //     offsetWrittenIndexes_ -= numberWrittenIndexes_; 
    1971       //   } 
    1972       //   else 
    1973       //     totalNumberWrittenIndexes_ = numberWrittenIndexes_; 
    1974       // }       
     1907          localIndexToWriteOnServer(nbWritten) = -1; 
     1908        } 
     1909        ++nbWritten; 
     1910      } 
    19751911   } 
    19761912 
     
    25102446     
    25112447    globalLocalIndexMap_.rehash(std::ceil(nbIndGlob/globalLocalIndexMap_.max_load_factor())); 
    2512     i_index.resize(nbIndGlob); 
    2513     j_index.resize(nbIndGlob);    
     2448//    i_index.resize(nbIndGlob); 
     2449//    j_index.resize(nbIndGlob); 
     2450    i_index.resize(ni*nj); 
     2451    j_index.resize(ni*nj); 
     2452    i_index = -1; 
     2453    j_index = -1; 
    25142454    int nbIndexGlobMax = nbIndGlob, nbIndLoc; 
    25152455 
     
    25282468           jIndex = (jIndex < 0) ? 0 : jIndex; 
    25292469           nbIndLoc = iIndex + ni * jIndex; 
    2530            if (nbIndLoc < nbIndexGlobMax) 
    2531            { 
    2532              i_index(nbIndLoc) = index % ni_glo; 
    2533              j_index(nbIndLoc) = index / ni_glo; 
    2534              globalLocalIndexMap_[index] = nbIndLoc;   
    2535              ++nbIndGlob; 
    2536            } 
    2537            // i_index(nbIndGlob) = index % ni_glo; 
    2538            // j_index(nbIndGlob) = index / ni_glo; 
    2539            // globalLocalIndexMap_[index] = nbIndGlob;   
    2540            // ++nbIndGlob; 
     2470           i_index(nbIndLoc) = index % ni_glo; 
     2471           j_index(nbIndLoc) = index / ni_glo; 
     2472           globalLocalIndexMap_[index] = nbIndLoc; 
     2473//           i_index(nbIndGlob) = index % ni_glo; 
     2474//           j_index(nbIndGlob) = index / ni_glo; 
     2475//           globalLocalIndexMap_[index] = nbIndGlob; 
     2476           ++nbIndGlob; 
     2477//           if (nbIndLoc < nbIndexGlobMax) 
     2478//          { 
     2479//             i_index(nbIndLoc) = index % ni_glo; 
     2480//             j_index(nbIndLoc) = index / ni_glo; 
     2481//             globalLocalIndexMap_[index] = nbIndLoc;   
     2482//             ++nbIndGlob; 
     2483//           } 
     2484//           // i_index(nbIndGlob) = index % ni_glo; 
     2485//           // j_index(nbIndGlob) = index / ni_glo; 
     2486//           // globalLocalIndexMap_[index] = nbIndGlob;   
     2487//           // ++nbIndGlob; 
    25412488         }  
    25422489      }  
    25432490    }  
    25442491 
    2545     if (nbIndGlob==0) 
    2546     { 
    2547       i_index.resize(nbIndGlob); 
    2548       j_index.resize(nbIndGlob); 
    2549     } 
    2550     else 
    2551     { 
    2552       i_index.resizeAndPreserve(nbIndGlob); 
    2553       j_index.resizeAndPreserve(nbIndGlob); 
    2554     } 
     2492//    if (nbIndGlob==0) 
     2493//    { 
     2494//      i_index.resize(nbIndGlob); 
     2495//      j_index.resize(nbIndGlob); 
     2496//    } 
     2497//    else 
     2498//    { 
     2499//      i_index.resizeAndPreserve(nbIndGlob); 
     2500//      j_index.resizeAndPreserve(nbIndGlob); 
     2501//    } 
    25552502  } 
    25562503 
     
    26612608 
    26622609    nbMaskInd = globalLocalIndexMap_.size(); 
    2663     mask_1d.resize(nbMaskInd); 
    2664     domainMask.resize(nbMaskInd); 
     2610//    mask_1d.resize(nbMaskInd); 
     2611//    domainMask.resize(nbMaskInd); 
     2612    mask_1d.resize(ni*nj); 
     2613    domainMask.resize(ni*nj); 
    26652614    mask_1d = false; 
    26662615     
     
    27372686 
    27382687      nbLonInd = globalLocalIndexMap_.size(); 
    2739       lonvalue.resize(nbLonInd); 
     2688//      lonvalue.resize(nbLonInd); 
     2689      lonvalue.resize(ni*nj); 
     2690      lonvalue = -1.0; 
    27402691      if (hasBounds) 
    27412692      { 
    2742         bounds_lonvalue.resize(nvertex,nbLonInd); 
    2743         bounds_lonvalue = 0.; 
     2693//        bounds_lonvalue.resize(nvertex,nbLonInd); 
     2694//        bounds_lonvalue = 0.; 
     2695        bounds_lonvalue.resize(nvertex,ni*nj); 
     2696        bounds_lonvalue = -1.0; 
    27442697      } 
    27452698 
     
    28212774 
    28222775      nbLatInd = globalLocalIndexMap_.size(); 
    2823       latvalue.resize(nbLatInd); 
     2776//      latvalue.resize(nbLatInd); 
     2777      latvalue.resize(ni*nj); 
    28242778      if (hasBounds) 
    28252779      { 
    2826         bounds_latvalue.resize(nvertex,nbLatInd); 
    2827         bounds_latvalue = 0. ; 
     2780//        bounds_latvalue.resize(nvertex,nbLatInd); 
     2781//        bounds_latvalue = 0. ; 
     2782        bounds_latvalue.resize(nvertex,ni*nj); 
     2783        bounds_latvalue = -1. ; 
    28282784      } 
    28292785 
     
    29032859 
    29042860      nbAreaInd = globalLocalIndexMap_.size(); 
    2905       areavalue.resize(nbAreaInd); 
    2906       nbAreaInd = 0;       
     2861//      areavalue.resize(nbAreaInd); 
     2862//      nbAreaInd = 0; 
     2863      areavalue.resize(ni*nj); 
     2864      nbAreaInd = -1.0; 
    29072865      for (i = 0; i < nbReceived; ++i) 
    29082866      { 
     
    30152973         dataIIndex(lInd) = (-1 == dataIIndex(lInd)) ? tmpI(ind) : dataIIndex(lInd); // Only fill in dataIndex if there is no data 
    30162974         dataJIndex(lInd) = (-1 == dataJIndex(lInd)) ? tmpJ(ind) : dataJIndex(lInd);   
    3017  
    3018          if (!domainMask(lInd))   // Include mask info into data index on the RECEIVE getServerDimensionSizes     
    3019          { 
    3020            dataIIndex(lInd) = dataJIndex(lInd) = -1; 
    3021          } 
    30222975      }  
    30232976    } 
  • XIOS/branchs/xios-2.5/src/node/domain.hpp

    r1353 r1624  
    142142         CArray<double, 1> areavalue; 
    143143 
    144          CArray<size_t,1> localIndexToWriteOnServer;          
     144         CArray<int,1> localIndexToWriteOnServer; 
    145145 
    146146         CArray<bool, 1> domainMask; // mask_1d, mask_2d -> domainMask 
  • XIOS/branchs/xios-2.5/src/node/grid.cpp

    r1397 r1624  
    978978 
    979979     nbIndexOnServer = 0; 
    980      for (size_t j = 0; j < globalIndexElementOnServerMap.size(); ++j) 
     980//     for (size_t j = 0; j < globalIndexElementOnServerMap.size(); ++j) 
     981     for (size_t j = 0; j < globalIndexElementOnClient.numElements(); ++j) 
    981982     { 
    982983       it = globalIndexElementOnServerMap.find(globalIndexElementOnClient(j)); 
     
    13051306  { 
    13061307    CContext* context = CContext::getCurrent();     
    1307 //    int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 1) : 1; // This should be changed soon 
    1308 //    for (int p = 0; p < nbSrvPools; ++p) 
    1309     { 
    1310 //      CContextClient* client = (context->hasServer) ? (context->hasClient ? context->clientPrimServer[p] : context->client) 
    1311 //                                                    : context->client; 
     1308    { 
    13121309      CContextClient* client = context->client; 
    13131310 
Note: See TracChangeset for help on using the changeset viewer.