12#include <unordered_set>
40 virtual int nextRun(
void)
override;
44 const char * i_name,
int i_subId,
const type_info & i_type,
size_t i_size,
void * io_valueArr
53 forward_list<unique_ptr<
double[]> > & io_accValues
70 virtual void init(
void)
override;
109 virtual int nextRun(
void)
override;
113 const char * i_name,
int i_subId,
const type_info & i_type,
size_t i_size,
void * io_valueArr
122 forward_list<unique_ptr<
double[]> > & io_accValues
142 virtual void init(
void)
override;
147 return (rootGroupDef.isRootActive && !runGroupLst.empty()) ? runGroupLst.back().runId : 0;
161 list<RunGroup> runGroupLst;
162 list<AccReceive> accRecvLst;
165 RunGroup & rootRunGroup(
void) {
return runGroupLst.back(); }
168 void broadcastMetaData(
void);
171 template <
class MetaTbl>
172 void broadcastMetaTable(
MsgTag i_msgTag, unique_ptr<MetaTbl> & io_tableUptr);
175 void broadcastRunOptions(
void);
178 void broadcastLanguageMessages(
void);
181 int makeNextRun(RunGroup & i_runGroup);
184 void readAllRunParameters(
const RunGroup & i_runGroup)
const;
187 void appendAccReceiveList(
int i_runId,
const RunGroup & i_runGroup);
190 bool receiveSubValues(
void);
193 void updateAccReceiveList(
void);
198 bool updateModelRunStatus(
void);
201 bool receiveStatusUpdate(
long i_waitTime = 0L);
204 struct EntityMdReceive
209 vector<size_t> count;
213 recursive_mutex mdRcvMutex;
215 list<EntityMdReceive> entityMdRcvLst;
216 vector<bool> isMicrodataFromRank;
219 bool receiveMicrodata(
long i_waitTime = 0L);
222 bool isAllMicrodataReceived(RunGroup & i_runGroup);
225 bool isAllMicrodataReceived(
int i_childRank);
241 lastTimeStatus(chrono::system_clock::now()),
243 isFinalExchange(false)
253 virtual int nextRun(
void)
override;
257 const char * i_name,
int i_subId,
const type_info & i_type,
size_t i_size,
void * io_valueArr
266 forward_list<unique_ptr<
double[]> > & io_accValues
285 chrono::system_clock::time_point lastTimeStatus;
287 bool isFinalExchange;
290 virtual void init(
void)
override;
293 int currentRunId(
void)
const noexcept override {
return runId; }
296 int broadcastMetaData(
void);
299 template <
class MetaTbl>
300 void broadcastMetaTable(
MsgTag i_msgTag, unique_ptr<MetaTbl> & io_tableUptr);
303 void broadcastRunOptions(
void);
306 void broadcastLanguageMessages(
void);
309 void sendStatusUpdate(
void);
312 size_t sendMicrodata(
bool i_isLast);
335 virtual int nextRun(
void)
override;
339 const char * i_name,
int i_subId,
const type_info & i_type,
size_t i_size,
void * io_valueArr
348 forward_list<unique_ptr<
double[]> > & io_accValues
370 virtual void init(
void)
override;
373 int currentRunId(
void)
const noexcept override {
return runId; }
376 bool cleanupRestartSubValue(
void);
controller for child process: receive input parameters from root and send output tables.
Definition: runControllerImpl.h:234
virtual int nextRun(void) override
create new run and input parameters in database.
Definition: childController.cpp:192
ChildController(int i_processCount, const ArgReader &i_argStore, IMsgExec *i_msgExec)
create new child run controller
Definition: runControllerImpl.h:237
virtual void shutdownRun(int i_runId) override
model run shutdown: save results and update run status.
Definition: childController.cpp:243
virtual void shutdownOnExit(ModelStatus i_status) override
model process shutdown if exiting without completion (ie: exit on error).
Definition: childController.cpp:222
virtual void readParameter(const char *i_name, int i_subId, const type_info &i_type, size_t i_size, void *io_valueArr) override
read input parameter values.
Definition: childController.cpp:259
virtual ~ChildController(void) noexcept
last cleanup
Definition: runControllerImpl.h:250
virtual void shutdownWaitAll(void) override
model process shutdown: cleanup resources.
Definition: childController.cpp:228
virtual bool childExchange(void) override
exchange between root and child process to send and receive status update.
Definition: childController.cpp:311
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) override
send output table accumulators to root process.
Definition: childController.cpp:280
Definition: modelHelper.h:17
database connection wrapper to execute sql commands.
Definition: dbExec.h:21
public interface for message passing
Definition: msg.h:138
virtual int rank(void) const =0
return current process rank.
controller for "restart run": calculate outstanding sub-values for existing run
Definition: runControllerImpl.h:321
virtual bool childExchange(void) override
communicate with between main therad and modeling threads to receive status update.
Definition: restartController.cpp:293
RestartController(const ArgReader &i_argStore, IDbExec *i_dbExec)
create new "restart run" controller
Definition: runControllerImpl.h:324
virtual void shutdownWaitAll(void) override
model process shutdown: cleanup resources.
Definition: runControllerImpl.h:355
virtual void readParameter(const char *i_name, int i_subId, const type_info &i_type, size_t i_size, void *io_valueArr) override
read input parameter values.
Definition: restartController.cpp:250
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) override
write output table accumulators.
Definition: restartController.cpp:274
virtual ~RestartController(void) noexcept
last cleanup
Definition: runControllerImpl.h:332
virtual int nextRun(void) override
create new run and input parameters in database.
Definition: restartController.cpp:126
virtual void shutdownRun(int i_runId) override
model run shutdown: save results and update run status.
Definition: runControllerImpl.h:352
virtual void shutdownOnExit(ModelStatus i_status) override
model process shutdown if exiting without completion (ie: exit on error).
Definition: runControllerImpl.h:358
controller for root process: create new model run(s), send input parameters to children and receieve ...
Definition: runControllerImpl.h:90
virtual bool childExchange(void) override
exchange between root and child processes and threads.
Definition: rootController.cpp:354
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) override
write output table accumulators.
Definition: rootController.cpp:628
virtual void shutdownRun(int i_runId) override
model run shutdown: save results and update run status.
Definition: rootController.cpp:521
virtual void shutdownWaitAll(void) override
model process shutdown: wait for all child to be completed and do final cleanup.
Definition: rootController.cpp:448
virtual int nextRun(void) override
create new run and input parameters in database.
Definition: rootController.cpp:294
RootController(int i_processCount, const ArgReader &i_argStore, IDbExec *i_dbExec, IMsgExec *i_msgExec)
create new root run controller
Definition: runControllerImpl.h:93
virtual void shutdownOnExit(ModelStatus i_status) override
model process shutdown if exiting without completion (ie: exit on error).
Definition: rootController.cpp:440
int currentRunId(void) const noexcept override
return run id of root process model run, if root process is doing any model runs
Definition: runControllerImpl.h:145
virtual void readParameter(const char *i_name, int i_subId, const type_info &i_type, size_t i_size, void *io_valueArr) override
read input parameter values.
Definition: rootController.cpp:573
virtual void init(void) override
initialize root modeling process.
Definition: rootController.cpp:92
virtual ~RootController(void) noexcept
last cleanup
Definition: runControllerImpl.h:106
run controller: create new model run(s) and support data exchange.
Definition: runController.h:24
int processCount
number of modeling processes: MPI world size
Definition: runController.h:33
void doShutdownAll(int i_taskRunId, IDbExec *i_dbExec)
implementation model process shutdown.
Definition: runController.cpp:127
void doShutdownOnExit(ModelStatus i_status, int i_runId, int i_taskRunId, IDbExec *i_dbExec)
impelementation of model process shutdown if exiting without completion.
Definition: runController.cpp:66
void doShutdownRun(int i_runId, int i_taskRunId, IDbExec *i_dbExec)
implementation of model run shutdown.
Definition: runController.cpp:157
int processRank
modeling processes rank: MPI rank
Definition: runController.h:36
controller for single process: create new model run(s), read input parameters and write output tables...
Definition: runControllerImpl.h:23
virtual void init(void) override
initialize root modeling process.
Definition: singleController.cpp:76
virtual void readParameter(const char *i_name, int i_subId, const type_info &i_type, size_t i_size, void *io_valueArr) override
read input parameter values.
Definition: singleController.cpp:184
SingleController(const ArgReader &i_argStore, IDbExec *i_dbExec)
create new single process run controller
Definition: runControllerImpl.h:26
int currentRunId(void) const noexcept override
get run id of the current model run.
Definition: runControllerImpl.h:73
virtual void shutdownRun(int i_runId) override
model run shutdown: save results and update run status.
Definition: runControllerImpl.h:57
virtual void shutdownWaitAll(void) override
model process shutdown: cleanup resources.
Definition: runControllerImpl.h:60
virtual int nextRun(void) override
create new run and input parameters in database.
Definition: singleController.cpp:149
virtual ~SingleController(void) noexcept
last cleanup
Definition: runControllerImpl.h:37
virtual bool childExchange(void) override
communicate with between main therad and modeling threads to receive status update.
Definition: singleController.cpp:227
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) override
write output table accumulators.
Definition: singleController.cpp:208
virtual void shutdownOnExit(ModelStatus i_status) override
model process shutdown if exiting without completion (ie: exit on error).
Definition: runControllerImpl.h:63
OpenM++ data library: output table interfaces.
OpenM++ data library: input parameter interfaces.
OpenM++ data library: db value classes access value rows: input parameter, accumulator or expression ...
openM++ namespace
Definition: log.h:32
MsgTag
tag to identify message content
Definition: msg.h:29
ModelStatus
modeling job status
Definition: omModelRunState.h:43
arguments reader to get runtime arguments from command line and ini-file.
Definition: argReader.h:56
Definition: modelHelper.h:47
Definition: modelHelper.h:67
basic model run options
Definition: omModel.h:26