Changeset 988 for XIOS/trunk


Ignore:
Timestamp:
11/16/16 14:53:16 (7 years ago)
Author:
mhnguyen
Message:

Correcting a bug on reading non-distributed data in server mode.

+) Non distributed data read by all servers then transfered back to ALL clients

Test
+) On Curie
+) Work

Location:
XIOS/trunk/src
Files:
6 edited

Legend:

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

    r917 r988  
    5050        for (int i = 0; i < serverByClient; i++) 
    5151          ranksServerLeader.push_back(rankStart + i); 
     52 
     53        ranksServerNotLeader.resize(0); 
    5254      } 
    5355      else 
     
    6062          if (clientRank % (clientByServer + 1) == 0) 
    6163            ranksServerLeader.push_back(clientRank / (clientByServer + 1)); 
     64          else 
     65            ranksServerNotLeader.push_back(clientRank / (clientByServer + 1)); 
    6266        } 
    6367        else 
     
    6670          if (rank % clientByServer == 0) 
    6771            ranksServerLeader.push_back(remain + rank / clientByServer); 
    68         } 
     72          else 
     73            ranksServerNotLeader.push_back(remain + rank / clientByServer); 
     74        }         
    6975      } 
    7076 
     
    249255  \return ranks of leading servers 
    250256  */ 
     257  const std::list<int>& CContextClient::getRanksServerNotLeader(void) const 
     258  { 
     259    return ranksServerNotLeader; 
     260  } 
     261 
     262  /*! 
     263  Check if client connects to leading server 
     264  \return connected(true), not connected (false) 
     265  */ 
     266  bool CContextClient::isServerNotLeader(void) const 
     267  { 
     268    return !ranksServerNotLeader.empty(); 
     269  } 
     270 
     271  /*! 
     272  Get leading server in the group of connected server 
     273  \return ranks of leading servers 
     274  */ 
    251275  const std::list<int>& CContextClient::getRanksServerLeader(void) const 
    252276  { 
  • XIOS/trunk/src/context_client.hpp

    r917 r988  
    4141 
    4242      bool isServerLeader(void) const; 
     43      bool isServerNotLeader(void) const; 
    4344      const std::list<int>& getRanksServerLeader(void) const; 
     45      const std::list<int>& getRanksServerNotLeader(void) const; 
    4446 
    4547      bool isAttachedModeEnabled() const; 
     
    8082      std::list<int> ranksServerLeader; 
    8183 
     84      //! List of server ranks for which the client is not leader 
     85      std::list<int> ranksServerNotLeader; 
     86 
    8287    public: // Some function should be removed in the future 
    8388      //    void registerEvent(CEventClient& event); 
  • XIOS/trunk/src/filter/source_filter.cpp

    r932 r988  
    4848    packet->status = CDataPacket::NO_ERROR; 
    4949 
    50     if (data.size() != grid->storeIndex_toSrv.size()) 
     50    // if (data.size() != grid->storeIndex_toSrv.size()) 
     51    if (data.size() != grid->storeIndex_fromSrv.size()) 
    5152      ERROR("CSourceFilter::streamDataFromServer(CDate date, const std::map<int, CArray<double, 1> >& data)", 
    5253            << "Incoherent data received from servers," 
    53             << " expected " << grid->storeIndex_toSrv.size() << " chunks but " << data.size() << " were given."); 
     54            << " expected " << grid->storeIndex_fromSrv.size() << " chunks but " << data.size() << " were given."); 
    5455 
    5556    packet->data.resize(grid->storeIndex_client.numElements()); 
     
    5758    for (it = data.begin(); it != itEnd; it++) 
    5859    { 
    59       CArray<int,1>& index = grid->storeIndex_toSrv[it->first]; 
    60  
     60      // CArray<int,1>& index = grid->storeIndex_toSrv[it->first]; 
     61      CArray<int,1>& index = grid->storeIndex_fromSrv[it->first]; 
    6162      for (int n = 0; n < index.numElements(); n++) 
    6263        packet->data(index(n)) = it->second(n); 
  • XIOS/trunk/src/node/field.cpp

    r967 r988  
    310310 
    311311    map<int, CArray<double,1> >::iterator it; 
    312     for (it = data_srv.begin(); it != data_srv.end(); it++) 
    313     { 
    314       msgs.push_back(CMessage()); 
    315       CMessage& msg = msgs.back(); 
    316       msg << getId(); 
    317       if (hasData) 
    318         msg << getNStep() - 1 << it->second; 
    319       else 
    320         msg << int(-1); 
    321       event.push(it->first, grid->nbSenders[it->first], msg); 
    322     } 
    323     client->sendEvent(event); 
     312    if (!grid->doGridHaveDataDistributed()) 
     313    { 
     314       if (client->isServerLeader()) 
     315       { 
     316          if (!data_srv.empty()) 
     317          { 
     318            it = data_srv.begin(); 
     319            const std::list<int>& ranks = client->getRanksServerLeader(); 
     320            for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 
     321            { 
     322              msgs.push_back(CMessage()); 
     323              CMessage& msg = msgs.back(); 
     324              msg << getId(); 
     325              if (hasData) 
     326                msg << getNStep() - 1 << it->second; 
     327              else 
     328                msg << int(-1); 
     329              event.push(*itRank, 1, msg); 
     330            } 
     331          } 
     332          client->sendEvent(event); 
     333       }  
     334       else  
     335       { 
     336          // if (!data_srv.empty()) 
     337          // { 
     338          //   it = data_srv.begin(); 
     339          //   const std::list<int>& ranks = client->getRanksServerNotLeader(); 
     340          //   for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 
     341          //   { 
     342          //     msgs.push_back(CMessage()); 
     343          //     CMessage& msg = msgs.back(); 
     344          //     msg << getId(); 
     345          //     if (hasData) 
     346          //       msg << getNStep() - 1 << it->second; 
     347          //     else 
     348          //       msg << int(-1); 
     349          //     event.push(*itRank, 1, msg); 
     350          //   } 
     351          // } 
     352          client->sendEvent(event); 
     353       } 
     354    } 
     355    else 
     356    { 
     357      for (it = data_srv.begin(); it != data_srv.end(); it++) 
     358      { 
     359        msgs.push_back(CMessage()); 
     360        CMessage& msg = msgs.back(); 
     361        msg << getId(); 
     362        if (hasData) 
     363          msg << getNStep() - 1 << it->second; 
     364        else 
     365          msg << int(-1); 
     366        event.push(it->first, grid->nbSenders[it->first], msg); 
     367      } 
     368      client->sendEvent(event); 
     369    } 
    324370  } 
    325371 
  • XIOS/trunk/src/node/grid.cpp

    r968 r988  
    10441044        int rank = *itRank; 
    10451045        int nb = 1; 
    1046         storeIndex_toSrv.insert(std::make_pair(rank, CArray<int,1>(nb))); 
     1046        storeIndex_toSrv.insert(std::make_pair(rank, CArray<int,1>(nb)));         
    10471047        listOutIndex.push_back(CArray<size_t,1>(nb)); 
    10481048 
     
    10561056        } 
    10571057 
     1058        storeIndex_fromSrv.insert(std::make_pair(rank, CArray<int,1>(outLocalIndexToServer))); 
    10581059        listMsg.push_back(CMessage()); 
    10591060        listMsg.back() << getId( )<< isDataDistributed_ << isCompressible_ << listOutIndex.back(); 
     
    10641065    } 
    10651066    else 
     1067    { 
     1068      const std::list<int>& ranks = client->getRanksServerNotLeader(); 
     1069      for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 
     1070      { 
     1071        int rank = *itRank; 
     1072        int nb = 1;         
     1073        storeIndex_fromSrv.insert(std::make_pair(rank, CArray<int,1>(nb))); 
     1074        CArray<int, 1>& outLocalIndexToServer = storeIndex_fromSrv[rank]; 
     1075        for (int k = 0; k < nb; ++k) 
     1076        {           
     1077          outLocalIndexToServer(k)  = 0; 
     1078        } 
     1079      } 
    10661080      client->sendEvent(event); 
     1081    } 
    10671082  } 
    10681083 
     
    10921107          outLocalIndexToServer(idx) = itIndex->second; 
    10931108        } 
    1094  
    1095         //int nbClient = client->clientSize; // This stupid variable signals the servers the number of client connect to them 
     1109         
    10961110        const std::list<int>& ranks = client->getRanksServerLeader(); 
    10971111        for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 
    10981112        { 
    10991113          storeIndex_toSrv.insert(std::make_pair(*itRank, CArray<int,1>(outLocalIndexToServer))); 
     1114          storeIndex_fromSrv.insert(std::make_pair(*itRank, CArray<int,1>(outLocalIndexToServer))); 
    11001115          listOutIndex.push_back(CArray<size_t,1>(outGlobalIndexOnServer)); 
    11011116 
     
    11071122        client->sendEvent(event); 
    11081123      } 
    1109       else 
     1124      else  
     1125      { 
     1126        int indexSize = globalLocalIndexSendToServer.size();         
     1127        CArray<int,1> outLocalIndexToServer(indexSize); 
     1128        for (int idx = 0; itIndex != iteIndex; ++itIndex, ++idx) 
     1129        {           
     1130          outLocalIndexToServer(idx) = itIndex->second; 
     1131        } 
     1132         
     1133        const std::list<int>& ranks = client->getRanksServerNotLeader(); 
     1134        for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 
     1135        {           
     1136          storeIndex_fromSrv.insert(std::make_pair(*itRank, CArray<int,1>(outLocalIndexToServer))); 
     1137        } 
    11101138        client->sendEvent(event); 
     1139      } 
    11111140    } 
    11121141    else 
     
    11411170          nb = globalIndexTmp[rank].size(); 
    11421171 
    1143         storeIndex_toSrv.insert(make_pair(rank, CArray<int,1>(nb))); 
     1172        storeIndex_toSrv.insert(make_pair(rank, CArray<int,1>(nb)));         
    11441173        listOutIndex.push_back(CArray<size_t,1>(nb)); 
    11451174 
     
    11531182        } 
    11541183 
     1184        storeIndex_fromSrv.insert(make_pair(rank, CArray<int,1>(outLocalIndexToServer))); 
    11551185        listMsg.push_back(CMessage()); 
    11561186        listMsg.back() << getId() << isDataDistributed_ << isCompressible_ << listOutIndex.back(); 
  • XIOS/trunk/src/node/grid.hpp

    r976 r988  
    221221 
    222222         map<int, CArray<int, 1> > storeIndex_toSrv; 
     223         map<int, CArray<int, 1> > storeIndex_fromSrv; 
    223224         map<int,int> nbSenders; 
    224225 
Note: See TracChangeset for help on using the changeset viewer.