Changeset 1013


Ignore:
Timestamp:
12/12/16 16:55:28 (6 years ago)
Author:
rlacroix
Message:

Improve the prefetching of the fields read from a file.

Previously the data was requested at the beginning of the timestep where it would be used which was too late and could cause performance issue.

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

Legend:

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

    r1011 r1013  
    3636      , domAxisScalarIds_(vector<StdString>(3,"")), areAllReferenceSolved(false), isReferenceSolved(false) 
    3737      , useCompressedOutput(false) 
    38       , isReadDataRequestPending(false) 
    3938      , hasTimeInstant(false) 
    4039      , hasTimeCentered(false) 
     40      , wasDataAlreadyReceivedFromServer(false) 
    4141   { setVirtualVariableGroup(CVariableGroup::create(getId() + "_virtual_variable_group")); } 
    4242 
     
    4949      , domAxisScalarIds_(vector<StdString>(3,"")), areAllReferenceSolved(false), isReferenceSolved(false) 
    5050      , useCompressedOutput(false) 
    51       , isReadDataRequestPending(false) 
    5251      , hasTimeInstant(false) 
    5352      , hasTimeCentered(false) 
     53      , wasDataAlreadyReceivedFromServer(false) 
    5454   { setVirtualVariableGroup(CVariableGroup::create(getId() + "_virtual_variable_group")); } 
    5555 
     
    251251  } 
    252252 
    253   void CField::sendReadDataRequest(void) 
     253  void CField::sendReadDataRequest(const CDate& tsDataRequested) 
    254254  { 
    255255    CContext* context = CContext::getCurrent(); 
    256256    CContextClient* client = context->client; 
    257257 
    258     lastDataRequestedFromServer = context->getCalendar()->getCurrentDate(); 
    259     isReadDataRequestPending = true; 
     258    lastDataRequestedFromServer = tsDataRequested; 
    260259 
    261260    CEventClient event(getType(), EVENT_ID_READ_DATA); 
     
    280279    const CDate& currentDate = CContext::getCurrent()->getCalendar()->getCurrentDate(); 
    281280 
    282     bool requestData = (currentDate >= lastDataRequestedFromServer + file->output_freq.getValue()); 
    283  
    284     if (requestData) 
    285     { 
    286       info(20) <<"currentDate : "<<currentDate<<endl ; 
    287       info(20) <<"lastDataRequestedFromServer : "<<lastDataRequestedFromServer<<endl ; 
    288       info(20) <<"file->output_freq.getValue() : "<<file->output_freq.getValue()<<endl ; 
    289       info(20) <<"lastDataRequestedFromServer + file->output_freq.getValue() : "<<lastDataRequestedFromServer + file->output_freq.getValue()<<endl ; 
    290  
    291       sendReadDataRequest(); 
    292     } 
    293  
    294     return requestData; 
     281    bool dataRequested = false; 
     282 
     283    while (currentDate >= lastDataRequestedFromServer) 
     284    { 
     285      info(20) << "currentDate : " << currentDate << endl ; 
     286      info(20) << "lastDataRequestedFromServer : " << lastDataRequestedFromServer << endl ; 
     287      info(20) << "file->output_freq.getValue() : " << file->output_freq.getValue() << endl ; 
     288      info(20) << "lastDataRequestedFromServer + file->output_freq.getValue() : " << lastDataRequestedFromServer + file->output_freq << endl ; 
     289 
     290      sendReadDataRequest(lastDataRequestedFromServer + file->output_freq); 
     291 
     292      dataRequested = true; 
     293    } 
     294 
     295    return dataRequested; 
    295296  } 
    296297 
     
    394395        this->incrementNStep(); 
    395396 
    396  
    397  
    398397        if (getNStep() > nstepMax && (getRelFile()->cyclic.isEmpty() || !getRelFile()->cyclic) ) 
    399398          return false; 
     
    443442    } 
    444443 
     444    if (wasDataAlreadyReceivedFromServer) 
     445      lastDataReceivedFromServer = lastDataReceivedFromServer + file->output_freq; 
     446    else 
     447    { 
     448      lastDataReceivedFromServer = context->getCalendar()->getInitDate(); 
     449      wasDataAlreadyReceivedFromServer = true; 
     450    } 
     451 
    445452    if (isEOF) 
    446       serverSourceFilter->signalEndOfStream(lastDataRequestedFromServer); 
     453      serverSourceFilter->signalEndOfStream(lastDataReceivedFromServer); 
    447454    else 
    448       serverSourceFilter->streamDataFromServer(lastDataRequestedFromServer, data); 
    449  
    450     isReadDataRequestPending = false; 
     455      serverSourceFilter->streamDataFromServer(lastDataReceivedFromServer, data); 
    451456  } 
    452457 
  • XIOS/trunk/src/node/field.hpp

    r1000 r1013  
    143143        void recvUpdateData(vector<int>& ranks, vector<CBufferIn*>& buffers); 
    144144        void writeField(void); 
    145         void sendReadDataRequest(void); 
     145        void sendReadDataRequest(const CDate& tsDataRequested); 
    146146        bool sendReadDataRequestIfNeeded(void); 
    147147        static void recvReadDataRequest(CEventServer& event); 
     
    195195         bool isEOF; 
    196196         CDate lastlast_Write_srv, last_Write_srv, last_operation_srv; 
    197          CDate lastDataRequestedFromServer; 
     197         CDate lastDataRequestedFromServer, lastDataReceivedFromServer; 
     198         bool wasDataAlreadyReceivedFromServer; 
    198199 
    199200         map<int,boost::shared_ptr<func::CFunctor> > foperation_srv; 
     
    205206         bool isReferenceSolved; 
    206207         std::vector<StdString> domAxisScalarIds_; 
    207          bool isReadDataRequestPending; 
    208208         bool useCompressedOutput; 
    209209 
  • XIOS/trunk/src/node/file.cpp

    r1011 r1013  
    745745     int size = this->enabledFields.size(); 
    746746     for (int i = 0; i < size; ++i) 
    747        this->enabledFields[i]->sendReadDataRequest(); 
     747       this->enabledFields[i]->sendReadDataRequest(CContext::getCurrent()->getCalendar()->getCurrentDate()); 
    748748   } 
    749749 
Note: See TracChangeset for help on using the changeset viewer.