14 #ifndef SST_CORE_SIMULATION_H 15 #define SST_CORE_SIMULATION_H 17 #include "sst/core/sst_types.h" 24 #include <unordered_map> 26 #include <sst/core/output.h> 27 #include <sst/core/clock.h> 28 #include <sst/core/oneshot.h> 29 #include <sst/core/unitAlgebra.h> 30 #include <sst/core/rankInfo.h> 32 #include <sst/core/componentInfo.h> 35 extern int main(
int argc,
char **argv);
40 #define _SIM_DBG( fmt, args...) __DBG( DBG_SIM, Sim, fmt, ## args ) 41 #define STATALLFLAG "--ALLSTATS--" 49 class SimulatorHeartbeat;
60 class SharedRegionManager;
61 namespace Statistics {
62 class StatisticOutput;
63 class StatisticProcessingEngine;
97 static void shutdown();
101 static void setSignal(
int signal);
106 void printStatus(
bool fullStatus);
117 void setStopAtCycle(
Config* cfg );
127 bool isIndependentThread() {
return independent;}
132 const SimTime_t& getCurrentSimCycle()
const;
134 SimTime_t getEndSimCycle()
const;
136 int getCurrentPriority()
const;
156 Cycle_t getNextClockCycle(
TimeConverter* tc,
int priority = CLOCKPRIORITY);
166 void insertActivity(SimTime_t time,
Activity* ev);
171 const std::vector<SimTime_t>& getInterThreadLatencies()
const {
return interThreadLatencies; }
172 SimTime_t getInterThreadMinLatency()
const {
return interThreadMinLatency; }
180 uint64_t getTimeVortexMaxDepth()
const;
181 uint64_t getTimeVortexCurrentDepth()
const;
182 uint64_t getSyncQueueDataSize()
const;
190 if ( NULL == info ) {
193 return info->getLinkMap();
211 return i->getComponent();
213 printf(
"Simulation::getComponent() couldn't find component with id = %" PRIu64
"\n",
id);
219 ComponentInfo* getComponentInfo(
const ComponentId_t &
id)
const 226 printf(
"Simulation::getComponentInfo() couldn't find component with id = %" PRIu64
"\n",
id);
238 output_directory = outDir;
246 return output_directory;
253 void requireEvent(std::string name);
259 SimTime_t getNextActivityTime()
const;
265 static SimTime_t getLocalMinimumNextActivityTime();
282 friend int ::main(
int argc,
char **argv);
301 static void resizeBarriers(uint32_t nthr);
308 static std::mutex simulationMutex;
312 Component* createComponent(ComponentId_t
id, std::string &name,
315 TimeVortex* getTimeVortex()
const {
return timeVortex; }
320 static void emergencyShutdown();
323 void endSimulation(
void) { endSimulation(currentSimCycle); }
324 void endSimulation(SimTime_t end);
338 static SimTime_t minPart;
340 std::vector<SimTime_t> interThreadLatencies;
341 SimTime_t interThreadMinLatency;
346 oneShotMap_t oneShotMap;
347 SimTime_t currentSimCycle;
348 SimTime_t endSimCycle;
356 static std::atomic<int> untimed_msg_count;
357 unsigned int untimed_phase;
358 volatile sig_atomic_t lastRecvdSignal;
359 ShutdownMode_t shutdown_mode;
360 std::string output_directory;
364 static std::unordered_map<std::thread::id, Simulation*> instanceMap;
365 static std::vector<Simulation*> instanceVec;
367 friend void wait_my_turn_start();
368 friend void wait_my_turn_end();
384 #endif //SST_CORE_SIMULATION_H Output object provides consistant method for outputing data to stdout, stderr and/or sst debug file...
Definition: output.h:54
An Action is a schedulable Activity which is not an Event.
Definition: action.h:30
Definition: syncManager.h:113
Mode_t getSimulationMode() const
Get the run mode of the simulation (e.g.
Definition: simulation.h:130
Main control class for a SST Simulation.
Definition: simulation.h:72
Base class for all Activities in the SST Event Queue.
Definition: activity.h:54
Maps port names to the Links that are connected to it.
Definition: linkMap.h:28
Class to contain SST Simulation Configuration variables.
Definition: config.h:31
static TimeLord * getTimeLord(void)
Return the TimeLord associated with this Simulation.
Definition: simulation.h:176
BaseComponent * getComponent(const ComponentId_t &id) const
returns the component with the given ID
Definition: simulation.h:206
A class to convert between a component's view of time and the core's view of time.
Definition: timeConverter.h:25
Main component object for the simulation.
Definition: component.h:32
A Configuration Graph A graph representing Components and Links.
Definition: configGraph.h:294
Primary Event Queue.
Definition: timeVortex.h:28
std::string & getOutputDirectory()
Returns the output directory of the simulation.
Definition: simulation.h:245
Definition: simulation.h:77
void setOutputDirectory(std::string &outDir)
Set the output directory for this simulation.
Definition: simulation.h:237
RankInfo getNumRanks() const
Get the number of parallel ranks in the simulation.
Definition: simulation.h:144
Definition: simulation.h:76
Exit Event Action.
Definition: exit.h:34
std::map< std::pair< SimTime_t, int >, OneShot * > oneShotMap_t
Definition: simulation.h:83
Definition: componentInfo.h:126
static Output & getSimulationOutput()
Return the base simulation Output class instance.
Definition: simulation.h:178
Definition: threadSync.h:35
An optional heartbeat to show progress in a simulation
Definition: heartbeat.h:32
A Clock class.
Definition: clock.h:35
RankInfo getRank() const
Get this instance's parallel rank.
Definition: simulation.h:142
Definition: rankInfo.h:21
Functor classes for Clock handling.
Definition: clock.h:44
Main component object for the simulation.
Definition: baseComponent.h:104
LinkMap * getComponentLinkMap(ComponentId_t id) const
Return pointer to map of links for a given component id.
Definition: simulation.h:188
static Simulation * getSimulation()
Return a pointer to the singleton instance of the Simulation.
Definition: simulation.h:99
A OneShot Event class.
Definition: oneshot.h:33
Parameter store.
Definition: params.h:45
Class for creating and managing TimeConverter objects.
Definition: timeLord.h:36
Exit * getExit() const
Return the exit event.
Definition: simulation.h:169
static SharedRegionManager * getSharedRegionManager()
Returns the Simulation's SharedRegionManager.
Definition: simulation.h:270
Class for instantiating Components, Links and the like out of element libraries.
Definition: factory.h:45
bool isWireUpFinished()
Returns true when the Wireup is finished.
Definition: simulation.h:275
Definition: simulation.h:78
Definition: componentInfo.h:34
An SST core component that handles timing and event processing informing all registered Statistics to...
Definition: statengine.h:49
Mode_t
Type of Run Modes.
Definition: simulation.h:75
Performs Unit math in full precision.
Definition: unitAlgebra.h:104
std::map< std::pair< SimTime_t, int >, Clock * > clockMap_t
Definition: simulation.h:82
Definition: threadsafe.h:45
Link between two components.
Definition: link.h:33
const ComponentInfoMap & getComponentInfoMap(void)
Returns reference to the Component Map.
Definition: simulation.h:202
Definition: sharedRegion.h:56
Functor classes for OneShot handling.
Definition: oneshot.h:39