SST/macro
dragonfly.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_HARDWARE_NETWORK_TOPOLOGY_DRAGONFLY_H_INCLUDED
13 #define SSTMAC_HARDWARE_NETWORK_TOPOLOGY_DRAGONFLY_H_INCLUDED
14 
16 
17 namespace sstmac {
18 namespace hw {
19 
21 {
22 
23  public:
24  typedef enum {
28  } dimension_t;
29 
30  typedef enum {
31  upX_vc = 0,
33  } x_vc_t;
34 
35  typedef enum {
36  upY_vc = 0,
38  } y_vc_t;
39 
40  public:
41  virtual std::string
42  to_string() const {
43  return "dragonfly";
44  }
45 
47  dim_for_port(int port){
48  if (port >= (x_ + y_)){
49  return g_dimension;
50  } else if (port >= x_){
51  return y_dimension;
52  } else {
53  return x_dimension;
54  }
55  }
56 
57  virtual ~dragonfly() {}
58 
59  virtual void
60  init_factory_params(sprockit::sim_parameters* params);
61 
62  void
63  init_common_params(sprockit::sim_parameters* params);
64 
65  int
66  ndimensions() const {
67  return 3;
68  }
69 
70  int
71  numX() const {
72  return x_;
73  }
74 
75  int
76  numY() const {
77  return y_;
78  }
79 
80  int
81  numG() const {
82  return g_;
83  }
84 
85  int
86  group_con() const {
87  return group_con_;
88  }
89 
90  void
91  get_coords(long uid, int &x, int &y, int &g) const;
92 
93  long
94  get_uid(int x, int y, int g) const;
95 
96  switch_id
97  switch_number(const coordinates &coords) const;
98 
99  virtual int
100  num_switches() const {
101  return x_ * y_ * g_;
102  }
103 
104  int
106  return x_ * y_ * g_;
107  }
108 
109  virtual void
110  connect_objects(internal_connectable_map& switches);
111 
112  virtual int
113  diameter() const {
114  return 5;
115  }
116 
118  neighbor_at_port(switch_id sid, int port) const;
119 
120  virtual switch_id
122  switch_id dest_sw = switch_id(-1));
123 
124  virtual int
125  convert_to_port(int dim, int dir) const;
126 
127  void
128  configure_vc_routing(std::map<routing::algorithm_t, int> &m) const;
129 
130  virtual void
132  int dim,
133  const coordinates& src,
134  const coordinates& dst,
135  structured_routable::path& path) const;
136 
137  void
139  const coordinates &src_coords,
140  const coordinates &dest_coords,
141  structured_routable::path& path) const;
142 
143  int
145  const coordinates& src_coords,
146  const coordinates& dest_coords) const;
147 
148  void
150  const coordinates& src_sw_coords, int port,
151  std::vector<node_id>& partners) const;
152 
153  void
155  const coordinates &src_sw_coords, int port,
156  std::vector<node_id>& partners) const;
157 
158  void
160  const coordinates &src_sw_coords, int port,
161  std::vector<node_id>& partners) const;
162 
163  void
165  const coordinates &src_sw_coords, int port,
166  std::vector<node_id>& partners) const;
167 
168  virtual void
170 
171  virtual void
172  configure_geometric_paths(std::vector<int> &redundancies);
173 
174  protected:
175  void
176  minimal_route_to_group(int myX, int myY, int myG, int& dim, int& dir, int dstg) const;
177 
178  virtual void
179  find_path_to_group(int myX, int myY, int myG, int& dsty, int& dstx, int dstg) const;
180 
181  int
182  minimal_route_to_X(int hisx) const;
183 
184  int
185  minimal_route_to_Y(int hisy) const;
186 
187  virtual void
188  compute_switch_coords(switch_id uid, coordinates& coords) const;
189 
190  int
191  find_y_path_to_group(int myX, int myG, int dstg) const;
192 
193  int
194  find_x_path_to_group(int myY, int myG, int dstg) const;
195 
196  virtual bool
197  xy_connected_to_group(int myX, int myY, int myG, int dstg) const;
198 
199  int
200  xyg_dir_to_group(int myX, int myY, int myG, int dir) const;
201 
202  protected:
203  int x_;
204  int y_;
205  int g_;
208 
209  static std::string
210  set_string(int x, int y, int g)
211  {
212  return sprockit::printf("{ %d %d %d }", x, y, g);
213  }
214 
215 };
216 
217 }
218 } //end of namespace sstmac
219 
220 #endif
void bit_complement_partners(const coordinates &src_sw_coords, int port, std::vector< node_id > &partners) const
int numG() const
Definition: dragonfly.h:81
virtual void configure_geometric_paths(std::vector< int > &redundancies)
configure_geometric_paths For all possible geometric or structure paths, compute their redundances in...
int find_y_path_to_group(int myX, int myG, int dstg) const
int num_leaf_switches() const
Structured topologies can be direct (torus) or indirect (fat tree).
Definition: dragonfly.h:105
virtual void init_factory_params(sprockit::sim_parameters *params)
void init_common_params(sprockit::sim_parameters *params)
void minimal_route_to_group(int myX, int myY, int myG, int &dim, int &dir, int dstg) const
virtual std::string to_string() const
Definition: dragonfly.h:42
void tornado_send_partners(const coordinates &src_sw_coords, int port, std::vector< node_id > &partners) const
switch_id switch_number(const coordinates &coords) const
virtual void new_routing_stage(structured_routable *rtbl)
virtual void connect_objects(internal_connectable_map &switches)
Given a set of connectables, connect them appropriately.
virtual void find_path_to_group(int myX, int myY, int myG, int &dsty, int &dstx, int dstg) const
std::string printf(const char *fmt,...)
int minimal_route_to_Y(int hisy) const
virtual int num_switches() const
Definition: dragonfly.h:100
void tornado_recv_partners(const coordinates &src_sw_coords, int port, std::vector< node_id > &partners) const
int numX() const
Definition: dragonfly.h:71
int ndimensions() const
The number of distinct &#39;dimensions&#39; in the topology.
Definition: dragonfly.h:66
void configure_vc_routing(std::map< routing::algorithm_t, int > &m) const
virtual void productive_path(int dim, const coordinates &src, const coordinates &dst, structured_routable::path &path) const
virtual int convert_to_port(int dim, int dir) const
The cartesian_topology class Encapsulates a topology like torus that can be naturally mapped onto an ...
topology_id switch_id
Definition: node_address.h:23
int numY() const
Definition: dragonfly.h:76
SUMI = Simulator unified messagine interface It is also the name for a solid ink in Japanese - i...
void nearest_neighbor_partners(const coordinates &src_sw_coords, int port, std::vector< node_id > &partners) const
long get_uid(int x, int y, int g) const
virtual ~dragonfly()
Definition: dragonfly.h:57
static std::string set_string(int x, int y, int g)
Definition: dragonfly.h:210
int find_x_path_to_group(int myY, int myG, int dstg) const
virtual void compute_switch_coords(switch_id uid, coordinates &coords) const
Compute coordinates (e.g.
void partners(bool get_send_partner, traffic_pattern::type_t ty, node_id src, std::vector< node_id > &partner_list) const
coordinates neighbor_at_port(switch_id sid, int port) const
void minimal_route_to_coords(const coordinates &src_coords, const coordinates &dest_coords, structured_routable::path &path) const
Workhorse function for implementing minimal_route_to_switch and #minimal_route_to_node.
virtual bool xy_connected_to_group(int myX, int myY, int myG, int dstg) const
int minimal_route_to_X(int hisx) const
virtual switch_id random_intermediate_switch(switch_id current_sw, switch_id dest_sw=switch_id(-1))
virtual int diameter() const
Definition: dragonfly.h:113
int minimal_distance(const coordinates &src_coords, const coordinates &dest_coords) const
The function accepts either source or node coordinates.
int xyg_dir_to_group(int myX, int myY, int myG, int dir) const
bool true_random_intermediate_
Definition: dragonfly.h:207
dimension_t dim_for_port(int port)
Definition: dragonfly.h:47
void get_coords(long uid, int &x, int &y, int &g) const
int group_con() const
Definition: dragonfly.h:86