SST/macro
app_launch.h
Go to the documentation of this file.
1 #ifndef APPMANAGER_H
2 #define APPMANAGER_H
3 
9 
11 #include <sprockit/unordered.h>
12 
18 
21 
22 #include <vector>
23 
24 #if SSTMAC_INTEGRATED_SST_CORE
25 #define STATIC_INIT_APP_MANAGER(params) \
26 { \
27  sstmac::sw::app_launch* mgr = sstmac::sw::app_launch::static_app_launch(params); \
28  set_app_launch(mgr); \
29 }
30 
31 #else
32 #define STATIC_INIT_APP_MANAGER(params)
33 #endif
34 
35 namespace sstmac {
36 namespace sw {
37 
38 class app_launch :
40 {
41 
42  public:
44  aid_(aid), rt_(rt)
45  {
46  }
47 
48  virtual ~app_launch();
49 
50  int
51  nproc() const {
52  return nproc_;
53  }
54 
55  node_id
56  node_assignment(int rank) const {
57  return rank_to_node_indexing_[rank];
58  }
59 
60  const std::list<int>&
61  rank_assignment(node_id nid) const {
62  return node_to_rank_indexing_[nid];
63  }
64 
65  app*
66  app_template() const {
67  return app_template_;
68  }
69 
70  timestamp
71  start() const {
72  return start_;
73  }
74 
75  app_id
76  aid() const {
77  return aid_;
78  }
79 
80  std::vector<int>
81  core_affinities() const {
82  return core_affinities_;
83  }
84 
85  virtual void
86  init_factory_params(sprockit::sim_parameters* params);
87 
88  void
89  set_topology(hw::topology* top);
90 
91  hw::topology*
92  topol() const {
93  return top_;
94  }
95 
96  /**
97  * @brief request_allocation Request a set of nodes to be used by the job
98  * @param available The set of nodes available
99  * @param allocation Reference return. Will contain all the nodes request for the allocation.
100  * The allocation is NOT necessarily a subset of availabe. If the allocation fails
101  * the function can still return an allocation request that might be satisfied
102  * at a later time.
103  */
104  void
105  request_allocation(const ordered_node_set& available,
106  ordered_node_set& allocation);
107 
108  /**
109  * @brief index_allocation Given an allocation of nodes, index or map the job. For MPI,
110  * this means assigning MPI ranks to nodes (and possibly even cores).
111  * @param allocation The set of nodes returned by the allocation request
112  */
113  void
114  index_allocation(const ordered_node_set& allocation);
115 
116  static app_launch*
117  static_app_launch(int aid, sprockit::sim_parameters* params);
118 
119  static void
120  parse_aprun(const std::string& cmd, int& nproc, int& nproc_per_node,
121  std::vector<int>& core_affinities);
122 
123  static void
125  sprockit::sim_parameters* params,
126  int& nproc,
127  int& procs_per_node,
128  std::vector<int>& affinities);
129 
130  private:
133  std::vector<node_id> rank_to_node_indexing_;
134  std::vector<std::list<int> > node_to_rank_indexing_;
135 
137 
138  hw::topology* top_;
139 
141 
143 
144  std::string appname_;
145 
146  std::vector<int> core_affinities_;
147 
149 
150  int nproc_;
151 
153 
154  void parse_launch_cmd(sprockit::sim_parameters* params);
155 
156  private:
157  static std::map<int, app_launch*> static_app_launches_;
158 
159  void init_launch_info();
160 
161 };
162 
164 
165 }
166 }
167 
168 
169 
170 #endif // APPMANAGER_H
void index_allocation(const ordered_node_set &allocation)
index_allocation Given an allocation of nodes, index or map the job.
std::vector< node_id > rank_to_node_indexing_
Definition: app_launch.h:133
void set_topology(hw::topology *top)
const std::list< int > & rank_assignment(node_id nid) const
Definition: app_launch.h:61
parallel_runtime * rt_
Definition: app_launch.h:136
std::set< node_id > ordered_node_set
Definition: node_set.h:10
app_id aid() const
Definition: app_launch.h:76
std::vector< int > core_affinities_
Definition: app_launch.h:146
app_launch(app_id aid, parallel_runtime *rt)
Definition: app_launch.h:43
node_id node_assignment(int rank) const
Definition: app_launch.h:56
static std::map< int, app_launch * > static_app_launches_
Definition: app_launch.h:157
Strategy type for assigning processes to nodes in a parallel run.
The app derived class adds to the thread base class by providing facilities to allow applications to ...
Definition: app.h:55
std::string appname_
Definition: app_launch.h:144
std::vector< std::list< int > > node_to_rank_indexing_
Definition: app_launch.h:134
static void parse_aprun(const std::string &cmd, int &nproc, int &nproc_per_node, std::vector< int > &core_affinities)
static void parse_launch_cmd(sprockit::sim_parameters *params, int &nproc, int &procs_per_node, std::vector< int > &affinities)
hw::topology * topol() const
Definition: app_launch.h:92
A basic container for time (subject to future transplant).
Definition: timestamp.h:29
sw::task_mapper * indexer_
Definition: app_launch.h:132
SUMI = Simulator unified messagine interface It is also the name for a solid ink in Japanese - i...
DeclareFactory(blas_kernel)
app * app_template() const
Definition: app_launch.h:66
timestamp start() const
Definition: app_launch.h:71
virtual void init_factory_params(sprockit::sim_parameters *params)
sw::node_allocator * allocator_
Definition: app_launch.h:131
void request_allocation(const ordered_node_set &available, ordered_node_set &allocation)
request_allocation Request a set of nodes to be used by the job
Base class for strategies regarding how to sequentially number nodes in a parallel simulation...
Definition: task_mapper.h:33
endpoint_id node_id
Definition: node_address.h:20
static app_launch * static_app_launch(int aid, sprockit::sim_parameters *params)
hw::topology * top_
Definition: app_launch.h:138
int app_id
Definition: app_id.h:20
int nproc() const
Definition: app_launch.h:51
std::vector< int > core_affinities() const
Definition: app_launch.h:81