Changeset 1358 for XIOS/trunk


Ignore:
Timestamp:
12/06/17 08:34:41 (6 years ago)
Author:
rlacroix
Message:

Support reentrant workflows and workflows with temporal integration for fields read from files.

Location:
XIOS/trunk/src
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/filter/file_writer_filter.cpp

    r1253 r1358  
    3737  } 
    3838 
     39  bool CFileWriterFilter::mustAutoTrigger() const 
     40  { 
     41    return true; 
     42  } 
     43 
    3944  bool CFileWriterFilter::isDataExpected(const CDate& date) const 
    4045  { 
  • XIOS/trunk/src/filter/file_writer_filter.hpp

    r1119 r1358  
    2424 
    2525      /*! 
     26       * Tests if the filter must auto-trigger. 
     27       * 
     28       * \return true if the filter must auto-trigger 
     29       */ 
     30      bool virtual mustAutoTrigger() const; 
     31 
     32      /*! 
    2633       * Tests whether data is expected for the specified date. 
    2734       * 
  • XIOS/trunk/src/filter/filter.cpp

    r1119 r1358  
    4141  } 
    4242 
     43  bool CFilter::mustAutoTrigger() const 
     44  { 
     45    return COutputPin::mustAutoTrigger(); 
     46  } 
     47 
    4348  bool CFilter::isDataExpected(const CDate& date) const 
    4449  { 
  • XIOS/trunk/src/filter/filter.hpp

    r1119 r1358  
    4949 
    5050      /*! 
     51       * Tests if the filter must auto-trigger. 
     52       * 
     53       * \return true if the filter must auto-trigger 
     54       */ 
     55      bool virtual mustAutoTrigger() const; 
     56 
     57      /*! 
    5158       * Tests whether data is expected for the specified date. 
    5259       * 
  • XIOS/trunk/src/filter/input_pin.hpp

    r1119 r1358  
    6060 
    6161      /*! 
     62       * Tests if the pin must auto-trigger. 
     63       * 
     64       * \return true if the pin must auto-trigger 
     65       */ 
     66      bool virtual mustAutoTrigger() const = 0; 
     67 
     68      /*! 
    6269       * Tests whether data is expected for the specified date. 
    6370       * 
  • XIOS/trunk/src/filter/output_pin.cpp

    r1119 r1358  
    6666  } 
    6767 
     68  bool COutputPin::mustAutoTrigger() const 
     69  { 
     70    std::vector<std::pair<boost::shared_ptr<CInputPin>, size_t> >::const_iterator it, itEnd; 
     71    for (it = outputs.begin(), itEnd = outputs.end(); it != itEnd; ++it) 
     72    { 
     73      if (it->first->mustAutoTrigger()) 
     74        return true; 
     75    } 
     76 
     77    return false; 
     78  } 
     79 
    6880  void COutputPin::setOutputTriggers() 
    6981  { 
  • XIOS/trunk/src/filter/output_pin.hpp

    r1119 r1358  
    4444       */ 
    4545      bool virtual canBeTriggered() const; 
     46 
     47      /*! 
     48       * Tests if the pin must auto-trigger. 
     49       * 
     50       * \return true if the pin must auto-trigger 
     51       */ 
     52      bool virtual mustAutoTrigger() const; 
    4653 
    4754      /*! 
  • XIOS/trunk/src/filter/store_filter.cpp

    r1253 r1358  
    111111  } 
    112112 
     113  bool CStoreFilter::mustAutoTrigger() const 
     114  { 
     115    return false; 
     116  } 
     117 
    113118  bool CStoreFilter::isDataExpected(const CDate& date) const 
    114119  { 
  • XIOS/trunk/src/filter/store_filter.hpp

    r1186 r1358  
    5353 
    5454      /*! 
     55       * Tests if the filter must auto-trigger. 
     56       * 
     57       * \return true if the filter must auto-trigger 
     58       */ 
     59      bool virtual mustAutoTrigger() const; 
     60 
     61      /*! 
    5562       * Tests whether data is expected for the specified date. 
    5663       * 
  • XIOS/trunk/src/filter/temporal_filter.cpp

    r1286 r1358  
    7676  } 
    7777 
     78  bool CTemporalFilter::mustAutoTrigger() const 
     79  { 
     80    return true; 
     81  } 
     82 
    7883  bool CTemporalFilter::isDataExpected(const CDate& date) const 
    7984  { 
  • XIOS/trunk/src/filter/temporal_filter.hpp

    r1183 r1358  
    4141 
    4242      /*! 
     43       * Tests if the filter must auto-trigger. 
     44       * 
     45       * \return true if the filter must auto-trigger 
     46       */ 
     47      bool virtual mustAutoTrigger() const; 
     48 
     49      /*! 
    4350       * Tests whether data is expected for the specified date. 
    4451       * 
  • XIOS/trunk/src/node/context.cpp

    r1357 r1358  
    438438      buildFilterGraphOfFieldsWithReadAccess(); 
    439439      this->solveAllRefOfEnabledFields(true); 
     440      postProcessFilterGraph(); 
    440441    } 
    441442 
     
    505506   } 
    506507 
     508   void CContext::postProcessFilterGraph() 
     509   { 
     510     int size = enabledFiles.size(); 
     511     for (int i = 0; i < size; ++i) 
     512     { 
     513        enabledFiles[i]->postProcessFilterGraph(); 
     514     } 
     515   } 
     516 
    507517   void CContext::startPrefetchingOfEnabledReadModeFiles() 
    508518   { 
     
    511521     { 
    512522        enabledReadModeFiles[i]->prefetchEnabledReadModeFields(); 
     523     } 
     524   } 
     525 
     526   void CContext::doPreTimestepOperationsForEnabledReadModeFiles() 
     527   { 
     528     int size = enabledReadModeFiles.size(); 
     529     for (int i = 0; i < size; ++i) 
     530     { 
     531        enabledReadModeFiles[i]->doPreTimestepOperationsForEnabledReadModeFields(); 
    513532     } 
    514533   } 
     
    12061225      if (prevStep < step) 
    12071226      { 
     1227        if (hasClient) 
     1228        { 
     1229          doPreTimestepOperationsForEnabledReadModeFiles(); 
     1230        } 
     1231 
    12081232        info(50) << "updateCalendar : before : " << calendar->getCurrentDate() << endl; 
    12091233        calendar->update(step); 
  • XIOS/trunk/src/node/context.hpp

    r1318 r1358  
    114114         void solveAllRefOfEnabledFields(bool sendToServer); 
    115115         void buildFilterGraphOfEnabledFields(); 
     116         void postProcessFilterGraph(); 
    116117         void startPrefetchingOfEnabledReadModeFiles(); 
     118         void doPreTimestepOperationsForEnabledReadModeFiles(); 
    117119         void doPostTimestepOperationsForEnabledReadModeFiles(); 
    118120         void findFieldsWithReadAccess(void); 
  • XIOS/trunk/src/node/field.cpp

    r1326 r1358  
    4040      , wasDataRequestedFromServer(false) 
    4141      , wasDataAlreadyReceivedFromServer(false) 
     42      , mustAutoTrigger(false) 
    4243      , isEOF(false) 
    4344   { setVirtualVariableGroup(CVariableGroup::create(getId() + "_virtual_variable_group")); } 
     
    5556      , wasDataRequestedFromServer(false) 
    5657      , wasDataAlreadyReceivedFromServer(false) 
     58      , mustAutoTrigger(false) 
    5759      , isEOF(false) 
    5860   { setVirtualVariableGroup(CVariableGroup::create(getId() + "_virtual_variable_group")); } 
     
    479481 
    480482    // Check if data previously requested has been received as expected 
    481     if (wasDataRequestedFromServer && (!isEOF || currentDate <= dateEOF)) 
     483    if (wasDataRequestedFromServer && !isEOF) 
    482484    { 
    483485      CTimer timer("CField::checkForLateDataFromServer"); 
     
    487489      { 
    488490        const CDate nextDataDue = wasDataAlreadyReceivedFromServer ? (lastDataReceivedFromServer + file->output_freq) : context->getCalendar()->getInitDate(); 
    489         isDataLate = nextDataDue < currentDate; 
     491        isDataLate = (nextDataDue <= currentDate); 
    490492 
    491493        if (isDataLate) 
     
    504506              << "Late data at timestep = " << currentDate); 
    505507    } 
     508  } 
     509 
     510  void CField::checkIfMustAutoTrigger(void) 
     511  { 
     512    mustAutoTrigger = serverSourceFilter ? serverSourceFilter->mustAutoTrigger() : false; 
     513  } 
     514 
     515  void CField::autoTriggerIfNeeded(void) 
     516  { 
     517    if (mustAutoTrigger) 
     518      serverSourceFilter->trigger(CContext::getCurrent()->getCalendar()->getCurrentDate()); 
    506519  } 
    507520 
  • XIOS/trunk/src/node/field.hpp

    r1318 r1358  
    151151        void recvReadDataReady(vector<int> ranks, vector<CBufferIn*> buffers); 
    152152        void checkForLateDataFromServer(void); 
     153        void checkIfMustAutoTrigger(void); 
     154        void autoTriggerIfNeeded(void); 
    153155        void outputField(CArray<double,3>& fieldOut); 
    154156        void outputField(CArray<double,2>& fieldOut); 
     
    200202         CDate lastDataRequestedFromServer, lastDataReceivedFromServer, dateEOF; 
    201203         bool wasDataRequestedFromServer, wasDataAlreadyReceivedFromServer; 
     204         bool mustAutoTrigger; 
    202205 
    203206         map<int,boost::shared_ptr<func::CFunctor> > foperation_srv; 
  • XIOS/trunk/src/node/file.cpp

    r1318 r1358  
    770770 
    771771   /*! 
     772    * Post-process the filter graph for each active field. 
     773    */ 
     774   void CFile::postProcessFilterGraph() 
     775   { 
     776     int size = this->enabledFields.size(); 
     777     for (int i = 0; i < size; ++i) 
     778     { 
     779       this->enabledFields[i]->checkIfMustAutoTrigger(); 
     780     } 
     781   } 
     782 
     783   /*! 
    772784     Prefetching the data for enabled fields read from file. 
    773785   */ 
     
    783795 
    784796   /*! 
    785      Do all post timestep operations for enabled fields in read mode: 
    786       - Prefetch the data read from file when needed 
     797     Do all pre timestep operations for enabled fields in read mode: 
    787798      - Check that the data excepted from server has been received 
    788    */ 
    789    void CFile::doPostTimestepOperationsForEnabledReadModeFields(void) 
     799      - Check if some filters must auto-trigger 
     800   */ 
     801   void CFile::doPreTimestepOperationsForEnabledReadModeFields(void) 
    790802   { 
    791803     if (mode.isEmpty() || mode.getValue() != mode_attr::read) 
     
    796808     { 
    797809       this->enabledFields[i]->checkForLateDataFromServer(); 
     810       this->enabledFields[i]->autoTriggerIfNeeded(); 
     811     } 
     812   } 
     813 
     814   /*! 
     815     Do all post timestep operations for enabled fields in read mode: 
     816      - Prefetch the data read from file when needed 
     817   */ 
     818   void CFile::doPostTimestepOperationsForEnabledReadModeFields(void) 
     819   { 
     820     if (mode.isEmpty() || mode.getValue() != mode_attr::read) 
     821       return; 
     822 
     823     int size = this->enabledFields.size(); 
     824     for (int i = 0; i < size; ++i) 
     825     { 
    798826       this->enabledFields[i]->sendReadDataRequestIfNeeded(); 
    799827     } 
  • XIOS/trunk/src/node/file.hpp

    r1318 r1358  
    106106         void solveAllRefOfEnabledFields(bool sendToServer); 
    107107         void buildFilterGraphOfEnabledFields(CGarbageCollector& gc); 
     108         void postProcessFilterGraph(); 
    108109         void prefetchEnabledReadModeFields(); 
     110         void doPreTimestepOperationsForEnabledReadModeFields(); 
    109111         void doPostTimestepOperationsForEnabledReadModeFields(); 
    110112 
Note: See TracChangeset for help on using the changeset viewer.