|
SST
14.0.0
StructuralSimulationToolkit
|
Main control class for a SST Simulation. More...
#include <simulation_impl.h>
Public Types | |
| enum | ShutdownMode_t { SHUTDOWN_CLEAN, SHUTDOWN_SIGNAL, SHUTDOWN_EMERGENCY } |
| 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 | |
| SimulationRunMode | getSimulationMode () const |
| Get the run mode of the simulation (e.g. More... | |
| SimTime_t | getCurrentSimCycle () const |
| Return the current simulation time as a cycle count. More... | |
| 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 | getEndSimTime () 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. | |
| std::string & | getOutputDirectory () |
Returns the output directory of the simulation More... | |
| void | requireLibrary (const std::string &name) |
| Signifies that a library is required for this simulation. More... | |
| void | printStatus (bool fullStatus) |
| Causes the current status of the simulation to be printed to stderr. More... | |
| double | getRunPhaseElapsedRealTime () const |
| double | getInitPhaseElapsedRealTime () const |
| double | getCompletePhaseElapsedRealTime () const |
| void | insertActivity (SimTime_t time, Activity *ev) |
| Insert an activity to fire at a specified time. | |
| Exit * | getExit () const |
| Return the exit event. | |
| 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 | initializeStatisticEngine (ConfigGraph &graph) |
| int | prepareLinks (ConfigGraph &graph, const RankInfo &myRank, SimTime_t min_part) |
| int | performWireUp (ConfigGraph &graph, const RankInfo &myRank, SimTime_t min_part) |
| void | exchangeLinkInfo () |
| 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 | complete () |
| Perform the complete() phase of simulation. | |
| void | setup () |
| Perform the setup() and run phases of the simulation. More... | |
| void | prepare_for_run () |
| void | run () |
| void | finish () |
| void | adjustTimeAtSimEnd () |
| Adjust clocks and time to reflect precise simulation end time which may differ in parallel simulations from the time simulation end is detected. | |
| bool | isIndependentThread () |
| void | printProfilingInfo (FILE *fp) |
| void | printPerformanceInfo () |
| TimeConverter * | registerOneShot (const 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. | |
| TimeConverter * | registerOneShot (const UnitAlgebra &timeDelay, OneShot::HandlerBase *handler, int priority) |
| const std::vector< SimTime_t > & | getInterThreadLatencies () const |
| SimTime_t | getInterThreadMinLatency () const |
| LinkMap * | getComponentLinkMap (ComponentId_t id) const |
| const ComponentInfoMap & | getComponentInfoMap (void) |
| Returns reference to the Component Info Map. | |
| BaseComponent * | getComponent (const ComponentId_t &id) const |
| returns the component with the given ID | |
| ComponentInfo * | getComponentInfo (const ComponentId_t &id) const |
| returns the ComponentInfo object for the given ID | |
| void | setOutputDirectory (const std::string &outDir) |
Set the output directory for this simulation More... | |
| bool | isWireUpFinished () |
| Returns true when the Wireup is finished. | |
| uint64_t | getTimeVortexMaxDepth () const |
| uint64_t | getTimeVortexCurrentDepth () const |
| uint64_t | getSyncQueueDataSize () const |
| TimeConverter * | registerClock (const std::string &freq, Clock::HandlerBase *handler, int priority) |
| Register a handler to be called on a set frequency. | |
| TimeConverter * | registerClock (const UnitAlgebra &freq, Clock::HandlerBase *handler, int priority) |
| TimeConverter * | registerClock (TimeConverter *tcFreq, Clock::HandlerBase *handler, int priority) |
| void | registerClock (SimTime_t factor, 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... | |
| SimTime_t | getClockForHandler (Clock::HandlerBase *handler) |
| Gets the clock the handler is registered with, represented by it's factor. More... | |
| Statistics::StatisticProcessingEngine * | getStatisticsProcessingEngine (void) |
| Return the Statistic Processing Engine associated with this Simulation. | |
| friend | int ::main (int argc, char **argv) |
| Simulation_impl (Config *config, RankInfo my_rank, RankInfo num_ranks) | |
| Simulation_impl (Simulation_impl const &) | |
| void | operator= (Simulation_impl const &) |
| TimeConverter * | minPartToTC (SimTime_t cycles) const |
| Get a handle to a TimeConverter. More... | |
| void | checkpoint () |
| void | restart (Config *config) |
| Component * | createComponent (ComponentId_t id, const std::string &name, Params ¶ms) |
| TimeVortex * | getTimeVortex () const |
| void | endSimulation (void) |
| Normal Shutdown. | |
| void | endSimulation (SimTime_t end) |
| void | intializeProfileTools (const std::string &config) |
| Performance Tracking Information. | |
| template<typename T > | |
| std::vector< T * > | getProfileTool (std::string point) |
| void | printSimulationState () |
Static Public Member Functions | |
| static Simulation_impl * | getSimulation () |
| Return a pointer to the singleton instance of the Simulation. | |
| static TimeLord * | getTimeLord (void) |
| Return the TimeLord associated with this Simulation. | |
| static Output & | getSimulationOutput () |
| Return the base simulation Output class instance. | |
| static Simulation_impl * | createSimulation (Config *config, RankInfo my_rank, RankInfo num_ranks) |
| Create new simulation. More... | |
| static void | shutdown () |
| Used to signify the end of simulation. More... | |
| static void | setSignal (int signal) |
| Sets an internal flag for signaling the simulation. More... | |
| static TimeConverter * | getMinPartTC () |
| static SimTime_t | getLocalMinimumNextActivityTime () |
| Gets the minimum next activity time across all TimeVortices in the Rank. | |
| static void | resizeBarriers (uint32_t nthr) |
| static void | emergencyShutdown () |
| Emergency Shutdown Called when a SIGINT or SIGTERM has been seen. | |
Data Fields | |
| bool | direct_interthread |
| TimeVortex * | timeVortex |
| std::string | timeVortexType |
| TimeConverter * | threadMinPartTC |
| Activity * | current_activity |
| std::vector< SimTime_t > | interThreadLatencies |
| SimTime_t | interThreadMinLatency |
| SyncManager * | syncManager |
| ComponentInfoMap | compInfoMap |
| clockMap_t | clockMap |
| oneShotMap_t | oneShotMap |
| SimulatorHeartbeat * | m_heartbeat = nullptr |
| bool | endSim |
| bool | independent |
| unsigned int | untimed_phase |
| volatile sig_atomic_t | lastRecvdSignal |
| ShutdownMode_t | shutdown_mode |
| bool | wireUpFinished |
| SST::Statistics::StatisticProcessingEngine | stat_engine |
| Statistics Engine. | |
| std::map< std::string, SST::Profile::ProfileTool * > | profile_tools |
| std::map< std::string, std::vector< std::string > > | profiler_map |
| uint64_t | clockDivisor = 1e6 |
| std::string | clockResolution = "us" |
| SimulationRunMode | runMode |
| SimTime_t | currentSimCycle |
| int | currentPriority |
| SimTime_t | endSimCycle |
| RankInfo | my_rank |
| RankInfo | num_ranks |
| std::string | output_directory |
| double | run_phase_start_time |
| double | run_phase_total_time |
| double | init_phase_start_time |
| double | init_phase_total_time |
| double | complete_phase_start_time |
| double | complete_phase_total_time |
| std::map< uintptr_t, Link * > | link_restart_tracking |
| std::map< uintptr_t, uintptr_t > | event_handler_restart_tracking |
| CheckpointAction * | m_checkpoint = nullptr |
| uint32_t | checkpoint_id = 0 |
| std::string | checkpointPrefix = "" |
| std::string | globalOutputFileName = "" |
Static Public Attributes | |
| static Factory * | factory |
| Factory used to generate the simulation components. | |
| static Core::ThreadSafe::Barrier | initBarrier |
| static Core::ThreadSafe::Barrier | completeBarrier |
| static Core::ThreadSafe::Barrier | setupBarrier |
| static Core::ThreadSafe::Barrier | runBarrier |
| static Core::ThreadSafe::Barrier | exitBarrier |
| static Core::ThreadSafe::Barrier | finishBarrier |
| static std::mutex | simulationMutex |
| static Core::ThreadSafe::Spinlock | cross_thread_lock |
| static std::map< LinkId_t, Link * > | cross_thread_links |
| static SimTime_t | minPart |
| static TimeConverter * | minPartTC = nullptr |
| static Exit * | m_exit |
| static std::atomic< int > | untimed_msg_count |
| static TimeLord | timeLord |
| TimeLord of the simulation. | |
| static Output | sim_output |
| Output. | |
| static std::unordered_map< std::thread::id, Simulation_impl * > | instanceMap |
| static std::vector< Simulation_impl * > | instanceVec |
Friends | |
| class | Link |
| class | Action |
| class | Output |
| class | SyncManager |
| void | wait_my_turn_start () |
| void | wait_my_turn_end () |
Main control class for a SST Simulation.
Provides base features for managing the simulation
| typedef std::map<std::pair<SimTime_t, int>, Clock*> SST::Simulation_impl::clockMap_t |
Map of times to clocks
| typedef std::map<std::pair<SimTime_t, int>, OneShot*> SST::Simulation_impl::oneShotMap_t |
Map of times to OneShots
|
static |
Create new simulation.
| config | - Configuration of the simulation |
| my_rank | - Parallel Rank of this simulation object |
| num_ranks | - How many Ranks are in the simulation |
References SST::Config::enabledProfiling(), and intializeProfileTools().
| SimTime_t SST::Simulation_impl::getClockForHandler | ( | Clock::HandlerBase * | handler | ) |
Gets the clock the handler is registered with, represented by it's factor.
| handler | Clock handler to search for |
| SimTime_t SST::Simulation_impl::getCurrentSimCycle | ( | ) | const |
Return the current simulation time as a cycle count.
Simulation functions.
Non-static functions
Referenced by SST::SimulatorHeartbeat::execute(), SST::CheckpointAction::execute(), SST::OneShot::execute(), SST::BaseComponent::getCurrentSimCycle(), SST::Statistics::StatisticOutput::getCurrentSimCycle(), SST::BaseComponent::getCurrentSimTime(), SST::BaseComponent::getCurrentSimTimeMicro(), SST::BaseComponent::getCurrentSimTimeMilli(), SST::BaseComponent::getCurrentSimTimeNano(), SST::Link::recv(), SST::Exit::refDec(), SST::Clock::schedule(), and SST::Clock::updateCurrentCycle().
| Cycle_t SST::Simulation_impl::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.
Referenced by SST::BaseComponent::getNextClockCycle().
|
inline |
Returns the output directory of the simulation
Referenced by SST::BaseComponent::getOutputDirectory().
|
inline |
Get the run mode of the simulation (e.g.
init, run, both etc)
Referenced by SST::BaseComponent::isSimulationRunModeBoth(), SST::BaseComponent::isSimulationRunModeInit(), and SST::BaseComponent::isSimulationRunModeRun().
| TimeConverter * SST::Simulation_impl::minPartToTC | ( | SimTime_t | cycles | ) | const |
Get a handle to a TimeConverter.
Simulation_impl functions.
| cycles | Frequency which is the base of the TimeConverter |
Referenced by processGraphInfo().
| void SST::Simulation_impl::printStatus | ( | bool | fullStatus | ) |
Causes the current status of the simulation to be printed to stderr.
| fullStatus | - if true, call printStatus() on all components as well as print the base Simulation's status |
References SST::Output::output(), SST::TimeVortex::print(), and SST::Output::STDERR.
| void SST::Simulation_impl::requireLibrary | ( | const std::string & | name | ) |
Signifies that a library is required for this simulation.
| name | Name of the library |
References factory.
Referenced by SST::BaseComponent::requireLibrary().
| Cycle_t SST::Simulation_impl::reregisterClock | ( | TimeConverter * | tc, |
| Clock::HandlerBase * | handler, | ||
| int | priority | ||
| ) |
Reactivate an existing clock and handler.
References SST::Output::fatal(), SST::TimeConverter::getFactor(), and SST::Output::STDERR.
Referenced by SST::BaseComponent::reregisterClock().
|
inline |
Set the output directory for this simulation
| outDir | Path of directory to place simulation outputs in |
|
static |
Sets an internal flag for signaling the simulation.
Used internally
| void SST::Simulation_impl::setStopAtCycle | ( | Config * | cfg | ) |
Set cycle count, which, if reached, will cause the simulation to halt.
References SST::TimeLord::getSimCycles(), SST::TimeVortex::insert(), SST::Activity::setDeliveryTime(), SST::Config::stop_at(), and timeLord.
| void SST::Simulation_impl::setup | ( | void | ) |
Perform the setup() and run phases of the simulation.
References SST::Core::ThreadSafe::Barrier::wait().
|
static |
Used to signify the end of simulation.
Cleans up any existing Simulation Objects