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/dev/XIOS_DEV_CMIP6/src
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/XIOS_DEV_CMIP6/src/filter/file_server_writer_filter.cpp

    r1158 r1358  
    1919  } 
    2020 
     21  bool CFileServerWriterFilter::mustAutoTrigger() const 
     22  { 
     23    return true; 
     24  } 
     25 
    2126  bool CFileServerWriterFilter::isDataExpected(const CDate& date) const 
    2227  { 
  • XIOS/dev/XIOS_DEV_CMIP6/src/filter/file_server_writer_filter.hpp

    r1158 r1358  
    2323      CFileServerWriterFilter(CGarbageCollector& gc, CField* field); 
    2424 
     25      /*! 
     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      /*! 
     33       * Tests whether data is expected for the specified date. 
     34       * 
     35       * \param date the date associated to the data 
     36       */ 
    2537      bool virtual isDataExpected(const CDate& date) const; 
     38 
    2639    protected: 
    2740      /*! 
  • XIOS/dev/XIOS_DEV_CMIP6/src/filter/file_writer_filter.cpp

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

    r1158 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/dev/XIOS_DEV_CMIP6/src/filter/filter.cpp

    r1158 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/dev/XIOS_DEV_CMIP6/src/filter/filter.hpp

    r1158 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/dev/XIOS_DEV_CMIP6/src/filter/input_pin.hpp

    r1158 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/dev/XIOS_DEV_CMIP6/src/filter/output_pin.cpp

    r1158 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/dev/XIOS_DEV_CMIP6/src/filter/output_pin.hpp

    r1158 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/dev/XIOS_DEV_CMIP6/src/filter/store_filter.cpp

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

    r1201 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/dev/XIOS_DEV_CMIP6/src/filter/temporal_filter.cpp

    r1302 r1358  
    8484  } 
    8585 
     86  bool CTemporalFilter::mustAutoTrigger() const 
     87  { 
     88    return true; 
     89  } 
     90 
    8691  bool CTemporalFilter::isDataExpected(const CDate& date) const 
    8792  { 
  • XIOS/dev/XIOS_DEV_CMIP6/src/filter/temporal_filter.hpp

    r1302 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/dev/XIOS_DEV_CMIP6/src/node/context.cpp

    r1357 r1358  
    665665    { 
    666666      buildFilterGraphOfFieldsWithReadAccess(); 
     667      postProcessFilterGraph(); 
    667668    } 
    668669     
     
    782783   } 
    783784 
     785   void CContext::postProcessFilterGraph() 
     786   { 
     787     int size = enabledFiles.size(); 
     788     for (int i = 0; i < size; ++i) 
     789     { 
     790        enabledFiles[i]->postProcessFilterGraph(); 
     791     } 
     792   } 
     793 
    784794   void CContext::startPrefetchingOfEnabledReadModeFiles() 
    785795   { 
     
    788798     { 
    789799        enabledReadModeFiles[i]->prefetchEnabledReadModeFields(); 
     800     } 
     801   } 
     802 
     803   void CContext::doPreTimestepOperationsForEnabledReadModeFiles() 
     804   { 
     805     int size = enabledReadModeFiles.size(); 
     806     for (int i = 0; i < size; ++i) 
     807     { 
     808        enabledReadModeFiles[i]->doPreTimestepOperationsForEnabledReadModeFields(); 
    790809     } 
    791810   } 
     
    18371856      if (prevStep < step) 
    18381857      { 
     1858        if (hasClient && !hasServer) // For now we only use server level 1 to read data 
     1859        { 
     1860          doPreTimestepOperationsForEnabledReadModeFiles(); 
     1861        } 
     1862 
    18391863        info(50) << "updateCalendar : before : " << calendar->getCurrentDate() << endl; 
    18401864        calendar->update(step); 
  • XIOS/dev/XIOS_DEV_CMIP6/src/node/context.hpp

    r1349 r1358  
    120120         void solveOnlyRefOfEnabledFields(bool sendToServer);          
    121121         void buildFilterGraphOfEnabledFields(); 
     122         void postProcessFilterGraph(); 
    122123         void startPrefetchingOfEnabledReadModeFiles(); 
     124         void doPreTimestepOperationsForEnabledReadModeFiles(); 
    123125         void doPostTimestepOperationsForEnabledReadModeFiles(); 
    124126         void findFieldsWithReadAccess(void); 
  • XIOS/dev/XIOS_DEV_CMIP6/src/node/field.cpp

    r1344 r1358  
    4242      , wasDataRequestedFromServer(false) 
    4343      , wasDataAlreadyReceivedFromServer(false) 
     44      , mustAutoTrigger(false) 
    4445      , isEOF(false), nstepMaxRead(false) 
    4546   { setVirtualVariableGroup(CVariableGroup::create(getId() + "_virtual_variable_group")); } 
     
    5859      , wasDataRequestedFromServer(false) 
    5960      , wasDataAlreadyReceivedFromServer(false) 
     61      , mustAutoTrigger(false) 
    6062      , isEOF(false), nstepMaxRead(false) 
    6163   { setVirtualVariableGroup(CVariableGroup::create(getId() + "_virtual_variable_group")); } 
     
    569571 
    570572    // Check if data previously requested has been received as expected 
    571     if (wasDataRequestedFromServer && (!isEOF || currentDate <= dateEOF)) 
     573    if (wasDataRequestedFromServer && !isEOF) 
    572574    { 
    573575      CTimer timer("CField::checkForLateDataFromServer"); 
     
    577579      { 
    578580        const CDate nextDataDue = wasDataAlreadyReceivedFromServer ? (lastDataReceivedFromServer + file->output_freq) : context->getCalendar()->getInitDate(); 
    579         isDataLate = nextDataDue < currentDate; 
     581        isDataLate = (nextDataDue <= currentDate); 
    580582 
    581583        if (isDataLate) 
     
    594596              << "Late data at timestep = " << currentDate); 
    595597    } 
     598  } 
     599 
     600  void CField::checkIfMustAutoTrigger(void) 
     601  { 
     602    mustAutoTrigger = serverSourceFilter ? serverSourceFilter->mustAutoTrigger() : false; 
     603  } 
     604 
     605  void CField::autoTriggerIfNeeded(void) 
     606  { 
     607    if (mustAutoTrigger) 
     608      serverSourceFilter->trigger(CContext::getCurrent()->getCalendar()->getCurrentDate()); 
    596609  } 
    597610 
  • XIOS/dev/XIOS_DEV_CMIP6/src/node/field.hpp

    r1330 r1358  
    174174        void recvReadDataReady(vector<int> ranks, vector<CBufferIn*> buffers); 
    175175        void checkForLateDataFromServer(void); 
     176        void checkIfMustAutoTrigger(void); 
     177        void autoTriggerIfNeeded(void); 
    176178        void outputField(CArray<double,3>& fieldOut); 
    177179        void outputField(CArray<double,2>& fieldOut); 
     
    221223         CDate lastDataRequestedFromServer, lastDataReceivedFromServer, dateEOF; 
    222224         bool wasDataRequestedFromServer, wasDataAlreadyReceivedFromServer; 
     225         bool mustAutoTrigger; 
    223226 
    224227         map<int,boost::shared_ptr<func::CFunctor> > foperation_srv; 
  • XIOS/dev/XIOS_DEV_CMIP6/src/node/file.cpp

    r1318 r1358  
    854854 
    855855   /*! 
     856    * Post-process the filter graph for each active field. 
     857    */ 
     858   void CFile::postProcessFilterGraph() 
     859   { 
     860     int size = this->enabledFields.size(); 
     861     for (int i = 0; i < size; ++i) 
     862     { 
     863       this->enabledFields[i]->checkIfMustAutoTrigger(); 
     864     } 
     865   } 
     866 
     867   /*! 
    856868     Prefetching the data for enabled fields read from file. 
    857869   */ 
     
    867879 
    868880   /*! 
     881     Do all pre timestep operations for enabled fields in read mode: 
     882      - Check that the data excepted from server has been received 
     883      - Check if some filters must auto-trigger 
     884   */ 
     885   void CFile::doPreTimestepOperationsForEnabledReadModeFields(void) 
     886   { 
     887     if (mode.isEmpty() || mode.getValue() != mode_attr::read) 
     888       return; 
     889 
     890     int size = this->enabledFields.size(); 
     891     for (int i = 0; i < size; ++i) 
     892     { 
     893       this->enabledFields[i]->checkForLateDataFromServer(); 
     894       this->enabledFields[i]->autoTriggerIfNeeded(); 
     895     } 
     896   } 
     897 
     898   /*! 
    869899     Do all post timestep operations for enabled fields in read mode: 
    870900      - Prefetch the data read from file when needed 
    871       - Check that the data excepted from server has been received 
    872901   */ 
    873902   void CFile::doPostTimestepOperationsForEnabledReadModeFields(void) 
     
    879908     for (int i = 0; i < size; ++i) 
    880909     { 
    881        this->enabledFields[i]->checkForLateDataFromServer(); 
    882910       this->enabledFields[i]->sendReadDataRequestIfNeeded(); 
    883911     } 
  • XIOS/dev/XIOS_DEV_CMIP6/src/node/file.hpp

    r1318 r1358  
    110110          
    111111         void buildFilterGraphOfEnabledFields(CGarbageCollector& gc); 
     112         void postProcessFilterGraph(); 
    112113         void prefetchEnabledReadModeFields(); 
     114         void doPreTimestepOperationsForEnabledReadModeFields(); 
    113115         void doPostTimestepOperationsForEnabledReadModeFields(); 
    114116 
Note: See TracChangeset for help on using the changeset viewer.