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