OpenM++ runtime library (libopenm)
openm::RunController Class Referenceabstract

run controller: create new model run(s) and support data exchange. More...

Inheritance diagram for openm::RunController:
Collaboration diagram for openm::RunController:

Classes

struct  SetRunItem
 

Public Member Functions

virtual ~RunController (void) noexcept=0
 last cleanup
 
int parameterIdByName (const char *i_name) const override
 return index of parameter by name
 
int parameterSubCount (int i_paramId) const override
 number of parameter sub-values for current process
 
int parameterSelfSubCount (int i_paramId) const override
 number of parameter sub-values for current process
 
int parameterSubValueIndex (int i_paramId, int i_subId) const override
 return index of parameter sub-value in the storage array of sub-values
 
bool isUseSubValue (int i_subId) const override
 return true if sub-value used by current process
 
RunStateHolderrunStateStore (void)
 return holder of all sub-values modeling run states
 
virtual int nextRun (void)=0
 create new run and input parameters in database. More...
 
virtual void shutdownRun (int i_runId)=0
 model run shutdown: save results and update run status. More...
 
virtual void shutdownWaitAll (void)=0
 model process shutdown: cleanup resources. More...
 
virtual void shutdownOnExit (ModelStatus i_status)=0
 model process shutdown if exiting without completion (ie: exit on error). More...
 
virtual bool childExchange (void)=0
 exchange between root and child processes and threads. More...
 
virtual void writeAccumulators (const RunOptions &i_runOpts, bool i_isLastTable, const char *i_name, size_t i_size, forward_list< unique_ptr< double > > &io_accValues)=0
 write output table accumulators or send data to root process. More...
 
- Public Member Functions inherited from openm::MetaLoader
virtual ~MetaLoader (void) noexcept=0
 last cleanup
 
const ArgReaderargOpts (void) const
 arguments from command line and ini-file
 
const MetaHoldermeta (void) const
 model metadata tables
 
const RunOptions modelRunOptions (int i_subCount, int i_subId) const
 return basic model run options
 
int parameterSubCount (int i_paramId) const
 return sub-values count by parameter id
 
- Public Member Functions inherited from openm::IRunBase
virtual void readParameter (const char *i_name, int i_subId, const type_info &i_type, size_t i_size, void *io_valueArr)=0
 read model parameter
 

Static Public Member Functions

static RunControllercreate (const ArgReader &i_argOpts, bool i_isMpiUsed, IDbExec *i_dbExec, IMsgExec *i_msgExec)
 create run controller, load metadata tables and broadcast it to all modeling processes. More...
 
- Static Public Member Functions inherited from openm::MetaLoader
static const ArgReader getRunOptions (int argc, char **argv)
 initialize run options from command line and ini-file More...
 

Public Attributes

int subFirstId
 sub-value staring index for current modeling process
 
int selfSubCount
 number of sub-values for current process
 
int processCount
 number of modeling processes: MPI world size
 
- Public Attributes inherited from openm::MetaLoader
int subValueCount
 total number of sub-values
 
int threadCount
 max number of modeling threads
 

Protected Member Functions

 RunController (const ArgReader &i_argStore)
 create run controller
 
virtual void init (void)=0
 get number of sub-values, read and broadcast metadata. More...
 
SetRunItem createNewRun (int i_taskRunId, bool i_isWaitTaskRun, IDbExec *i_dbExec)
 create new run, create input parameters and run options for input working sets
 
void doShutdownOnExit (ModelStatus i_status, int i_runId, int i_taskRunId, IDbExec *i_dbExec)
 impelementation of model process shutdown if exiting without completion. More...
 
void doShutdownRun (int i_runId, int i_taskRunId, IDbExec *i_dbExec)
 implementation of model run shutdown. More...
 
void doShutdownAll (int i_taskRunId, IDbExec *i_dbExec)
 implementation model process shutdown. More...
 
void doWriteAccumulators (int i_runId, IDbExec *i_dbExec, const RunOptions &i_runOpts, const char *i_name, size_t i_size, forward_list< unique_ptr< double > > &io_accValues) const
 write output table accumulators. More...
 
void updateRestartSubValueId (int i_runId, IDbExec *i_dbExec, int i_subRestart) const
 update sub-value index to restart the run
 
void updateRunState (IDbExec *i_dbExec, const map< pair< int, int >, RunState > i_updated) const
 merge updated sub-values run statue into database
 
- Protected Member Functions inherited from openm::MetaLoader
 MetaLoader (const ArgReader &i_argStore)
 create metadata loader. More...
 
const RunOptionsmodelRunOptions (void) const
 return basic model run options
 
void setRunOptions (const RunOptions &i_opts)
 set basic model run options
 
void loadMessages (IDbExec *i_dbExec)
 read model messages from database. More...
 
void mergeOptions (IDbExec *i_dbExec)
 
int createTaskRun (int i_taskId, IDbExec *i_dbExec)
 
int findTask (IDbExec *i_dbExec)
 
int findWorkset (int i_setId, IDbExec *i_dbExec)
 
void createRunOptions (int i_runId, IDbExec *i_dbExec) const
 

Additional Inherited Members

- Static Protected Member Functions inherited from openm::MetaLoader
static int readMetaTables (IDbExec *i_dbExec, MetaHolder *io_metaStore)
 
- Protected Attributes inherited from openm::MetaLoader
int modelId
 
unique_ptr< MetaHoldermetaStore
 
vector< int > paramIdSubArr
 

Detailed Description

run controller: create new model run(s) and support data exchange.

Member Function Documentation

◆ childExchange()

virtual bool openm::RunController::childExchange ( void  )
pure virtual

exchange between root and child processes and threads.

send new input, receive accumulators of output tables, send and receive status update.

Implemented in openm::RestartController, openm::ChildController, openm::RootController, and openm::SingleController.

◆ create()

RunController * RunController::create ( const ArgReader i_argOpts,
bool  i_isMpiUsed,
IDbExec i_dbExec,
IMsgExec i_msgExec 
)
static

create run controller, load metadata tables and broadcast it to all modeling processes.

◆ doShutdownAll()

void RunController::doShutdownAll ( int  i_taskRunId,
IDbExec i_dbExec 
)
protected

implementation model process shutdown.

implementation model process shutdown: update run state and cleanup resources.

◆ doShutdownOnExit()

void RunController::doShutdownOnExit ( ModelStatus  i_status,
int  i_runId,
int  i_taskRunId,
IDbExec i_dbExec 
)
protected

impelementation of model process shutdown if exiting without completion.

◆ doShutdownRun()

void RunController::doShutdownRun ( int  i_runId,
int  i_taskRunId,
IDbExec i_dbExec 
)
protected

implementation of model run shutdown.

◆ doWriteAccumulators()

void RunController::doWriteAccumulators ( int  i_runId,
IDbExec i_dbExec,
const RunOptions i_runOpts,
const char *  i_name,
size_t  i_size,
forward_list< unique_ptr< double > > &  io_accValues 
) const
protected

write output table accumulators.

◆ init()

virtual void openm::RunController::init ( void  )
protectedpure virtual

get number of sub-values, read and broadcast metadata.

Implemented in openm::RootController, and openm::SingleController.

◆ nextRun()

virtual int openm::RunController::nextRun ( void  )
pure virtual

create new run and input parameters in database.

Implemented in openm::RestartController, openm::ChildController, openm::RootController, and openm::SingleController.

◆ shutdownOnExit()

virtual void openm::RunController::shutdownOnExit ( ModelStatus  i_status)
pure virtual

model process shutdown if exiting without completion (ie: exit on error).

Implemented in openm::RestartController, openm::ChildController, openm::RootController, and openm::SingleController.

◆ shutdownRun()

virtual void openm::RunController::shutdownRun ( int  i_runId)
pure virtual

model run shutdown: save results and update run status.

Implemented in openm::RestartController, openm::ChildController, openm::RootController, and openm::SingleController.

◆ shutdownWaitAll()

virtual void openm::RunController::shutdownWaitAll ( void  )
pure virtual

model process shutdown: cleanup resources.

Implemented in openm::RestartController, openm::ChildController, openm::RootController, and openm::SingleController.

◆ writeAccumulators()

virtual void openm::RunController::writeAccumulators ( const RunOptions i_runOpts,
bool  i_isLastTable,
const char *  i_name,
size_t  i_size,
forward_list< unique_ptr< double > > &  io_accValues 
)
pure virtual

write output table accumulators or send data to root process.

Implemented in openm::RestartController, openm::ChildController, openm::RootController, and openm::SingleController.


The documentation for this class was generated from the following files: