SST  7.1.0
StructuralSimulationToolkit
SST::Simulation Class Reference

Main control class for a SST Simulation. More...

#include <simulation.h>

Public Types

enum  Mode_t { UNKNOWN, INIT, RUN, BOTH }
 Type of Run Modes. More...
 
typedef std::map< std::pair< SimTime_t, int >, Clock * > clockMap_t
 
typedef std::map< std::pair< SimTime_t, int >, OneShot * > oneShotMap_t
 

Public Member Functions

void printStatus (bool fullStatus)
 Causes the current status of the simulation to be printed to stderr. More...
 
void processGraphInfo (ConfigGraph &graph, const RankInfo &myRank, SimTime_t min_part)
 Processes the ConfigGraph to pull out any need information about relationships among the threads.
 
int performWireUp (ConfigGraph &graph, const RankInfo &myRank, SimTime_t min_part)
 Converts a ConfigGraph graph into actual set of links and components.
 
void setStopAtCycle (Config *cfg)
 Set cycle count, which, if reached, will cause the simulation to halt. More...
 
void initialize ()
 Perform the init() phase of simulation.
 
void setup ()
 Perform the setup() and run phases of the simulation. More...
 
void run ()
 
void finish ()
 
bool isIndependentThread ()
 
Mode_t getSimulationMode () const
 Get the run mode of the simulation (e.g. More...
 
const SimTime_t & getCurrentSimCycle () const
 Return the current simulation time as a cycle count.
 
SimTime_t getEndSimCycle () const
 Return the end simulation time as a cycle count.
 
int getCurrentPriority () const
 Return the current priority.
 
UnitAlgebra getElapsedSimTime () const
 Return the elapsed simulation time as a time.
 
UnitAlgebra getFinalSimTime () const
 Return the end simulation time as a time.
 
RankInfo getRank () const
 Get this instance's parallel rank.
 
RankInfo getNumRanks () const
 Get the number of parallel ranks in the simulation.
 
TimeConverterregisterClock (const std::string &freq, Clock::HandlerBase *handler, int priority)
 Register a handler to be called on a set frequency.
 
TimeConverterregisterClock (const UnitAlgebra &freq, Clock::HandlerBase *handler, int priority)
 
TimeConverterregisterClock (TimeConverter *tcFreq, Clock::HandlerBase *handler, int priority)
 
void unregisterClock (TimeConverter *tc, Clock::HandlerBase *handler, int priority)
 Remove a clock handler from the list of active clock handlers.
 
Cycle_t reregisterClock (TimeConverter *tc, Clock::HandlerBase *handler, int priority)
 Reactivate an existing clock and handler. More...
 
Cycle_t getNextClockCycle (TimeConverter *tc, int priority=CLOCKPRIORITY)
 Returns the next Cycle that the TImeConverter would fire. More...
 
TimeConverterregisterOneShot (std::string timeDelay, OneShot::HandlerBase *handler, int priority)
 Register a OneShot event to be called after a time delay Note: OneShot cannot be canceled, and will always callback after the timedelay.
 
TimeConverterregisterOneShot (const UnitAlgebra &timeDelay, OneShot::HandlerBase *handler, int priority)
 
void insertActivity (SimTime_t time, Activity *ev)
 Insert an activity to fire at a specified time.
 
ExitgetExit () const
 Return the exit event.
 
const std::vector< SimTime_t > & getInterThreadLatencies () const
 
SimTime_t getInterThreadMinLatency () const
 
uint64_t getTimeVortexMaxDepth () const
 
uint64_t getTimeVortexCurrentDepth () const
 
uint64_t getSyncQueueDataSize () const
 
Statistics::StatisticProcessingEnginegetStatisticsProcessingEngine (void) const
 Return the Statistic Processing Engine associated with this Simulation.
 
LinkMapgetComponentLinkMap (ComponentId_t id) const
 Return pointer to map of links for a given component id.
 
const ComponentInfoMapgetComponentInfoMap (void)
 Returns reference to the Component Map. More...
 
BaseComponentgetComponent (const ComponentId_t &id) const
 returns the component with the given ID
 
ComponentInfogetComponentInfo (const ComponentId_t &id) const
 
void setOutputDirectory (std::string &outDir)
 Set the output directory for this simulation. More...
 
std::string & getOutputDirectory ()
 Returns the output directory of the simulation. More...
 
void requireEvent (std::string name)
 Signifies that an event type is required for this simulation Causes to Factory to verify that the required event type can be found. More...
 
SimTime_t getNextActivityTime () const
 Returns the time of the next item to be executed that is in the TImeVortex of the Simulation.
 
bool isWireUpFinished ()
 Returns true when the Wireup is finished.
 

Static Public Member Functions

static SimulationcreateSimulation (Config *config, RankInfo my_rank, RankInfo num_ranks, SimTime_t min_part)
 Create new simulation. More...
 
static void shutdown ()
 Used to signify the end of simulation. More...
 
static SimulationgetSimulation ()
 Return a pointer to the singleton instance of the Simulation.
 
static void setSignal (int signal)
 Sets an internal flag for signaling the simulation. More...
 
static TimeConvertergetMinPartTC ()
 
static TimeLordgetTimeLord (void)
 Return the TimeLord associated with this Simulation.
 
static OutputgetSimulationOutput ()
 Return the base simulation Output class instance.
 
static SimTime_t getLocalMinimumNextActivityTime ()
 Gets the minimum next activity time across all TimeVortices in the Rank.
 
static SharedRegionManagergetSharedRegionManager ()
 Returns the Simulation's SharedRegionManager.
 

Friends

class Link
 
class Action
 
class Output
 
class SyncManager
 
void wait_my_turn_start ()
 
void wait_my_turn_end ()
 

Detailed Description

Main control class for a SST Simulation.

Provides base features for managing the simulation

Member Typedef Documentation

◆ clockMap_t

typedef std::map<std::pair<SimTime_t, int>, Clock*> SST::Simulation::clockMap_t

Map of times to clocks

◆ oneShotMap_t

typedef std::map<std::pair<SimTime_t, int>, OneShot*> SST::Simulation::oneShotMap_t

Map of times to OneShots

Member Enumeration Documentation

◆ Mode_t

Type of Run Modes.

Enumerator
UNKNOWN 

Unknown mode - Invalid for running

INIT 

Initialize-only. Useful for debugging initialization and graph generation

RUN 

Run-only. Useful when restoring from a checkpoint

BOTH 

Default. Both initialize and Run the simulation

Member Function Documentation

◆ createSimulation()

Simulation * SST::Simulation::createSimulation ( Config config,
RankInfo  my_rank,
RankInfo  num_ranks,
SimTime_t  min_part 
)
static

Create new simulation.

Parameters
config- Configuration of the simulation
my_rank- Parallel Rank of this simulation object
num_ranks- How many Ranks are in the simulation

◆ getComponentInfoMap()

const ComponentInfoMap& SST::Simulation::getComponentInfoMap ( void  )
inline

Returns reference to the Component Map.

Returns reference to the Component ID Map

◆ getNextClockCycle()

Cycle_t SST::Simulation::getNextClockCycle ( TimeConverter tc,
int  priority = CLOCKPRIORITY 
)

Returns the next Cycle that the TImeConverter would fire.

References SST::Output::fatal(), SST::TimeConverter::getFactor(), and SST::Output::STDERR.

◆ getOutputDirectory()

std::string& SST::Simulation::getOutputDirectory ( )
inline

Returns the output directory of the simulation.

Returns
Directory in which simulation outputs are placed

◆ getSimulationMode()

Mode_t SST::Simulation::getSimulationMode ( ) const
inline

Get the run mode of the simulation (e.g.

init, run, both etc)

◆ printStatus()

void SST::Simulation::printStatus ( bool  fullStatus)

Causes the current status of the simulation to be printed to stderr.

Parameters
fullStatus- if true, call printStatus() on all components as well as print the base Simulation's status

References SST::Output::output(), and SST::Output::STDERR.

◆ requireEvent()

void SST::Simulation::requireEvent ( std::string  name)

Signifies that an event type is required for this simulation Causes to Factory to verify that the required event type can be found.

Parameters
namefully qualified libraryName.EventName

◆ reregisterClock()

Cycle_t SST::Simulation::reregisterClock ( TimeConverter tc,
Clock::HandlerBase handler,
int  priority 
)

Reactivate an existing clock and handler.

Returns
time when handler will next fire

References SST::Output::fatal(), SST::TimeConverter::getFactor(), and SST::Output::STDERR.

◆ setOutputDirectory()

void SST::Simulation::setOutputDirectory ( std::string &  outDir)
inline

Set the output directory for this simulation.

Parameters
outDirPath of directory to place simulation outputs in

◆ setSignal()

void SST::Simulation::setSignal ( int  signal)
static

Sets an internal flag for signaling the simulation.

Used internally

◆ setStopAtCycle()

void SST::Simulation::setStopAtCycle ( Config cfg)

Set cycle count, which, if reached, will cause the simulation to halt.

References SST::Activity::setDeliveryTime(), and SST::Config::stopAtCycle.

◆ setup()

void SST::Simulation::setup ( )

Perform the setup() and run phases of the simulation.

References SST::Activity::setDeliveryTime().

◆ shutdown()

void SST::Simulation::shutdown ( )
static

Used to signify the end of simulation.

Cleans up any existing Simulation Objects

References SST::Config::getVerboseLevel(), SST::Config::heartbeatPeriod, SST::Config::output_core_prefix, SST::Config::runMode, and SST::Output::STDOUT.


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