SST  13.0.0
StructuralSimulationToolkit
simulation_impl.h
1 // -*- c++ -*-
2 
3 // Copyright 2009-2023 NTESS. Under the terms
4 // of Contract DE-NA0003525 with NTESS, the U.S.
5 // Government retains certain rights in this software.
6 //
7 // Copyright (c) 2009-2023, NTESS
8 // All rights reserved.
9 //
10 // This file is part of the SST software package. For license
11 // information, see the LICENSE file in the top level directory of the
12 // distribution.
13 
14 #ifndef SST_CORE_SIMULATION_IMPL_H
15 #define SST_CORE_SIMULATION_IMPL_H
16 
17 #include "sst/core/clock.h"
18 #include "sst/core/componentInfo.h"
19 #include "sst/core/oneshot.h"
20 #include "sst/core/output.h"
21 #include "sst/core/profile/profiletool.h"
22 #include "sst/core/rankInfo.h"
23 #include "sst/core/simulation.h"
24 #include "sst/core/sst_types.h"
25 #include "sst/core/statapi/statengine.h"
26 #include "sst/core/unitAlgebra.h"
27 
28 #include <atomic>
29 #include <cstdio>
30 #include <iostream>
31 #include <signal.h>
32 #include <thread>
33 #include <unordered_map>
34 
35 /* Forward declare for Friendship */
36 extern int main(int argc, char** argv);
37 
38 namespace SST {
39 
40 #define _SIM_DBG(fmt, args...) __DBG(DBG_SIM, Sim, fmt, ##args)
41 #define STATALLFLAG "--ALLSTATS--"
42 
43 class Activity;
44 class Component;
45 class Config;
46 class ConfigGraph;
47 class Exit;
48 class Factory;
49 class SimulatorHeartbeat;
50 class Link;
51 class LinkMap;
52 class Params;
53 class SharedRegionManager;
54 class SimulatorHeartbeat;
55 class SyncBase;
56 class SyncManager;
57 class ThreadSync;
58 class TimeConverter;
59 class TimeLord;
60 class TimeVortex;
61 class UnitAlgebra;
62 class SharedRegionManager;
63 
64 namespace Statistics {
65 class StatisticOutput;
66 class StatisticProcessingEngine;
67 } // namespace Statistics
68 
69 /**
70  * Main control class for a SST Simulation.
71  * Provides base features for managing the simulation
72  */
74 {
75 
76 public:
77  /******** Public API inherited from Simulation ********/
78  /** Get the run mode of the simulation (e.g. init, run, both etc) */
79  SimulationRunMode getSimulationMode() const override { return runMode; };
80 
81  /** Return the current simulation time as a cycle count*/
82  SimTime_t getCurrentSimCycle() const override;
83 
84  /** Return the end simulation time as a cycle count*/
85  SimTime_t getEndSimCycle() const override;
86 
87  /** Return the current priority */
88  int getCurrentPriority() const override;
89 
90  /** Return the elapsed simulation time as a time */
91  UnitAlgebra getElapsedSimTime() const override;
92 
93  /** Return the end simulation time as a time */
94  UnitAlgebra getEndSimTime() const override;
95 
96  /** Get this instance's parallel rank */
97  RankInfo getRank() const override { return my_rank; }
98 
99  /** Get the number of parallel ranks in the simulation */
100  RankInfo getNumRanks() const override { return num_ranks; }
101 
102  /**
103  Returns the output directory of the simulation
104  @return Directory in which simulation outputs are placed
105  */
106  std::string& getOutputDirectory() override { return output_directory; }
107 
108  /** Signifies that a library is required for this simulation.
109  * @param name Name of the library
110  */
111  virtual void requireLibrary(const std::string& name) override;
112 
113  /** Causes the current status of the simulation to be printed to stderr.
114  * @param fullStatus - if true, call printStatus() on all components as well
115  * as print the base Simulation's status
116  */
117  virtual void printStatus(bool fullStatus) override;
118 
119  virtual double getRunPhaseElapsedRealTime() const override;
120  virtual double getInitPhaseElapsedRealTime() const override;
121  virtual double getCompletePhaseElapsedRealTime() const override;
122 
123  /******** End Public API from Simulation ********/
124 
125  typedef std::map<std::pair<SimTime_t, int>, Clock*> clockMap_t; /*!< Map of times to clocks */
126  typedef std::map<std::pair<SimTime_t, int>, OneShot*> oneShotMap_t; /*!< Map of times to OneShots */
127 
128  ~Simulation_impl();
129 
130  /********* Static Core-only Functions *********/
131 
132  /** Return a pointer to the singleton instance of the Simulation */
133  static Simulation_impl* getSimulation() { return instanceMap.at(std::this_thread::get_id()); }
134 
135  /** Return the TimeLord associated with this Simulation */
136  static TimeLord* getTimeLord(void) { return &timeLord; }
137 
138  /** Return the base simulation Output class instance */
139  static Output& getSimulationOutput() { return sim_output; }
140 
141  /** Create new simulation
142  * @param config - Configuration of the simulation
143  * @param my_rank - Parallel Rank of this simulation object
144  * @param num_ranks - How many Ranks are in the simulation
145  */
146  static Simulation_impl* createSimulation(Config* config, RankInfo my_rank, RankInfo num_ranks);
147 
148  /**
149  * Used to signify the end of simulation. Cleans up any existing Simulation Objects
150  */
151  static void shutdown();
152 
153  /** Sets an internal flag for signaling the simulation. Used internally */
154  static void setSignal(int signal);
155 
156  /** Insert an activity to fire at a specified time */
157  void insertActivity(SimTime_t time, Activity* ev);
158 
159  /** Return the exit event */
160  Exit* getExit() const { return m_exit; }
161 
162  /******** Core only API *************/
163 
164  /** Processes the ConfigGraph to pull out any need information
165  * about relationships among the threads
166  */
167  void processGraphInfo(ConfigGraph& graph, const RankInfo& myRank, SimTime_t min_part);
168 
169  int initializeStatisticEngine(ConfigGraph& graph);
170  int prepareLinks(ConfigGraph& graph, const RankInfo& myRank, SimTime_t min_part);
171  int performWireUp(ConfigGraph& graph, const RankInfo& myRank, SimTime_t min_part);
172  void exchangeLinkInfo();
173 
174  /** Set cycle count, which, if reached, will cause the simulation to halt. */
175  void setStopAtCycle(Config* cfg);
176 
177  /** Perform the init() phase of simulation */
178  void initialize();
179 
180  /** Perform the complete() phase of simulation */
181  void complete();
182 
183  /** Perform the setup() and run phases of the simulation. */
184  void setup();
185 
186  void run();
187 
188  void finish();
189 
190  /** Adjust clocks and time to reflect precise simulation end time which
191  may differ in parallel simulations from the time simulation end is detected.
192  */
193  void adjustTimeAtSimEnd();
194 
195  bool isIndependentThread() { return independent; }
196 
197  void printProfilingInfo(FILE* fp);
198 
199  void printPerformanceInfo();
200 
201  /** Register a OneShot event to be called after a time delay
202  Note: OneShot cannot be canceled, and will always callback after
203  the timedelay.
204  */
205  TimeConverter* registerOneShot(const std::string& timeDelay, OneShot::HandlerBase* handler, int priority);
206 
207  TimeConverter* registerOneShot(const UnitAlgebra& timeDelay, OneShot::HandlerBase* handler, int priority);
208 
209  const std::vector<SimTime_t>& getInterThreadLatencies() const { return interThreadLatencies; }
210 
211  SimTime_t getInterThreadMinLatency() const { return interThreadMinLatency; }
212 
213  static TimeConverter* getMinPartTC() { return minPartTC; }
214 
215  LinkMap* getComponentLinkMap(ComponentId_t id) const
216  {
217  ComponentInfo* info = compInfoMap.getByID(id);
218  if ( nullptr == info ) { return nullptr; }
219  else {
220  return info->getLinkMap();
221  }
222  }
223 
224  /** Returns reference to the Component Info Map */
225  const ComponentInfoMap& getComponentInfoMap(void) { return compInfoMap; }
226 
227  /** returns the component with the given ID */
228  BaseComponent* getComponent(const ComponentId_t& id) const
229  {
230  ComponentInfo* i = compInfoMap.getByID(id);
231  // CompInfoMap_t::const_iterator i = compInfoMap.find(id);
232  if ( nullptr != i ) { return i->getComponent(); }
233  else {
234  printf("Simulation::getComponent() couldn't find component with id = %" PRIu64 "\n", id);
235  exit(1);
236  }
237  }
238 
239  /** returns the ComponentInfo object for the given ID */
240  ComponentInfo* getComponentInfo(const ComponentId_t& id) const
241  {
242  ComponentInfo* i = compInfoMap.getByID(id);
243  // CompInfoMap_t::const_iterator i = compInfoMap.find(id);
244  if ( nullptr != i ) { return i; }
245  else {
246  printf("Simulation::getComponentInfo() couldn't find component with id = %" PRIu64 "\n", id);
247  exit(1);
248  }
249  }
250 
251  /**
252  Set the output directory for this simulation
253  @param outDir Path of directory to place simulation outputs in
254  */
255  void setOutputDirectory(const std::string& outDir) { output_directory = outDir; }
256 
257  /**
258  * Gets the minimum next activity time across all TimeVortices in
259  * the Rank
260  */
261  static SimTime_t getLocalMinimumNextActivityTime();
262 
263  /**
264  * Returns true when the Wireup is finished.
265  */
266  bool isWireUpFinished() { return wireUpFinished; }
267 
268  uint64_t getTimeVortexMaxDepth() const;
269 
270  uint64_t getTimeVortexCurrentDepth() const;
271 
272  uint64_t getSyncQueueDataSize() const;
273 
274  /******** API provided through BaseComponent only ***********/
275 
276  /** Register a handler to be called on a set frequency */
277  TimeConverter* registerClock(const std::string& freq, Clock::HandlerBase* handler, int priority);
278 
279  TimeConverter* registerClock(const UnitAlgebra& freq, Clock::HandlerBase* handler, int priority);
280 
281  TimeConverter* registerClock(TimeConverter* tcFreq, Clock::HandlerBase* handler, int priority);
282 
283  /** Remove a clock handler from the list of active clock handlers */
284  void unregisterClock(TimeConverter* tc, Clock::HandlerBase* handler, int priority);
285 
286  /** Reactivate an existing clock and handler.
287  * @return time when handler will next fire
288  */
289  Cycle_t reregisterClock(TimeConverter* tc, Clock::HandlerBase* handler, int priority);
290 
291  /** Returns the next Cycle that the TImeConverter would fire. */
292  Cycle_t getNextClockCycle(TimeConverter* tc, int priority = CLOCKPRIORITY);
293 
294  /** Return the Statistic Processing Engine associated with this Simulation */
296 
297 
298  friend class Link;
299  friend class Action;
300  friend class Output;
301  // To enable main to set up globals
302  friend int ::main(int argc, char** argv);
303 
304  // Simulation_impl() {}
305  Simulation_impl(Config* config, RankInfo my_rank, RankInfo num_ranks);
306  Simulation_impl(Simulation_impl const&); // Don't Implement
307  void operator=(Simulation_impl const&); // Don't implement
308 
309  /** Get a handle to a TimeConverter
310  * @param cycles Frequency which is the base of the TimeConverter
311  */
312  TimeConverter* minPartToTC(SimTime_t cycles) const;
313 
314  /** Factory used to generate the simulation components */
315  static Factory* factory;
316 
317  static void resizeBarriers(uint32_t nthr);
318  static Core::ThreadSafe::Barrier initBarrier;
319  static Core::ThreadSafe::Barrier completeBarrier;
320  static Core::ThreadSafe::Barrier setupBarrier;
321  static Core::ThreadSafe::Barrier runBarrier;
322  static Core::ThreadSafe::Barrier exitBarrier;
323  static Core::ThreadSafe::Barrier finishBarrier;
324  static std::mutex simulationMutex;
325 
326  // Support for crossthread links
327  static Core::ThreadSafe::Spinlock cross_thread_lock;
328  static std::map<LinkId_t, Link*> cross_thread_links;
329  bool direct_interthread;
330 
331  Component* createComponent(ComponentId_t id, const std::string& name, Params& params);
332 
333  TimeVortex* getTimeVortex() const { return timeVortex; }
334 
335  /** Emergency Shutdown
336  * Called when a SIGINT or SIGTERM has been seen
337  */
338  static void emergencyShutdown();
339  /** Normal Shutdown
340  */
341  void endSimulation(void);
342  void endSimulation(SimTime_t end);
343 
344  typedef enum {
345  SHUTDOWN_CLEAN, /* Normal shutdown */
346  SHUTDOWN_SIGNAL, /* SIGINT or SIGTERM received */
347  SHUTDOWN_EMERGENCY, /* emergencyShutdown() called */
348  } ShutdownMode_t;
349 
350  friend class SyncManager;
351 
352  TimeVortex* timeVortex;
353  TimeConverter* threadMinPartTC;
354  Activity* current_activity;
355  static SimTime_t minPart;
356  static TimeConverter* minPartTC;
357  std::vector<SimTime_t> interThreadLatencies;
358  SimTime_t interThreadMinLatency;
359  SyncManager* syncManager;
360  // ThreadSync* threadSync;
361  ComponentInfoMap compInfoMap;
362  clockMap_t clockMap;
363  oneShotMap_t oneShotMap;
364  static Exit* m_exit;
365  SimulatorHeartbeat* m_heartbeat;
366  bool endSim;
367  bool independent; // true if no links leave thread (i.e. no syncs required)
368  static std::atomic<int> untimed_msg_count;
369  unsigned int untimed_phase;
370  volatile sig_atomic_t lastRecvdSignal;
371  ShutdownMode_t shutdown_mode;
372  bool wireUpFinished;
373 
374  /** TimeLord of the simulation */
376  /** Output */
378 
379  /** Statistics Engine */
381 
382  /** Performance Tracking Information **/
383 
384  void intializeProfileTools(const std::string& config);
385 
386  std::map<std::string, SST::Profile::ProfileTool*> profile_tools;
387  // Maps the component profile points to profiler names
388  std::map<std::string, std::vector<std::string>> profiler_map;
389 
390  template <typename T>
391  std::vector<T*> getProfileTool(std::string point)
392  {
393  std::vector<T*> ret;
394  try {
395  std::vector<std::string>& profilers = profiler_map.at(point);
396 
397  for ( auto& x : profilers ) {
398  try {
399  SST::Profile::ProfileTool* val = profile_tools.at(x);
400 
401  T* tool = dynamic_cast<T*>(val);
402  if ( !tool ) {
403  // Not the right type, fatal
404  Output::getDefaultObject().fatal(
405  CALL_INFO_LONG, 1,
406  "ERROR: wrong type of profiling tool found (name = %s). Check to make sure the profiling "
407  "points enabled for this tool accept the type specified\n",
408  x.c_str());
409  }
410  ret.push_back(tool);
411  }
412  catch ( std::out_of_range& e ) {
413  // This shouldn't happen. If it does, then something
414  // didn't get initialized correctly.
415  Output::getDefaultObject().fatal(
416  CALL_INFO_LONG, 1,
417  "INTERNAL ERROR: ProfileTool refered to in profiler_map not found in profile_tools map\n");
418  return ret;
419  }
420  }
421  }
422  catch ( std::out_of_range& e ) {
423  // point not turned on, return nullptr
424  return ret;
425  }
426 
427 
428  return ret;
429  }
430 
431 
432 #if SST_PERFORMANCE_INSTRUMENTING
433  FILE* fp;
434 #endif
435 
436 #if SST_PERIODIC_PRINT
437  uint64_t periodicCounter = 0;
438 #endif
439 
440 #if SST_RUNTIME_PROFILING
441  uint64_t sumtime = 0;
442  uint64_t runtime = 0;
443  struct timeval start, end, diff;
444  struct timeval sumstart, sumend, sumdiff;
445 #endif
446 
447 
448 #if SST_EVENT_PROFILING
449  uint64_t rankLatency = 0; // Serialization time
450  uint64_t messageXferSize = 0;
451 
452  uint64_t rankExchangeBytes = 0; // Serialization size
453  uint64_t rankExchangeEvents = 0; // Serialized events
454  uint64_t rankExchangeCounter = 0; // Num rank peer exchanges
455 
456 
457  // Profiling functions
458  void incrementSerialCounters(uint64_t count);
459  void incrementExchangeCounters(uint64_t events, uint64_t bytes);
460 
461 #endif
462 
463 #if SST_SYNC_PROFILING
464  uint64_t rankSyncCounter = 0; // Num. of rank syncs
465  uint64_t rankSyncTime = 0; // Total time rank syncing, in ns
466  uint64_t threadSyncCounter = 0; // Num. of thread syncs
467  uint64_t threadSyncTime = 0; // Total time thread syncing, in ns
468  // Does not include thread syncs as part of rank syncs
469  void incrementSyncTime(bool rankSync, uint64_t count);
470 #endif
471 
472 #if SST_HIGH_RESOLUTION_CLOCK
473  uint64_t clockDivisor = 1e9;
474  std::string clockResolution = "ns";
475 #else
476  uint64_t clockDivisor = 1e6;
477  std::string clockResolution = "us";
478 #endif
479 
480  // Run mode for the simulation
481  SimulationRunMode runMode;
482 
483  // Track current simulated time
484  SimTime_t currentSimCycle;
485  int currentPriority;
486  SimTime_t endSimCycle;
487 
488  // Rank information
489  RankInfo my_rank;
490  RankInfo num_ranks;
491 
492  std::string output_directory;
493  static SharedRegionManager* sharedRegionManager;
494 
495  double run_phase_start_time;
496  double run_phase_total_time;
497  double init_phase_start_time;
498  double init_phase_total_time;
499  double complete_phase_start_time;
500  double complete_phase_total_time;
501 
502  static std::unordered_map<std::thread::id, Simulation_impl*> instanceMap;
503  static std::vector<Simulation_impl*> instanceVec;
504 
505  friend void wait_my_turn_start();
506  friend void wait_my_turn_end();
507 
508 private:
509  /**
510  * Returns the time of the next item to be executed
511  * that is in the TImeVortex of the Simulation
512  */
513  SimTime_t getNextActivityTime() const;
514 };
515 
516 // Function to allow for easy serialization of threads while debugging
517 // code. Can only be used when you can guarantee all threads will be
518 // taking the same code path. If you can't guarantee that, then use a
519 // spinlock to make sure only one person is in a given region at a
520 // time. ONLY FOR DEBUG USE.
521 void wait_my_turn_start(Core::ThreadSafe::Barrier& barrier, int thread, int total_threads);
522 
523 void wait_my_turn_end(Core::ThreadSafe::Barrier& barrier, int thread, int total_threads);
524 
525 } // namespace SST
526 
527 #endif // SST_CORE_SIMULATION_IMPL_H
Output object provides consistent method for outputting data to stdout, stderr and/or sst debug file...
Definition: output.h:51
An Action is a schedulable Activity which is not an Event.
Definition: action.h:26
Handlers with 1 handler defined argument to callback from caller.
Definition: ssthandler.h:170
SimTime_t getCurrentSimCycle() const override
Return the current simulation time as a cycle count.
Definition: simulation.cc:55
virtual double getCompletePhaseElapsedRealTime() const override
Get the amount of real-time spent executing the complete phase of the simulation. ...
Definition: simulation.cc:865
Main control class for a SST Simulation.
Definition: simulation.h:38
Base class for all Activities in the SST Event Queue.
Definition: activity.h:45
Class to contain SST Simulation Configuration variables.
Definition: config.h:38
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.
Definition: simulation.cc:937
void insertActivity(SimTime_t time, Activity *ev)
Insert an activity to fire at a specified time.
Definition: simulation.cc:963
A class to convert between a component&#39;s view of time and the core&#39;s view of time.
Definition: timeConverter.h:26
RankInfo getRank() const override
Get this instance&#39;s parallel rank.
Definition: simulation_impl.h:97
Main component object for the simulation.
Definition: component.h:30
A Configuration Graph A graph representing Components and Links.
Definition: configGraph.h:389
Primary Event Queue.
Definition: timeVortex.h:25
static Output sim_output
Output.
Definition: simulation_impl.h:377
bool isWireUpFinished()
Returns true when the Wireup is finished.
Definition: simulation_impl.h:266
void setOutputDirectory(const std::string &outDir)
Set the output directory for this simulation
Definition: simulation_impl.h:255
static Output & getSimulationOutput()
Return the base simulation Output class instance.
Definition: simulation_impl.h:139
Definition: action.cc:18
ProfileTool is a class loadable through the factory which allows dynamic addition of profiling capabi...
Definition: profiletool.h:29
void setup()
Perform the setup() and run phases of the simulation.
Definition: simulation.cc:599
const ComponentInfoMap & getComponentInfoMap(void)
Returns reference to the Component Info Map.
Definition: simulation_impl.h:225
SST::Statistics::StatisticProcessingEngine stat_engine
Statistics Engine.
Definition: simulation_impl.h:380
void initialize()
Perform the init() phase of simulation.
Definition: simulation.cc:518
TimeConverter * minPartToTC(SimTime_t cycles) const
Get a handle to a TimeConverter.
Definition: simulation.cc:87
SSTHandlerBaseNoArgs< void > HandlerBase
Base handler for OneShot callbacks.
Definition: oneshot.h:38
Exit Event Action.
Definition: exit.h:34
Definition: componentInfo.h:249
virtual void printStatus(bool fullStatus) override
Causes the current status of the simulation to be printed to stderr.
Definition: simulation.cc:830
int getCurrentPriority() const override
Return the current priority.
Definition: simulation.cc:67
Exit * getExit() const
Return the exit event.
Definition: simulation_impl.h:160
static Simulation_impl * createSimulation(Config *config, RankInfo my_rank, RankInfo num_ranks)
Create new simulation.
Definition: simulation.cc:139
A Clock class.
Definition: clock.h:32
static void setSignal(int signal)
Sets an internal flag for signaling the simulation.
Definition: simulation.cc:823
BaseComponent * getComponent(const ComponentId_t &id) const
returns the component with the given ID
Definition: simulation_impl.h:228
UnitAlgebra getEndSimTime() const override
Return the end simulation time as a time.
Definition: simulation.cc:79
Cycle_t reregisterClock(TimeConverter *tc, Clock::HandlerBase *handler, int priority)
Reactivate an existing clock and handler.
Definition: simulation.cc:903
RankInfo getNumRanks() const override
Get the number of parallel ranks in the simulation.
Definition: simulation_impl.h:100
static TimeLord * getTimeLord(void)
Return the TimeLord associated with this Simulation.
Definition: simulation_impl.h:136
virtual double getInitPhaseElapsedRealTime() const override
Get the amount of real-time spent executing the init phase of the simulation.
Definition: simulation.cc:855
std::map< std::pair< SimTime_t, int >, OneShot * > oneShotMap_t
Definition: simulation_impl.h:126
virtual double getRunPhaseElapsedRealTime() const override
Get the amount of real-time spent executing the run phase of the simulation.
Definition: simulation.cc:845
static SimTime_t getLocalMinimumNextActivityTime()
Gets the minimum next activity time across all TimeVortices in the Rank.
Definition: simulation.cc:232
void unregisterClock(TimeConverter *tc, Clock::HandlerBase *handler, int priority)
Remove a clock handler from the list of active clock handlers.
Definition: simulation.cc:927
ComponentInfo * getComponentInfo(const ComponentId_t &id) const
returns the ComponentInfo object for the given ID
Definition: simulation_impl.h:240
Main control class for a SST Simulation.
Definition: simulation_impl.h:73
Definition: rankInfo.h:21
Main component object for the simulation.
Definition: baseComponent.h:51
static Simulation_impl * getSimulation()
Return a pointer to the singleton instance of the Simulation.
Definition: simulation_impl.h:133
UnitAlgebra getElapsedSimTime() const override
Return the elapsed simulation time as a time.
Definition: simulation.cc:73
void complete()
Perform the complete() phase of simulation.
Definition: simulation.cc:563
static Factory * factory
Factory used to generate the simulation components.
Definition: simulation_impl.h:315
std::string & getOutputDirectory() override
Returns the output directory of the simulation
Definition: simulation_impl.h:106
void intializeProfileTools(const std::string &config)
Performance Tracking Information.
Definition: simulation.cc:1063
Definition: threadsafe.h:121
Cycle_t getNextClockCycle(TimeConverter *tc, int priority=CLOCKPRIORITY)
Returns the next Cycle that the TImeConverter would fire.
Definition: simulation.cc:915
A OneShot Event class.
Definition: oneshot.h:32
void adjustTimeAtSimEnd()
Adjust clocks and time to reflect precise simulation end time which may differ in parallel simulation...
Definition: simulation.cc:786
static void emergencyShutdown()
Emergency Shutdown Called when a SIGINT or SIGTERM has been seen.
Definition: simulation.cc:746
static TimeLord timeLord
TimeLord of the simulation.
Definition: simulation_impl.h:375
Parameter store.
Definition: params.h:55
void endSimulation(void)
Normal Shutdown.
Definition: simulation.cc:764
void setStopAtCycle(Config *cfg)
Set cycle count, which, if reached, will cause the simulation to halt.
Definition: simulation.cc:203
Class for creating and managing TimeConverter objects.
Definition: timeLord.h:37
virtual void requireLibrary(const std::string &name) override
Signifies that a library is required for this simulation.
Definition: simulation.cc:220
Class for instantiating Components, Links and the like out of element libraries.
Definition: factory.h:43
TimeConverter * registerClock(const std::string &freq, Clock::HandlerBase *handler, int priority)
Register a handler to be called on a set frequency.
Definition: simulation.cc:875
Definition: componentInfo.h:39
Statistics::StatisticProcessingEngine * getStatisticsProcessingEngine(void)
Return the Statistic Processing Engine associated with this Simulation.
Definition: simulation.cc:988
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...
Definition: simulation.cc:243
An SST core component that handles timing and event processing informing all registered Statistics to...
Definition: statengine.h:51
SimulationRunMode getSimulationMode() const override
Get the run mode of the simulation (e.g.
Definition: simulation_impl.h:79
std::map< std::pair< SimTime_t, int >, Clock * > clockMap_t
Definition: simulation_impl.h:125
SimTime_t getEndSimCycle() const override
Return the end simulation time as a cycle count.
Definition: simulation.cc:61
Performs Unit math in full precision.
Definition: unitAlgebra.h:106
Definition: threadsafe.h:47
static void shutdown()
Used to signify the end of simulation.
Definition: simulation.cc:153