SST  13.0.0
StructuralSimulationToolkit
simulation.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_H
15 #define SST_CORE_SIMULATION_H
16 
17 #if !SST_BUILDING_CORE
18 #warning "The Simulation object is being removed as part of the public API and simulation.h will be removed in SST 14"
19 #endif
20 
21 #include "sst/core/output.h"
22 #include "sst/core/rankInfo.h"
23 #include "sst/core/sst_types.h"
24 #include "sst/core/unitAlgebra.h"
25 
26 namespace SST {
27 
28 // #define _SIM_DBG( fmt, args...) __DBG( DBG_SIM, Sim, fmt, ## args )
29 #define STATALLFLAG "--ALLSTATS--"
30 
31 class Output;
32 class TimeLord;
33 
34 /**
35  * Main control class for a SST Simulation.
36  * Provides base features for managing the simulation
37  */
39 {
40 public:
41  virtual ~Simulation() {}
42 
43 
44  /********* Public API ************/
45  /** Get the run mode of the simulation (e.g. init, run, both etc) */
46  virtual SimulationRunMode getSimulationMode() const = 0;
47 
48  /** Return the current simulation time as a cycle count*/
49  virtual SimTime_t getCurrentSimCycle() const = 0;
50 
51  /** Return the end simulation time as a cycle count*/
52  virtual SimTime_t getEndSimCycle() const = 0;
53 
54  /** Return the current priority */
55  virtual int getCurrentPriority() const = 0;
56 
57  /** Return the elapsed simulation time as a time */
58  virtual UnitAlgebra getElapsedSimTime() const = 0;
59 
60  /** Return the end simulation time as a time */
61  virtual UnitAlgebra getEndSimTime() const = 0;
62 
63  /** Get this instance's parallel rank */
64  virtual RankInfo getRank() const = 0;
65 
66  /** Get the number of parallel ranks in the simulation */
67  virtual RankInfo getNumRanks() const = 0;
68 
69  /** Returns the output directory of the simulation
70  * @return Directory in which simulation outputs are placed
71  */
72  virtual std::string& getOutputDirectory() = 0;
73 
74  /** Signifies that a library is required for this simulation.
75  * @param name Name of the library
76  */
77  virtual void requireLibrary(const std::string& name) = 0;
78 
79  /** Causes the current status of the simulation to be printed to stderr.
80  * @param fullStatus - if true, call printStatus() on all components as well
81  * as print the base Simulation's status
82  */
83  virtual void printStatus(bool fullStatus) = 0;
84 
85  /** Get the amount of real-time spent executing the run phase of
86  * the simulation.
87  *
88  * @return real-time in seconds spent executing the run phase
89  */
90  virtual double getRunPhaseElapsedRealTime() const = 0;
91 
92  /** Get the amount of real-time spent executing the init phase of
93  * the simulation.
94  *
95  * @return real-time in seconds spent executing the init phase
96  */
97  virtual double getInitPhaseElapsedRealTime() const = 0;
98 
99  /** Get the amount of real-time spent executing the complete phase of
100  * the simulation.
101  *
102  * @return real-time in seconds spent executing the complete phase
103  */
104  virtual double getCompletePhaseElapsedRealTime() const = 0;
105 
106 protected:
107  Simulation() {}
108  // Simulation(Config* config, RankInfo my_rank, RankInfo num_ranks);
109  Simulation(Simulation const&); // Don't Implement
110  void operator=(Simulation const&); // Don't implement
111 };
112 
113 } // namespace SST
114 
115 #endif // SST_CORE_SIMULATION_H
virtual SimTime_t getEndSimCycle() const =0
Return the end simulation time as a cycle count.
Main control class for a SST Simulation.
Definition: simulation.h:38
virtual void requireLibrary(const std::string &name)=0
Signifies that a library is required for this simulation.
virtual RankInfo getRank() const =0
Get this instance's parallel rank.
Definition: action.cc:18
virtual SimulationRunMode getSimulationMode() const =0
Get the run mode of the simulation (e.g.
virtual UnitAlgebra getElapsedSimTime() const =0
Return the elapsed simulation time as a time.
virtual void printStatus(bool fullStatus)=0
Causes the current status of the simulation to be printed to stderr.
virtual double getCompletePhaseElapsedRealTime() const =0
Get the amount of real-time spent executing the complete phase of the simulation. ...
Definition: rankInfo.h:21
virtual RankInfo getNumRanks() const =0
Get the number of parallel ranks in the simulation.
virtual int getCurrentPriority() const =0
Return the current priority.
virtual UnitAlgebra getEndSimTime() const =0
Return the end simulation time as a time.
virtual double getRunPhaseElapsedRealTime() const =0
Get the amount of real-time spent executing the run phase of the simulation.
virtual SimTime_t getCurrentSimCycle() const =0
Return the current simulation time as a cycle count.
virtual std::string & getOutputDirectory()=0
Returns the output directory of the simulation.
Performs Unit math in full precision.
Definition: unitAlgebra.h:106
virtual double getInitPhaseElapsedRealTime() const =0
Get the amount of real-time spent executing the init phase of the simulation.