SST 15.0
Structural Simulation Toolkit
simulation_impl.h
1// -*- c++ -*-
2
3// Copyright 2009-2025 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-2025, 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/exit.h"
20#include "sst/core/oneshot.h"
21#include "sst/core/output.h"
22#include "sst/core/profile/profiletool.h"
23#include "sst/core/rankInfo.h"
24#include "sst/core/sst_types.h"
25#include "sst/core/statapi/statengine.h"
26#include "sst/core/unitAlgebra.h"
27#include "sst/core/util/filesystem.h"
28
29#include <atomic>
30#include <cstdio>
31#include <iostream>
32#include <map>
33#include <mutex>
34#include <set>
35#include <signal.h>
36#include <thread>
37#include <unordered_map>
38#include <vector>
39
40/* Forward declare for Friendship */
41extern int main(int argc, char** argv);
42
43namespace SST {
44
45// Function to exit, guarding against race conditions if multiple threads call it
46[[noreturn]]
47void SST_Exit(int exit_code);
48
49#define _SIM_DBG(fmt, args...) __DBG(DBG_SIM, Sim, fmt, ##args)
50#define STATALLFLAG "--ALLSTATS--"
51
52class Activity;
54class Component;
55class Config;
56class ConfigGraph;
57class Exit;
58class Factory;
60class Link;
61class LinkMap;
62class Params;
63class RealTimeManager;
65class SyncBase;
66class SyncManager;
67class ThreadSync;
68class TimeConverter;
69class TimeLord;
70class TimeVortex;
71class UnitAlgebra;
72
73namespace Statistics {
74class StatisticOutput;
76} // namespace Statistics
77
78namespace Serialization {
79class ObjectMap;
80} // namespace Serialization
81
82/**
83 * Main control class for a SST Simulation.
84 * Provides base features for managing the simulation
85 */
86class Simulation_impl
87{
88
89public:
90 SST::Core::Serialization::ObjectMap* getComponentObjectMap();
91
92 /******** Public API inherited from Simulation ********/
93 /** Get the run mode of the simulation (e.g. init, run, both etc) */
94 SimulationRunMode getSimulationMode() const { return runMode; };
95
96 /** Return the current simulation time as a cycle count*/
97 SimTime_t getCurrentSimCycle() const;
98
99 /** Return the end simulation time as a cycle count*/
100 SimTime_t getEndSimCycle() const;
101
102 /** Return the current priority */
103 int getCurrentPriority() const;
104
105 /** Return the elapsed simulation time as a time */
107
108 /** Return the end simulation time as a time */
110
111 /** Get this instance's parallel rank */
112 RankInfo getRank() const { return my_rank; }
113
114 /** Get the number of parallel ranks in the simulation */
115 RankInfo getNumRanks() const { return num_ranks; }
116
117 /**
118 Returns the output directory of the simulation
119 @return Directory in which simulation outputs are placed
120 */
121 std::string& getOutputDirectory() { return output_directory; }
122
123 /** Signifies that a library is required for this simulation.
124 * @param name Name of the library
125 */
126 void requireLibrary(const std::string& name);
127
128 /** Causes the current status of the simulation to be printed to stderr.
129 * @param fullStatus - if true, call printStatus() on all components as well
130 * as print the base Simulation's status
131 */
132 void printStatus(bool fullStatus);
133
134 double getRunPhaseElapsedRealTime() const;
135 double getInitPhaseElapsedRealTime() const;
136 double getCompletePhaseElapsedRealTime() const;
137
138 /******** End Public API from Simulation ********/
139
140 using clockMap_t = std::map<std::pair<SimTime_t, int>, Clock*>; /*!< Map of times to clocks */
141 using oneShotMap_t = std::map<std::pair<SimTime_t, int>, OneShot*>; /*!< Map of times to OneShots */
142
143 ~Simulation_impl();
144
145 /********* Static Core-only Functions *********/
146
147 /** Return a pointer to the singleton instance of the Simulation */
148 static Simulation_impl* getSimulation() { return instanceMap.at(std::this_thread::get_id()); }
149
150 /** Return the TimeLord associated with this Simulation */
151 static TimeLord* getTimeLord() { return &timeLord; }
152
153 /** Return the base simulation Output class instance */
154 static Output& getSimulationOutput() { return sim_output; }
155
156 /** Create new simulation
157 * @param config - Configuration of the simulation
158 * @param my_rank - Parallel Rank of this simulation object
159 * @param num_ranks - How many Ranks are in the simulation
160 * @param restart - Whether this simulation is being restarted from a checkpoint (true) or not
161 */
162 static Simulation_impl* createSimulation(Config* config, RankInfo my_rank, RankInfo num_ranks, bool restart);
163
164 /**
165 * Used to signify the end of simulation. Cleans up any existing Simulation Objects
166 */
167 static void shutdown();
168
169 /** Sets an internal flag for signaling the simulation. Used by signal handler & thread 0. */
170 static void notifySignal();
171
172 /** Insert an activity to fire at a specified time */
173 void insertActivity(SimTime_t time, Activity* ev);
174
175 /** Return the exit event */
176 Exit* getExit() const { return m_exit; }
177
178 /******** Core only API *************/
179
180 /** Processes the ConfigGraph to pull out any need information
181 * about relationships among the threads
182 */
183 void processGraphInfo(ConfigGraph& graph, const RankInfo& myRank, SimTime_t min_part);
184
185 int initializeStatisticEngine(ConfigGraph& graph);
186 int prepareLinks(ConfigGraph& graph, const RankInfo& myRank, SimTime_t min_part);
187 int performWireUp(ConfigGraph& graph, const RankInfo& myRank, SimTime_t min_part);
188 void exchangeLinkInfo();
189
190 /** Setup external control actions (forced stops, signal handling */
191 void setupSimActions(Config* cfg, bool restart = false);
192
193 /** Helper for signal string parsing */
194 bool parseSignalString(std::string& arg, std::string& name, Params& params);
195
196 /** Perform the init() phase of simulation */
197 void initialize();
198
199 /** Perform the complete() phase of simulation */
200 void complete();
201
202 /** Perform the setup() and run phases of the simulation. */
203 void setup();
204
205 void prepare_for_run();
206
207 void run();
208
209 void finish();
210
211 /** Adjust clocks and time to reflect precise simulation end time which
212 may differ in parallel simulations from the time simulation end is detected.
213 */
214 void adjustTimeAtSimEnd();
215
216 bool isIndependentThread() { return independent; }
217
218 void printProfilingInfo(FILE* fp);
219
220 void printPerformanceInfo();
221
222 /** Register a OneShot event to be called after a time delay
223 Note: OneShot cannot be canceled, and will always callback after
224 the timedelay.
225 */
226 TimeConverter* registerOneShot(const std::string& timeDelay, OneShot::HandlerBase* handler, int priority);
227
228 TimeConverter* registerOneShot(const UnitAlgebra& timeDelay, OneShot::HandlerBase* handler, int priority);
229
230 const std::vector<SimTime_t>& getInterThreadLatencies() const { return interThreadLatencies; }
231
232 SimTime_t getInterThreadMinLatency() const { return interThreadMinLatency; }
233
234 static TimeConverter getMinPartTC() { return minPartTC; }
235
236 LinkMap* getComponentLinkMap(ComponentId_t id) const
237 {
238 ComponentInfo* info = compInfoMap.getByID(id);
239 if ( nullptr == info ) {
240 return nullptr;
241 }
242 else {
243 return info->getLinkMap();
244 }
245 }
246
247 /** Returns reference to the Component Info Map */
248 const ComponentInfoMap& getComponentInfoMap() const { return compInfoMap; }
249
250 /** returns the component with the given ID */
251 BaseComponent* getComponent(const ComponentId_t& id) const
252 {
253 ComponentInfo* i = compInfoMap.getByID(id);
254 // CompInfoMap_t::const_iterator i = compInfoMap.find(id);
255 if ( nullptr != i ) {
256 return i->getComponent();
257 }
258 else {
259 printf("Simulation::getComponent() couldn't find component with id = %" PRIu64 "\n", id);
260 SST_Exit(1);
261 }
262 }
263
264 /** returns the ComponentInfo object for the given ID */
265 ComponentInfo* getComponentInfo(const ComponentId_t& id) const
266 {
267 ComponentInfo* i = compInfoMap.getByID(id);
268 // CompInfoMap_t::const_iterator i = compInfoMap.find(id);
269 if ( nullptr != i ) {
270 return i;
271 }
272 else {
273 printf("Simulation::getComponentInfo() couldn't find component with id = %" PRIu64 "\n", id);
274 SST_Exit(1);
275 }
276 }
277
278 /**
279 Set the output directory for this simulation
280 @param outDir Path of directory to place simulation outputs in
281 */
282 void setOutputDirectory(const std::string& outDir) { output_directory = outDir; }
283
284 /**
285 * Gets the minimum next activity time across all TimeVortices in
286 * the Rank
287 */
288 static SimTime_t getLocalMinimumNextActivityTime();
289
290 /**
291 * Returns true when the Wireup is finished.
292 */
293 bool isWireUpFinished() { return wireUpFinished_; }
294
295 uint64_t getTimeVortexMaxDepth() const;
296
297 uint64_t getTimeVortexCurrentDepth() const;
298
299 uint64_t getSyncQueueDataSize() const;
300
301 /** Return the checkpoint event */
302 CheckpointAction* getCheckpointAction() const { return checkpoint_action_; }
303
304 /******** API provided through BaseComponent only ***********/
305
306 /** Register a handler to be called on a set frequency */
307 TimeConverter* registerClock(const std::string& freq, Clock::HandlerBase* handler, int priority);
308
309 TimeConverter* registerClock(const UnitAlgebra& freq, Clock::HandlerBase* handler, int priority);
310
311 TimeConverter* registerClock(TimeConverter* tcFreq, Clock::HandlerBase* handler, int priority);
312 TimeConverter* registerClock(TimeConverter& tcFreq, Clock::HandlerBase* handler, int priority);
313
314 // registerClock function used during checkpoint/restart
315 void registerClock(SimTime_t factor, Clock::HandlerBase* handler, int priority);
316
317 /** Remove a clock handler from the list of active clock handlers */
318 void unregisterClock(TimeConverter* tc, Clock::HandlerBase* handler, int priority);
319 void unregisterClock(TimeConverter& tc, Clock::HandlerBase* handler, int priority);
320
321 /** Reactivate an existing clock and handler.
322 * @return time when handler will next fire
323 */
324 Cycle_t reregisterClock(TimeConverter* tc, Clock::HandlerBase* handler, int priority);
325 Cycle_t reregisterClock(TimeConverter& tc, Clock::HandlerBase* handler, int priority);
326
327 /** Returns the next Cycle that the TimeConverter would fire. */
328 Cycle_t getNextClockCycle(TimeConverter* tc, int priority = CLOCKPRIORITY);
329 Cycle_t getNextClockCycle(TimeConverter& tc, int priority = CLOCKPRIORITY);
330
331 /** Gets the clock the handler is registered with, represented by it's factor
332 *
333 * @param handler Clock handler to search for
334 *
335 * @return Factor of TimeConverter for the clock the specified
336 * handler is registered with. If the handler is not currently
337 * registered with a clock, returns 0.
338 */
339 SimTime_t getClockForHandler(Clock::HandlerBase* handler);
340
341 /** Return the Statistic Processing Engine associated with this Simulation */
343
344
345 friend class Link;
346 friend class Action;
347 friend class Output;
348 // To enable main to set up globals
349 friend int ::main(int argc, char** argv);
350
351 Simulation_impl(Config* config, RankInfo my_rank, RankInfo num_ranks, bool restart);
352 Simulation_impl(const Simulation_impl&) = delete; // Don't Implement
353 Simulation_impl& operator=(const Simulation_impl&) = delete; // Don't implement
354
355 /** Get a handle to a TimeConverter
356 * @param cycles Frequency which is the base of the TimeConverter
357 */
358 TimeConverter minPartToTC(SimTime_t cycles) const;
359
360 std::string initializeCheckpointInfrastructure(const std::string& prefix);
361 void scheduleCheckpoint();
362
363 /**
364 Write the partition specific checkpoint data
365 */
366 void checkpoint(const std::string& checkpoint_filename);
367
368 /**
369 Append partitions registry information
370 */
371 void checkpoint_append_registry(const std::string& registry_name, const std::string& blob_name);
372
373 /**
374 Write the global data to a binary file and create the registry
375 and write the header info
376 */
378 int checkpoint_id, const std::string& registry_filename, const std::string& globals_filename);
379 void restart(Config* config);
380
381 void initialize_interactive_console(const std::string& type);
382
383 /** Factory used to generate the simulation components */
385
386 /**
387 Filesystem object that will be used to ensure all core-created
388 files end up in the directory specified by --output-directory.
389 */
391
392 static void resizeBarriers(uint32_t nthr);
393 static Core::ThreadSafe::Barrier initBarrier;
394 static Core::ThreadSafe::Barrier completeBarrier;
395 static Core::ThreadSafe::Barrier setupBarrier;
396 static Core::ThreadSafe::Barrier runBarrier;
397 static Core::ThreadSafe::Barrier exitBarrier;
398 static Core::ThreadSafe::Barrier finishBarrier;
399 static std::mutex simulationMutex;
400
401 // Support for crossthread links
402 static Core::ThreadSafe::Spinlock cross_thread_lock;
403 static std::map<LinkId_t, Link*> cross_thread_links;
404 bool direct_interthread;
405
406 Component* createComponent(ComponentId_t id, const std::string& name, Params& params);
407
408 TimeVortex* getTimeVortex() const { return timeVortex; }
409
410 /** Emergency Shutdown
411 * Called when a fatal event has occurred
412 */
413 static void emergencyShutdown();
414
415 /** Signal Shutdown
416 * Called when a signal needs to terminate SST
417 * E.g., SIGINT or SIGTERM has been seen
418 * abnormal indicates whether this was unexpected or not
419 */
420 void signalShutdown(bool abnormal);
421
422 /** Normal Shutdown
423 */
424 void endSimulation();
425 void endSimulation(SimTime_t end);
426
427 enum ShutdownMode_t {
428 SHUTDOWN_CLEAN, /* Normal shutdown */
429 SHUTDOWN_SIGNAL, /* SIGINT or SIGTERM received */
430 SHUTDOWN_EMERGENCY, /* emergencyShutdown() called */
431 };
432
433 friend class SyncManager;
434
435 TimeVortex* timeVortex;
436 std::string timeVortexType; // Required for checkpoint
437 TimeConverter threadMinPartTC; // Unused...?
438 Activity* current_activity;
439 static SimTime_t minPart;
440 static TimeConverter minPartTC;
441 std::vector<SimTime_t> interThreadLatencies;
442 SimTime_t interThreadMinLatency;
443 SyncManager* syncManager;
444 // ThreadSync* threadSync;
445 ComponentInfoMap compInfoMap;
446 clockMap_t clockMap;
447 oneShotMap_t oneShotMap;
448 static Exit* m_exit;
449 SimulatorHeartbeat* m_heartbeat = nullptr;
450 CheckpointAction* checkpoint_action_;
451 static std::string checkpoint_directory_;
452 bool endSim;
453 bool independent; // true if no links leave thread (i.e. no syncs required)
454 static std::atomic<int> untimed_msg_count;
455 unsigned int untimed_phase;
456 volatile sig_atomic_t signal_arrived_; // true if a signal has arrived
457 ShutdownMode_t shutdown_mode_;
458 bool wireUpFinished_;
459 RealTimeManager* real_time_;
460 std::string interactive_type_ = "";
461 std::string interactive_start_ = "";
462 InteractiveConsole* interactive_ = nullptr;
463 bool enter_interactive_ = false;
464 std::string interactive_msg_;
465
466 /**
467 vector to hold offsets of component blobs in checkpoint files
468 */
469 std::vector<std::pair<ComponentId_t, uint64_t>> component_blob_offsets_;
470
471 /** TimeLord of the simulation */
473 /** Output */
474 static Output sim_output;
475
476
477 /** Statistics Engine */
479
480 /** Performance Tracking Information **/
481
482 void initializeProfileTools(const std::string& config);
483
484 std::map<std::string, SST::Profile::ProfileTool*> profile_tools;
485 // Maps the component profile points to profiler names
486 std::map<std::string, std::vector<std::string>> profiler_map;
487
488 template <typename T>
489 std::vector<T*> getProfileTool(std::string point)
490 {
491 std::vector<T*> ret;
492 try {
493 std::vector<std::string>& profilers = profiler_map.at(point);
494
495 for ( auto& x : profilers ) {
496 try {
497 SST::Profile::ProfileTool* val = profile_tools.at(x);
498
499 T* tool = dynamic_cast<T*>(val);
500 if ( !tool ) {
501 // Not the right type, fatal
502 Output::getDefaultObject().fatal(CALL_INFO_LONG, 1,
503 "ERROR: wrong type of profiling tool found (name = %s). Check to make sure the profiling "
504 "points enabled for this tool accept the type specified\n",
505 x.c_str());
506 }
507 ret.push_back(tool);
508 }
509 catch ( std::out_of_range& e ) {
510 // This shouldn't happen. If it does, then something
511 // didn't get initialized correctly.
512 Output::getDefaultObject().fatal(CALL_INFO_LONG, 1,
513 "INTERNAL ERROR: ProfileTool refered to in profiler_map not found in profile_tools map\n");
514 return ret;
515 }
516 }
517 }
518 catch ( std::out_of_range& e ) {
519 // point not turned on, return nullptr
520 return ret;
521 }
522
523
524 return ret;
525 }
526
527
528#if SST_PERFORMANCE_INSTRUMENTING
529 FILE* fp;
530#endif
531
532#if SST_PERIODIC_PRINT
533 uint64_t periodicCounter = 0;
534#endif
535
536#if SST_RUNTIME_PROFILING
537 uint64_t sumtime = 0;
538 uint64_t runtime = 0;
539 struct timeval start, end, diff;
540 struct timeval sumstart, sumend, sumdiff;
541#endif
542
543
544#if SST_EVENT_PROFILING
545 uint64_t rankLatency = 0; // Serialization time
546 uint64_t messageXferSize = 0;
547
548 uint64_t rankExchangeBytes = 0; // Serialization size
549 uint64_t rankExchangeEvents = 0; // Serialized events
550 uint64_t rankExchangeCounter = 0; // Num rank peer exchanges
551
552
553 // Profiling functions
554 void incrementSerialCounters(uint64_t count);
555 void incrementExchangeCounters(uint64_t events, uint64_t bytes);
556
557#endif
558
559#if SST_SYNC_PROFILING
560 uint64_t rankSyncCounter = 0; // Num. of rank syncs
561 uint64_t rankSyncTime = 0; // Total time rank syncing, in ns
562 uint64_t threadSyncCounter = 0; // Num. of thread syncs
563 uint64_t threadSyncTime = 0; // Total time thread syncing, in ns
564 // Does not include thread syncs as part of rank syncs
565 void incrementSyncTime(bool rankSync, uint64_t count);
566#endif
567
568#if SST_HIGH_RESOLUTION_CLOCK
569 uint64_t clockDivisor = 1e9;
570 std::string clockResolution = "ns";
571#else
572 uint64_t clockDivisor = 1e6;
573 std::string clockResolution = "us";
574#endif
575
576 // Run mode for the simulation
577 SimulationRunMode runMode;
578
579 // Track current simulated time
580 SimTime_t currentSimCycle;
581 int currentPriority;
582 SimTime_t endSimCycle;
583
584 // Rank information
585 RankInfo my_rank;
586 RankInfo num_ranks;
587
588 std::string output_directory;
589
590 double run_phase_start_time_;
591 double run_phase_total_time_;
592 double init_phase_start_time_;
593 double init_phase_total_time_;
594 double complete_phase_start_time_;
595 double complete_phase_total_time_;
596
597 static std::unordered_map<std::thread::id, Simulation_impl*> instanceMap;
598 static std::vector<Simulation_impl*> instanceVec_;
599
600 /******** Checkpoint/restart tracking data structures ***********/
601 std::map<uintptr_t, Link*> link_restart_tracking;
602 std::map<uintptr_t, uintptr_t> event_handler_restart_tracking;
603 uint32_t checkpoint_id_ = 0;
604 std::string checkpoint_prefix_ = "";
605 std::string globalOutputFileName = "";
606
607 void printSimulationState();
608
609 friend void wait_my_turn_start();
610 friend void wait_my_turn_end();
611
612private:
613 /**
614 * Returns the time of the next item to be executed
615 * that is in the TImeVortex of the Simulation
616 */
617 SimTime_t getNextActivityTime() const;
618};
619
620// Function to allow for easy serialization of threads while debugging
621// code. Can only be used when you can guarantee all threads will be
622// taking the same code path. If you can't guarantee that, then use a
623// spinlock to make sure only one person is in a given region at a
624// time. ONLY FOR DEBUG USE.
625void wait_my_turn_start(Core::ThreadSafe::Barrier& barrier, int thread, int total_threads);
626
627void wait_my_turn_end(Core::ThreadSafe::Barrier& barrier, int thread, int total_threads);
628
629} // namespace SST
630
631#endif // SST_CORE_SIMULATION_IMPL_H
An Action is a schedulable Activity which is not an Event.
Definition action.h:27
Base class for all Activities in the SST Event Queue.
Definition activity.h:46
Main component object for the simulation.
Definition baseComponent.h:62
A recurring event to trigger checkpoint generation.
Definition checkpointAction.h:63
A Clock class.
Definition clock.h:34
SSTHandlerBase< bool, Cycle_t > HandlerBase
Base handler for clock functions.
Definition clock.h:43
Definition componentInfo.h:282
Definition componentInfo.h:42
Main component object for the simulation.
Definition component.h:31
A Configuration Graph A graph representing Components and Links.
Definition configGraph.h:450
Class to contain SST Simulation Configuration variables.
Definition config.h:41
Base class for objects created by the serializer mapping mode used to map the variables for objects.
Definition objectMap.h:112
Definition threadsafe.h:46
Definition threadsafe.h:132
Exit Event Action.
Definition exit.h:36
Class for instantiating Components, Links and the like out of element libraries.
Definition factory.h:48
Definition interactiveConsole.h:46
Maps port names to the Links that are connected to it.
Definition linkMap.h:29
A OneShot Event class.
Definition oneshot.h:36
SSTHandlerBaseNoArgs< void > HandlerBase
Base handler for OneShot callbacks.
Definition oneshot.h:41
Output object provides consistent method for outputting data to stdout, stderr and/or sst debug file.
Definition output.h:54
Parameter store.
Definition params.h:58
ProfileTool is a class loadable through the factory which allows dynamic addition of profiling capabi...
Definition profiletool.h:32
Definition rankInfo.h:24
Class to manage real-time events (signals and alarms)
Definition realtime.h:170
Main control class for a SST Simulation.
Definition simulation_impl.h:87
void setOutputDirectory(const std::string &outDir)
Set the output directory for this simulation.
Definition simulation_impl.h:282
void setup()
Perform the setup() and run phases of the simulation.
Definition simulation.cc:769
SimulationRunMode getSimulationMode() const
Get the run mode of the simulation (e.g.
Definition simulation_impl.h:94
static Output sim_output
Output.
Definition simulation_impl.h:474
UnitAlgebra getElapsedSimTime() const
Return the elapsed simulation time as a time.
Definition simulation.cc:83
static void notifySignal()
Sets an internal flag for signaling the simulation.
Definition simulation.cc:1068
Exit * getExit() const
Return the exit event.
Definition simulation_impl.h:176
void signalShutdown(bool abnormal)
Signal Shutdown Called when a signal needs to terminate SST E.g., SIGINT or SIGTERM has been seen abn...
Definition simulation.cc:994
bool parseSignalString(std::string &arg, std::string &name, Params &params)
Helper for signal string parsing.
Definition simulation.cc:318
void checkpoint_write_globals(int checkpoint_id, const std::string &registry_filename, const std::string &globals_filename)
Write the global data to a binary file and create the registry and write the header info.
Definition simulation.cc:1572
static Simulation_impl * createSimulation(Config *config, RankInfo my_rank, RankInfo num_ranks, bool restart)
Create new simulation.
Definition simulation.cc:156
void insertActivity(SimTime_t time, Activity *ev)
Insert an activity to fire at a specified time.
Definition simulation.cc:1288
SimTime_t getCurrentSimCycle() const
Return the current simulation time as a cycle count.
Definition simulation.cc:65
SST::Statistics::StatisticProcessingEngine stat_engine
Statistics Engine.
Definition simulation_impl.h:478
static Factory * factory
Factory used to generate the simulation components.
Definition simulation_impl.h:384
void initialize()
Perform the init() phase of simulation.
Definition simulation.cc:686
Cycle_t getNextClockCycle(TimeConverter *tc, int priority=CLOCKPRIORITY)
Returns the next Cycle that the TimeConverter would fire.
Definition simulation.cc:1218
ComponentInfo * getComponentInfo(const ComponentId_t &id) const
returns the ComponentInfo object for the given ID
Definition simulation_impl.h:265
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:401
BaseComponent * getComponent(const ComponentId_t &id) const
returns the component with the given ID
Definition simulation_impl.h:251
void endSimulation()
Normal Shutdown.
Definition simulation.cc:1008
static Simulation_impl * getSimulation()
Return a pointer to the singleton instance of the Simulation.
Definition simulation_impl.h:148
Cycle_t reregisterClock(TimeConverter *tc, Clock::HandlerBase *handler, int priority)
Reactivate an existing clock and handler.
Definition simulation.cc:1194
UnitAlgebra getEndSimTime() const
Return the end simulation time as a time.
Definition simulation.cc:89
bool isWireUpFinished()
Returns true when the Wireup is finished.
Definition simulation_impl.h:293
void printStatus(bool fullStatus)
Causes the current status of the simulation to be printed to stderr.
Definition simulation.cc:1074
std::map< std::pair< SimTime_t, int >, Clock * > clockMap_t
Definition simulation_impl.h:140
void setupSimActions(Config *cfg, bool restart=false)
Setup external control actions (forced stops, signal handling.
Definition simulation.cc:249
SimTime_t getEndSimCycle() const
Return the end simulation time as a cycle count.
Definition simulation.cc:71
static Output & getSimulationOutput()
Return the base simulation Output class instance.
Definition simulation_impl.h:154
void complete()
Perform the complete() phase of simulation.
Definition simulation.cc:734
RankInfo getRank() const
Get this instance's parallel rank.
Definition simulation_impl.h:112
RankInfo getNumRanks() const
Get the number of parallel ranks in the simulation.
Definition simulation_impl.h:115
TimeConverter * registerClock(const std::string &freq, Clock::HandlerBase *handler, int priority)
Register a handler to be called on a set frequency.
Definition simulation.cc:1125
SimTime_t getClockForHandler(Clock::HandlerBase *handler)
Gets the clock the handler is registered with, represented by it's factor.
Definition simulation.cc:1230
void checkpoint_append_registry(const std::string &registry_name, const std::string &blob_name)
Append partitions registry information.
Definition simulation.cc:1658
std::map< std::pair< SimTime_t, int >, OneShot * > oneShotMap_t
Definition simulation_impl.h:141
static TimeLord timeLord
TimeLord of the simulation.
Definition simulation_impl.h:472
static SimTime_t getLocalMinimumNextActivityTime()
Gets the minimum next activity time across all TimeVortices in the Rank.
Definition simulation.cc:388
Statistics::StatisticProcessingEngine * getStatisticsProcessingEngine()
Return the Statistic Processing Engine associated with this Simulation.
Definition simulation.cc:1313
static void shutdown()
Used to signify the end of simulation.
Definition simulation.cc:171
static TimeLord * getTimeLord()
Return the TimeLord associated with this Simulation.
Definition simulation_impl.h:151
void initializeProfileTools(const std::string &config)
Performance Tracking Information.
Definition simulation.cc:1389
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,...
Definition simulation.cc:1262
void requireLibrary(const std::string &name)
Signifies that a library is required for this simulation.
Definition simulation.cc:376
void unregisterClock(TimeConverter *tc, Clock::HandlerBase *handler, int priority)
Remove a clock handler from the list of active clock handlers.
Definition simulation.cc:1252
TimeConverter minPartToTC(SimTime_t cycles) const
Get a handle to a TimeConverter.
Definition simulation.cc:97
CheckpointAction * getCheckpointAction() const
Return the checkpoint event.
Definition simulation_impl.h:302
std::string & getOutputDirectory()
Returns the output directory of the simulation.
Definition simulation_impl.h:121
static SST::Util::Filesystem filesystem
Filesystem object that will be used to ensure all core-created files end up in the directory specifie...
Definition simulation_impl.h:390
std::vector< std::pair< ComponentId_t, uint64_t > > component_blob_offsets_
vector to hold offsets of component blobs in checkpoint files
Definition simulation_impl.h:469
static void emergencyShutdown()
Emergency Shutdown Called when a fatal event has occurred.
Definition simulation.cc:978
void adjustTimeAtSimEnd()
Adjust clocks and time to reflect precise simulation end time which may differ in parallel simulation...
Definition simulation.cc:1030
void checkpoint(const std::string &checkpoint_filename)
Write the partition specific checkpoint data.
Definition simulation.cc:1680
const ComponentInfoMap & getComponentInfoMap() const
Returns reference to the Component Info Map.
Definition simulation_impl.h:248
int getCurrentPriority() const
Return the current priority.
Definition simulation.cc:77
An optional heartbeat to show progress in a simulation.
Definition heartbeat.h:33
Forms the base class for statistics output generation within the SST core.
Definition statoutput.h:52
An SST core component that handles timing and event processing informing all registered Statistics to...
Definition statengine.h:58
Definition syncManager.h:138
Definition syncManager.h:95
A class to convert between a component's view of time and the core's view of time.
Definition timeConverter.h:28
Class for creating and managing TimeConverter objects.
Definition timeLord.h:40
Primary Event Queue.
Definition timeVortex.h:30
Performs Unit math in full precision.
Definition unitAlgebra.h:107
Class used to manage files and directories.
Definition filesystem.h:33