Changeset 1017


Ignore:
Timestamp:
01/09/17 14:58:44 (5 years ago)
Author:
rlacroix
Message:

Inputs: Avoid sending requests for next record if we know EOF has already been reached.

Location:
XIOS/trunk/src/node
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/node/field.cpp

    r1013 r1017  
    3939      , hasTimeCentered(false) 
    4040      , wasDataAlreadyReceivedFromServer(false) 
     41      , isEOF(false) 
    4142   { setVirtualVariableGroup(CVariableGroup::create(getId() + "_virtual_variable_group")); } 
    4243 
     
    5253      , hasTimeCentered(false) 
    5354      , wasDataAlreadyReceivedFromServer(false) 
     55      , isEOF(false) 
    5456   { setVirtualVariableGroup(CVariableGroup::create(getId() + "_virtual_variable_group")); } 
    5557 
     
    251253  } 
    252254 
    253   void CField::sendReadDataRequest(const CDate& tsDataRequested) 
     255  bool CField::sendReadDataRequest(const CDate& tsDataRequested) 
    254256  { 
    255257    CContext* context = CContext::getCurrent(); 
     
    258260    lastDataRequestedFromServer = tsDataRequested; 
    259261 
    260     CEventClient event(getType(), EVENT_ID_READ_DATA); 
    261     if (client->isServerLeader()) 
    262     { 
    263       CMessage msg; 
    264       msg << getId(); 
    265       const std::list<int>& ranks = client->getRanksServerLeader(); 
    266       for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 
    267         event.push(*itRank, 1, msg); 
    268       client->sendEvent(event); 
    269     } 
    270     else client->sendEvent(event); 
     262    if (!isEOF) // No need to send the request if we already know we are at EOF 
     263    { 
     264      CEventClient event(getType(), EVENT_ID_READ_DATA); 
     265      if (client->isServerLeader()) 
     266      { 
     267        CMessage msg; 
     268        msg << getId(); 
     269        const std::list<int>& ranks = client->getRanksServerLeader(); 
     270        for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 
     271          event.push(*itRank, 1, msg); 
     272        client->sendEvent(event); 
     273      } 
     274      else client->sendEvent(event); 
     275    } 
     276    else 
     277      serverSourceFilter->signalEndOfStream(tsDataRequested); 
     278 
     279    return !isEOF; 
    271280  } 
    272281 
     
    288297      info(20) << "lastDataRequestedFromServer + file->output_freq.getValue() : " << lastDataRequestedFromServer + file->output_freq << endl ; 
    289298 
    290       sendReadDataRequest(lastDataRequestedFromServer + file->output_freq); 
    291  
    292       dataRequested = true; 
     299      dataRequested |= sendReadDataRequest(lastDataRequestedFromServer + file->output_freq); 
    293300    } 
    294301 
     
    428435    std::map<int, CArray<double,1> > data; 
    429436 
    430     bool isEOF = false; 
    431  
    432437    for (int i = 0; i < ranks.size(); i++) 
    433438    { 
  • XIOS/trunk/src/node/field.hpp

    r1013 r1017  
    143143        void recvUpdateData(vector<int>& ranks, vector<CBufferIn*>& buffers); 
    144144        void writeField(void); 
    145         void sendReadDataRequest(const CDate& tsDataRequested); 
     145        bool sendReadDataRequest(const CDate& tsDataRequested); 
    146146        bool sendReadDataRequestIfNeeded(void); 
    147147        static void recvReadDataRequest(CEventServer& event); 
Note: See TracChangeset for help on using the changeset viewer.