SST/macro
fat_tree.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 // fattree.h: Interface for fat tree networks.
13 //
14 // Author: Jeremiah Wilke <jjwilke@sandia.gov>
15 
16 #ifndef SSTMAC_HARDWARE_NETWORK_TOPOLOGY_FATTREE_H_INCLUDED
17 #define SSTMAC_HARDWARE_NETWORK_TOPOLOGY_FATTREE_H_INCLUDED
18 
20 
21 
22 namespace sstmac {
23 namespace hw {
24 
26  public structured_topology
27 {
28  public:
29  typedef enum {
32  } dimension_t;
33 
34  int
35  l() const {
36  return l_;
37  }
38 
39  int
40  k() const {
41  return k_;
42  }
43 
44  virtual void
45  init_factory_params(sprockit::sim_parameters* params);
46 
47  virtual int
48  ndimensions() const {
49  //fat-tree is indexed by row and column
50  return 2;
51  }
52 
53  static int
54  pow(int a, int exp){
55  int res = 1;
56  for (int i=0; i < exp; ++i){
57  res *= a;
58  }
59  return res;
60  }
61 
62  int
63  diameter() const {
64  return (l_ + 1) * 2;
65  }
66 
67  virtual int
69  return numleafswitches_;
70  }
71 
72  std::vector<node_id>
74 
75  std::vector<node_id>
77 
78  protected:
79  std::vector<node_id>
81 
82  protected:
84  int toplevel_;
85 };
86 
87 /**
88  * @class fat_tree
89  * The fat tree network generates a k-ary fat tree with l tiers
90  */
91 class fat_tree :
92  public abstract_fat_tree
93 {
94 
95  public:
96  virtual std::string
97  to_string() const {
98  return "fat tree topology";
99  }
100 
101  virtual ~fat_tree() {}
102 
103  virtual void
104  init_factory_params(sprockit::sim_parameters* params);
105 
106  virtual void
107  connect_objects(internal_connectable_map& switches);
108 
109  virtual int
110  convert_to_port(int dim, int dir) const;
111 
112  virtual int
113  num_switches() const {
114  return numleafswitches_ * l_;
115  }
116 
117  std::string
118  default_router() const {
119  return "fattree";
120  }
121 
123  neighbor_at_port(switch_id sid, int port) const;
124 
125  void
126  configure_vc_routing(std::map<routing::algorithm_t, int> &m) const;
127 
128  switch_id
129  switch_number(const coordinates &coords) const;
130 
131  void
133  int dim,
134  const coordinates &src,
135  const coordinates &dst,
136  structured_routable::path& path) const;
137 
138  virtual void
140  switch_id current_sw_addr,
141  switch_id dest_sw_addr,
142  structured_routable::path& path) const;
143 
144  virtual void
146  const coordinates &src_coords,
147  const coordinates &dest_coords,
148  structured_routable::path& path) const;
149 
150  int
151  nearest_common_ancestor_level(
152  const switch_id & src_sw_addr,
153  const switch_id & dst_sw_addr) const;
154 
155  int
156  nearest_common_ancestor_level(
157  const switch_id & src_sw_addr,
158  const coordinates & dst_coords) const;
159 
160  int
161  nearest_common_ancestor_level(
162  const coordinates & src_coords,
163  const switch_id & dst_sw_addr) const;
164 
165  int
166  nearest_common_ancestor_level(
167  const coordinates & src_corrds,
168  const coordinates & dst_coords) const;
169 
170  virtual int
172  const coordinates& src_coords,
173  const coordinates& dest_coords) const;
174 
175  int
176  switch_at_row_col(int row, int col) const {
177  return row * numleafswitches_ + col;
178  }
179 
180  static int
181  upColumnConnection(int k, int myColumn, int upPort, int columnSize);
182 
183  static int
184  downColumnConnection(int k, int myColumn, int downPort, int columnSize);
185 
186  protected:
187  virtual void
188  compute_switch_coords(switch_id uid, coordinates& coords) const;
189 
190 };
191 
193 {
194  public:
195  virtual std::string
196  to_string() const {
197  return "simple fat tree topology";
198  }
199 
200  virtual ~simple_fat_tree() {}
201 
202  virtual void
203  init_factory_params(sprockit::sim_parameters* params);
204 
205  virtual void
206  connect_objects(internal_connectable_map& switches);
207 
208  int
209  num_switches() const {
210  return num_switches_;
211  }
212 
213  int
214  convert_to_port(int dim, int dir) const;
215 
216  virtual void
217  partition(
218  int* switches_per_lp,
219  int *switch_to_lp,
220  int *switch_to_thread,
221  int& local_num_switches,
222  int me,
223  int nproc,
224  int nthread,
225  int noccupied);
226 
227  void
229  const coordinates &src_coords,
230  const coordinates &dest_coords,
231  structured_routable::path &path) const;
232 
233  switch_id
234  switch_number(const coordinates &coords) const;
235 
236  int
237  minimal_distance(const coordinates &src_coords, const coordinates &dest_coords) const;
238 
239  void
240  productive_path(int dim,
241  const coordinates &src,
242  const coordinates &dst,
243  structured_routable::path &path) const;
244 
245  void
246  compute_switch_coords(switch_id swid, coordinates &coords) const;
247 
249  neighbor_at_port(switch_id sid, int port) const;
250 
251  void
252  configure_vc_routing(std::map<routing::algorithm_t, int> &m) const;
253 
254  void
256  switch_id current_sw_addr,
257  switch_id dest_sw_addr,
258  structured_routable::path& path) const;
259 
260  int
261  level(switch_id sid) const;
262 
263  private:
264  int num_hops(int srcLevel, int srcOffset, int dstLevel, int dstOffset) const;
265 
266  int num_hops_to_node(node_id src, node_id dst) const;
267 
268  protected:
269  std::vector<int> level_offsets_;
270 
272 
273  std::vector<double> tapering_;
274 
275 };
276 
277 }
278 } //end of namespace sstmac
279 
280 #endif
std::vector< node_id > nodes_connected_to_switch(switch_id swaddr) const
std::vector< int > level_offsets_
Definition: fat_tree.h:269
virtual std::string to_string() const
Definition: fat_tree.h:196
virtual int minimal_distance(const coordinates &src_coords, const coordinates &dest_coords) const =0
The function accepts either source or node coordinates.
std::vector< node_id > nodes_connected_to_injection_switch(switch_id swaddr) const
virtual std::string to_string() const
Definition: fat_tree.h:97
virtual void connect_objects(internal_connectable_map &objects)=0
Given a set of connectables, connect them appropriately.
virtual int ndimensions() const
The number of distinct &#39;dimensions&#39; in the topology.
Definition: fat_tree.h:48
virtual void compute_switch_coords(switch_id swid, coordinates &coords) const =0
Compute coordinates (e.g.
The fat tree network generates a k-ary fat tree with l tiers.
Definition: fat_tree.h:91
virtual void minimal_route_to_switch(switch_id current_sw_addr, switch_id dest_sw_addr, structured_routable::path &path) const
Implementation of topology::minimal_route_to_switch.
int switch_at_row_col(int row, int col) const
Definition: fat_tree.h:176
std::vector< node_id > nodes_connected_to_ejection_switch(switch_id swaddr) const
virtual void init_factory_params(sprockit::sim_parameters *params)
virtual int num_switches() const
Definition: fat_tree.h:113
virtual ~fat_tree()
Definition: fat_tree.h:101
topology_id switch_id
Definition: node_address.h:23
SUMI = Simulator unified messagine interface It is also the name for a solid ink in Japanese - i...
std::vector< double > tapering_
Definition: fat_tree.h:273
virtual int num_hops_to_node(node_id src, node_id dst) const
virtual coordinates neighbor_at_port(switch_id sid, int port) const
virtual int num_leaf_switches() const
Structured topologies can be direct (torus) or indirect (fat tree).
Definition: fat_tree.h:68
virtual void minimal_route_to_coords(const coordinates &src_coords, const coordinates &dest_coords, structured_routable::path &path) const =0
Workhorse function for implementing minimal_route_to_switch and #minimal_route_to_node.
Encapsulates a topology like torus, fat tree, butterfly which has a regular, well-defined structure...
static int pow(int a, int exp)
Definition: fat_tree.h:54
endpoint_id node_id
Definition: node_address.h:20
int num_switches() const
Definition: fat_tree.h:209
virtual switch_id switch_number(const coordinates &coords) const =0
Class for storing all the partitions given to us by METIS.
Definition: sim_partition.h:35
std::string default_router() const
Definition: fat_tree.h:118
virtual void productive_path(int dim, const coordinates &src, const coordinates &dst, structured_routable::path &path) const =0