#include <sim.h>
Public Member Functions | |
sim (void) | |
Basic Constructor. | |
sim (CkMigrateMessage *) | |
virtual | ~sim () |
Destructor. | |
void | pup (PUP::er &p) |
Pack/unpack/sizing operator. | |
void | Step () |
Start a forward execution step on myStrat. | |
void | Step (prioMsg *m) |
Start a prioritized forward execution step on myStrat. | |
void | CheckpointStep (eventMsg *m) |
Start a forward execution step on myStrat after a checkpoint (sequential mode only). | |
void | Status () |
Report safe time to PVT branch. | |
void | Commit () |
Commit events based on new GVT estimate. | |
void | CheckpointCommit () |
Commit all possible events before a checkpoint to disk. | |
void | Cancel (cancelMsg *m) |
Add m to cancellation list. | |
void | ReportLBdata () |
Report load information to local load balancer. | |
void | Migrate (destMsg *m) |
Migrate this poser to processor indicated in m. | |
void | Terminate () |
Terminate this poser, when everyone is terminated we exit. | |
void | SeqBeginCheckpoint () |
In sequential mode, begin checkpoint after reaching quiescence. | |
void | SeqResumeAfterCheckpoint () |
In sequential mode, resume after checkpointing or restarting. | |
void | invokeStopEvent () |
Implement this for posers that will need to execute events when POSE reaches quiescence. | |
void | setSimulationStartGVT (POSE_TimeType startGVT) |
Set simulationStartGVT in the rep. | |
int | PVTindex () |
Return this poser's unique index on PVT branch. | |
int | IsActive () |
Test active flag. | |
void | Activate () |
Set active flag. | |
void | Deactivate () |
Unset active flag. | |
virtual void | ResolveFn (int fnIdx, void *msg) |
Invoke an event on this poser according to fnIdx and pass it msg. | |
virtual void | ResolveCommitFn (int fnIdx, void *msg) |
Invoke the commit version of an event to handle special behaviors. | |
void | registerSent (POSE_TimeType timestamp) |
Notify the PVT of a message send. | |
void | CommitPrintf (const char *Fmt,...) |
Used for buffered output. | |
void | CommitError (const char *Fmt,...) |
Used for buffered output of error messages. | |
void | ResumeFromSync (void) |
void | dump () |
Dump all data fields. | |
Data Fields | |
eventQueue * | eq |
This poser's event queue. | |
strat * | myStrat |
This poser's synchronization strategy. | |
rep * | objID |
This poser's user representation. | |
CancelList | cancels |
List of incoming cancellations for this poser. | |
PVT * | localPVT |
The local PVT to report to. | |
int | myPVTidx |
Unique global ID for this object on PVT branch. | |
int | myLBidx |
Unique global ID for this object in load balancing data structures. | |
int | DOs |
Number of forward execution steps. | |
int | UNDOs |
Number of undone events. | |
int | sync |
Synchronization strategy type (optimistic or conservative). | |
int * | srVector |
Number of sends/recvs per PE. | |
POSE_TimeType | lastGVT |
Most recent GVT estimate. | |
double | st |
Relative start time, end time, and current time. | |
double | et |
double | ct |
localStat * | localStats |
The local statistics collector. | |
POSE_TimeType | dop_override_evt |
Used to manually override the value of evt for DOP calculations. | |
long long | basicStats [2] |
Used to count the number of commits (in [0]) and rollbacks (in [1]). | |
LBgroup * | localLBG |
The local load balancer. | |
Protected Attributes | |
int | active |
Flag to indicate that a Step message is scheduled. | |
Private Member Functions | |
void | InternalCommitPrintf (const char *Fmt, va_list ap) |
Used by buffered print functions. |
The poser base class: all user posers are translated to classes that inherit from this class, and act as wrappers around the actual user object's representation to control the simulation behavior. These objects are plugged into the POSE_objects array which is of this type.
Definition at line 191 of file sim.h.
sim::sim | ( | void | ) |
Basic Constructor.
Definition at line 13 of file sim.C.
References active, basicStats, CkLocalBranch(), Converse::CkMyPe(), Converse::CkNumPes(), DOs, eq, int, lastGVT, POSE_Config::lb_on, localLBG, localPVT, localStats, malloc(), myStrat, objID, pose_config, srVector, POSE_Config::stats, TheLBG, theLocalStats, ThePVT, and UNDOs.
sim::sim | ( | CkMigrateMessage * | ) | [inline] |
sim::~sim | ( | ) | [virtual] |
Destructor.
Definition at line 38 of file sim.C.
References active, eq, POSE_Config::lb_on, localLBG, localPVT, myLBidx, myPVTidx, myStrat, objID, LBgroup::objRemove(), PVT::objRemove(), and pose_config.
void sim::pup | ( | PUP::er & | p | ) |
Pack/unpack/sizing operator.
Definition at line 53 of file sim.C.
References active, basicStats, cancels, CkLocalBranch(), DOs, eq, PVT::getGVT(), PUP::er::isUnpacking(), POSE_Config::lb_on, localLBG, localPVT, localStats, myLBidx, myPVTidx, LBgroup::objRegister(), PVT::objRegister(), p, pose_config, POSE_Skipped_Events, poseIndexOfStopEvent, CancelList::pup(), eventQueue::pup(), PUP::PUParray(), seqCheckpointInProgress, seqLastCheckpointGVT, seqLastCheckpointTime, seqStartTime, sync, TheLBG, theLocalStats, ThePVT, and UNDOs.
void sim::Step | ( | ) |
Start a forward execution step on myStrat.
Definition at line 95 of file sim.C.
References active, CmiWallTimer(), localStats, myStrat, pose_config, POSE_Config::stats, strat::Step(), strat::STRAT_T, localStat::SwitchTimer(), localStat::TimerRunning(), localStat::TimerStart(), localStat::TimerStop(), POSE_Config::trace, and traceUserBracketEvent().
Referenced by Commit().
void sim::Step | ( | prioMsg * | m | ) |
Start a prioritized forward execution step on myStrat.
Definition at line 143 of file sim.C.
References active, CkFreeMsg(), localStats, myStrat, pose_config, POSE_Config::stats, strat::Step(), localStat::SwitchTimer(), localStat::TimerRunning(), localStat::TimerStart(), and localStat::TimerStop().
void sim::CheckpointStep | ( | eventMsg * | m | ) |
Start a forward execution step on myStrat after a checkpoint (sequential mode only).
Definition at line 171 of file sim.C.
References active, CkFreeMsg(), localStats, myStrat, pose_config, POSE_Config::stats, strat::Step(), strat::STRAT_T, localStat::SwitchTimer(), localStat::TimerRunning(), localStat::TimerStart(), and localStat::TimerStop().
void sim::Status | ( | ) | [inline] |
Report safe time to PVT branch.
Definition at line 262 of file sim.h.
References localPVT, myPVTidx, myStrat, objID, PVT::objUpdateOVT(), rep::OVT(), and strat::SafeTime().
Referenced by spec::Step(), opt3::Step(), opt2::Step(), opt::Step(), adapt5::Step(), adapt4::Step(), adapt3::Step(), adapt2::Step(), and adapt::Step().
void sim::Commit | ( | ) |
Commit events based on new GVT estimate.
Definition at line 198 of file sim.C.
References active, CmiWallTimer(), eventQueue::CommitEvents(), eventQueue::currentPtr, PVT::done(), eq, PVT::getGVT(), lastGVT, localPVT, localStats, pose_config, POSE_endtime, POSE_Config::stats, Step(), localStat::SwitchTimer(), Terminate(), localStat::TimerRunning(), localStat::TimerStart(), localStat::TimerStop(), Event::timestamp, POSE_Config::trace, and traceUserBracketEvent().
void sim::CheckpointCommit | ( | ) |
Commit all possible events before a checkpoint to disk.
Definition at line 252 of file sim.C.
References active, CmiWallTimer(), eventQueue::CommitEvents(), eq, PVT::getGVT(), lastGVT, localPVT, localStats, pose_config, POSE_Config::stats, localStat::SwitchTimer(), localStat::TimerRunning(), localStat::TimerStart(), localStat::TimerStop(), POSE_Config::trace, and traceUserBracketEvent().
void sim::Cancel | ( | cancelMsg * | m | ) |
Add m to cancellation list.
Definition at line 310 of file sim.C.
References cancels, CkFreeMsg(), CmiWallTimer(), cancelMsg::evID, CancelList::Insert(), localPVT, localStats, myStrat, PVT::objUpdate(), pose_config, POSE_Config::stats, strat::Step(), localStat::SwitchTimer(), localStat::TimerStart(), localStat::TimerStop(), cancelMsg::timestamp, POSE_Config::trace, and traceUserBracketEvent().
void sim::ReportLBdata | ( | ) |
Report load information to local load balancer.
Definition at line 289 of file sim.C.
References Converse::CkNumPes(), eventQueue::currentPtr, DOs, eq, POSE_Config::lb_on, localLBG, myLBidx, Event::next, objID, LBgroup::objUpdate(), rep::ovt, pose_config, POSE_UnsetTS, srVector, Event::timestamp, and UNDOs.
void sim::Migrate | ( | destMsg * | m | ) | [inline] |
Migrate this poser to processor indicated in m.
Definition at line 274 of file sim.h.
References destMsg::destPE.
void sim::Terminate | ( | ) | [inline] |
Terminate this poser, when everyone is terminated we exit.
Definition at line 276 of file sim.h.
References basicStats, objID, POSE_prepExit(), CkReduction::sum_int, and rep::terminus().
Referenced by Commit().
void sim::SeqBeginCheckpoint | ( | ) |
In sequential mode, begin checkpoint after reaching quiescence.
Definition at line 368 of file sim.C.
References cb, CkStartCheckpoint(), CmiWallTimer(), seqCheckpointInProgress, seqLastCheckpointGVT, and seqStartTime.
void sim::SeqResumeAfterCheckpoint | ( | ) |
In sequential mode, resume after checkpointing or restarting.
Definition at line 380 of file sim.C.
References CkStartQD(), CmiWallTimer(), ct, eventQueue::currentPtr, POSE_Config::dop, eq, localStats, objID, rep::ovt, pose_config, POSE_GlobalClock, POSE_Skipped_Events, rep::registerTimestamp(), eventMsg::rst, eventMsg::sanitize(), seqCheckpointInProgress, seqLastCheckpointGVT, seqStartTime, Skipped_Event::simIndex, Event::srt, st, POSE_Config::stats, localStat::SwitchTimer(), and Skipped_Event::timestamp.
void sim::invokeStopEvent | ( | ) | [inline] |
void sim::setSimulationStartGVT | ( | POSE_TimeType | startGVT | ) | [inline] |
int sim::PVTindex | ( | ) | [inline] |
int sim::IsActive | ( | ) | [inline] |
Test active flag.
Definition at line 298 of file sim.h.
References active.
Referenced by pvtObjectNode::sanitize().
void sim::Activate | ( | ) | [inline] |
Set active flag.
Definition at line 300 of file sim.h.
References active.
Referenced by strat::Step().
void sim::Deactivate | ( | ) | [inline] |
Unset active flag.
Definition at line 302 of file sim.h.
References active.
Referenced by strat::Step().
virtual void sim::ResolveFn | ( | int | fnIdx, | |
void * | msg | |||
) | [inline, virtual] |
Invoke an event on this poser according to fnIdx and pass it msg.
ResolveFn is generated along with the rest of the wrapper object and should handle all possible events on a poser.
Definition at line 306 of file sim.h.
Referenced by opt::Rollback(), strat::Step(), spec::Step(), seq::Step(), opt3::Step(), opt2::Step(), opt::Step(), con::Step(), adapt5::Step(), adapt4::Step(), adapt3::Step(), adapt2::Step(), and adapt::Step().
virtual void sim::ResolveCommitFn | ( | int | fnIdx, | |
void * | msg | |||
) | [inline, virtual] |
Invoke the commit version of an event to handle special behaviors.
This invokes the <fn>_commit method that user provides. It can be used to perform special activities, statistics gathering, output, or whatever the user wishes.
Definition at line 311 of file sim.h.
Referenced by eventQueue::CommitEvents().
void sim::registerSent | ( | POSE_TimeType | timestamp | ) | [inline] |
Notify the PVT of a message send.
Definition at line 313 of file sim.h.
References localPVT, and PVT::objUpdate().
Referenced by rep::registerTimestamp(), and chpt< StateType >::registerTimestamp().
void sim::CommitPrintf | ( | const char * | Fmt, | |
... | ||||
) | [inline] |
Used for buffered output.
Output is only printed when the event is committed
Definition at line 318 of file sim.h.
References InternalCommitPrintf().
void sim::CommitError | ( | const char * | Fmt, | |
... | ||||
) | [inline] |
Used for buffered output of error messages.
Output is only printed when the event is committed
Definition at line 326 of file sim.h.
References Event::commitErr, strat::currentEvent, InternalCommitPrintf(), and myStrat.
void sim::dump | ( | ) |
Dump all data fields.
Definition at line 431 of file sim.C.
References active, cancels, CancelList::dump(), eventQueue::dump(), rep::dump(), eq, myPVTidx, objID, and sync.
void sim::InternalCommitPrintf | ( | const char * | Fmt, | |
va_list | ap | |||
) | [inline, private] |
Used by buffered print functions.
Definition at line 338 of file sim.h.
References CkExit(), Event::commitBfr, Event::commitBfrLen, strat::currentEvent, free(), malloc(), and myStrat.
Referenced by CommitError(), and CommitPrintf().
int sim::active [protected] |
Flag to indicate that a Step message is scheduled.
Need to re-evaluate the need/function of this... also, how is it used during load balancing...
Definition at line 196 of file sim.h.
Referenced by Activate(), CheckpointCommit(), CheckpointStep(), Commit(), Deactivate(), dump(), IsActive(), pup(), sim(), Step(), and ~sim().
This poser's event queue.
Definition at line 199 of file sim.h.
Referenced by chpt< StateType >::checkpoint(), CheckpointCommit(), Commit(), dump(), pup(), ReportLBdata(), SeqResumeAfterCheckpoint(), sim(), rep::update(), and ~sim().
This poser's synchronization strategy.
Definition at line 201 of file sim.h.
Referenced by Cancel(), chpt< StateType >::checkpoint(), CheckpointStep(), CommitError(), eventQueue::CommitStatsHelper(), InternalCommitPrintf(), sim(), Status(), Step(), pvtObjects::StratCalcs(), and ~sim().
This poser's user representation.
Definition at line 203 of file sim.h.
Referenced by eventQueue::CommitEvents(), dump(), ReportLBdata(), SeqResumeAfterCheckpoint(), setSimulationStartGVT(), sim(), Status(), Terminate(), and ~sim().
List of incoming cancellations for this poser.
Definition at line 205 of file sim.h.
Referenced by Cancel(), con::CancelEvents(), dump(), pup(), opt::Rollback(), opt::SafeTime(), con::SafeTime(), spec::Step(), opt3::Step(), opt2::Step(), opt::Step(), con::Step(), adapt5::Step(), adapt4::Step(), adapt3::Step(), adapt2::Step(), and adapt::Step().
Unique global ID for this object in load balancing data structures.
Definition at line 211 of file sim.h.
Referenced by pup(), ReportLBdata(), and ~sim().
Number of forward execution steps.
Is this needed/used? This is load balancing data...
Definition at line 214 of file sim.h.
Referenced by pup(), ReportLBdata(), sim(), and con::Step().
Number of undone events.
Is this needed/used? This is load balancing data...
Definition at line 217 of file sim.h.
Referenced by pup(), ReportLBdata(), opt::Rollback(), and sim().
Synchronization strategy type (optimistic or conservative).
Definition at line 219 of file sim.h.
Referenced by dump(), seq::initSync(), opt::initSync(), con::initSync(), and pup().
Number of sends/recvs per PE.
Definition at line 221 of file sim.h.
Referenced by ReportLBdata(), and sim().
double sim::st |
Relative start time, end time, and current time.
Used to calculate degree of parallelism
Definition at line 226 of file sim.h.
Referenced by SeqResumeAfterCheckpoint().
double sim::ct |
The local statistics collector.
Definition at line 229 of file sim.h.
Referenced by Cancel(), CheckpointCommit(), CheckpointStep(), Commit(), pup(), SeqResumeAfterCheckpoint(), sim(), and Step().
long long sim::basicStats[2] |
Used to count the number of commits (in [0]) and rollbacks (in [1]).
Definition at line 245 of file sim.h.
Referenced by eventQueue::CommitEvents(), pup(), opt::Rollback(), sim(), adapt5::Step(), and Terminate().