SST/macro
manager.h
Go to the documentation of this file.
1 /*
2  * This file is part of SST/macroscale:
3  * The macroscale architecture simulator from the SST suite.
4  * Copyright (c) 2009 Sandia Corporation.
5  * This software is distributed under the BSD License.
6  * Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
7  * the U.S. Government retains certain rights in this software.
8  * For more information, see the LICENSE file in the top
9  * SST/macroscale directory.
10  */
11 
12 #ifndef SSTMAC_BACKENDS_NATIVE_MANAGER_H_INCLUDED
13 #define SSTMAC_BACKENDS_NATIVE_MANAGER_H_INCLUDED
14 
23 
24 DeclareDebugSlot(timestamp);
25 
26 namespace sstmac {
27 namespace native {
28 
29 /**
30  * The owner of a discrete-event network simulation.
31  *
32  * All time progression is handled by this object
33  * and messages between nodes are managed here as well.
34  */
36 
37  public:
38  manager();
39 
40  virtual std::string
41  to_string() const {
42  return "manager";
43  }
44 
45  /// Goodbye.
46  virtual ~manager() throw ();
47 
48  void
49  init_factory_params(sprockit::sim_parameters* params);
50 
51  virtual timestamp
52  run(timestamp until) = 0;
53 
54  virtual void stop() = 0;
55 
56  virtual void finish() = 0;
57 
58  sstmac::hw::interconnect*
59  interconn() const {
60  return interconnect_;
61  }
62 
63  void
64  build_apps(sprockit::sim_parameters* params);
65 
66  void
67  build_app(int appnum,
68  sprockit::sim_parameters* params);
69 
70  static int
71  compute_max_nproc(sprockit::sim_parameters *params);
72 
73  static int
74  compute_max_nproc_for_app(sprockit::sim_parameters* app_params);
75 
76  protected:
77  /// Next parallel process id.
79 
80  std::map<int, sw::app_launch*> app_managers_;
81 
82  sstmac::hw::interconnect* interconnect_;
84 
85 };
86 
87 #if SSTMAC_INTEGRATED_SST_CORE
88 class sst_manager : public manager
89 {
90  virtual void
91  init_factory_params(sprockit::sim_parameters *params);
92 };
93 #else
94 class macro_manager : public manager
95 {
96  public:
98 
99  virtual ~macro_manager() throw();
100 
101  virtual void
102  init_factory_params(sprockit::sim_parameters *params);
103 
104  /**
105  * @brief run
106  * @param until The time to run until. Negative value indicates run until no more events
107  * @return The time of the last event
108  */
109  timestamp run(timestamp until = timestamp(-1));
110 
111  void finish();
112 
113  private:
114  void
115  launch_app(int appnum, timestamp start, sw::app_launch* appman);
116 
117  void
118  launch_apps();
119 
120  void start();
121 
122  void stop();
123 
124  private:
125  /// The event manager.
127 
128  /// Monitor whether the simulator is currently running.
129  bool running_;
130 
132 
133 
134 };
135 #endif
136 
137 }
138 } // end of namespace sstmac.
139 
140 #endif
141 
The job_launcher class performs the combined operations a queue scheduler like PBS or MOAB and a job ...
Definition: job_launcher.h:26
virtual ~manager()
Goodbye.
DeclareDebugSlot(timestamp)
virtual std::string to_string() const
Definition: manager.h:41
void build_apps(sprockit::sim_parameters *params)
sstmac::sw::app_id next_ppid_
Next parallel process id.
Definition: manager.h:78
Base type for implementations of an engine that is able to schedule events and advance simulation tim...
Definition: event_manager.h:47
event_manager * event_manager_
The event manager.
Definition: manager.h:126
The owner of a discrete-event network simulation.
Definition: manager.h:35
sw::job_launcher * launcher_
Definition: manager.h:131
parallel_runtime * rt_
Definition: manager.h:83
bool running_
Monitor whether the simulator is currently running.
Definition: manager.h:129
A basic container for time (subject to future transplant).
Definition: timestamp.h:29
sstmac::hw::interconnect * interconn() const
Definition: manager.h:59
SUMI = Simulator unified messagine interface It is also the name for a solid ink in Japanese - i...
std::map< int, sw::app_launch * > app_managers_
Definition: manager.h:80
virtual void finish()=0
virtual timestamp run(timestamp until)=0
void build_app(int appnum, sprockit::sim_parameters *params)
static int compute_max_nproc_for_app(sprockit::sim_parameters *app_params)
static int compute_max_nproc(sprockit::sim_parameters *params)
virtual void stop()=0
sstmac::hw::interconnect * interconnect_
Definition: manager.h:82
void init_factory_params(sprockit::sim_parameters *params)
int app_id
Definition: app_id.h:20