SST/macro
tiled_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_TILED_DRAGONFLY_H_INCLUDED
13 #define SSTMAC_HARDWARE_NETWORK_TOPOLOGY_TILED_DRAGONFLY_H_INCLUDED
14 
16 #include <set>
17 
18 namespace sstmac {
19 namespace hw {
20 
21 class tiled_dragonfly : public dragonfly
22 {
23  private:
24 
25  typedef std::pair<int,int> xy_t;
26  typedef std::list<xy_t> xy_list_t;
27  typedef xy_list_t::iterator xy_list_iter;
28  typedef std::vector< xy_list_t* > coor_xy_map_t;
29  typedef std::vector< coor_xy_map_t* > conn_map_t;
30  typedef std::map<int, xy_list_t* > coormap_xy_map_t;
31  typedef std::vector< coormap_xy_map_t* > gconn_map_t;
32 
33  typedef struct connection
34  {
35  int src_group;
38  int dst_group;
41  } connection;
42 
43  std::list<connection> intragrp_conns_;
44  std::list<connection> intergrp_conns_;
45  mutable conn_map_t intragrp_conn_map_; //FIXME mutable is a hack
46  mutable gconn_map_t intergrp_conn_map_; //FIXME mutable is a hack
47 
48  std::string intragroup_file_;
49  std::string intergroup_file_;
51  std::vector<int> injection_ports_;
52  mutable std::map<int,int> port_to_geomid_; //FIXME mutable is a hack
53  std::vector< std::set<int> > switch_to_connected_groups_;
54  int n_tiles_;
55 
56  public:
57 
58  virtual std::string
59  to_string() const {
60  return "tiled_dragonfly";
61  }
62 
63  virtual ~tiled_dragonfly() {}
64 
65  virtual void
66  init_factory_params(sprockit::sim_parameters* params);
67 
68  void
69  connect_objects(internal_connectable_map& switches);
70 
71  void
72  configure_geometric_paths(std::vector<int> &redundancies);
73 
74  virtual void
76  switch_id current_sw_addr,
77  switch_id dest_sw_addr,
78  structured_routable::path &current_path,
79  structured_routable::path_set &paths) const;
80 
81  virtual void
83  const coordinates &src_coords,
84  const coordinates &dest_coords,
85  structured_routable::path &current_path,
86  structured_routable::path_set &paths) const;
87 
88  virtual bool
89  xy_connected_to_group(int myX, int myY, int myG,
90  int dstg) const;
91  switch_id
93  node_id nodeaddr, int ports[], int &num_ports) const;
94 
95  switch_id
97  node_id nodeaddr, int ports[], int &num_ports) const;
98 
99  virtual void
101  node_id dest_addr,
102  switch_id sw_addr,
103  structured_routable::path_set &paths) const;
104 
105  // throw unimplemented exception on the following
106  virtual void
108  const coordinates &current_coords,
109  const coordinates &dest_coords,
110  structured_routable::path& path) const;
111 
112  virtual int
113  port(int replica, int dim, int dir);
114 
115  virtual int
116  convert_to_port(int dim, int dir) const;
117 
118 
119  private:
120  int xy_to_int(xy_t xy) const
121  {
122  return xy.second * tiles_x_ + xy.first;
123  }
124 
125  void
127 
128  void
130 
131  void
132  make_intragroup_connections(internal_connectable_map& objects);
133 
134  void
135  make_intergroup_connections(internal_connectable_map &objects);
136 
137  void
138  make_geomid();
139 
140  void
141  check_switch_x(int n) {
142  if (n < 0 || n >= x_)
144  sprockit::value_error,"switch x value %d out of range",n);
145  }
146 
147  void
148  check_switch_y(int n) {
149  if (n < 0 || n >= y_)
151  sprockit::value_error,"switch y value %d out of range",n);
152  }
153 
154  void
155  check_switch_g(int n) {
156  if (n < 0 || n >= g_)
158  sprockit::value_error,"switch group value %d out of range",n);
159  }
160 
161  void
162  check_port_x(int n) {
163  if (n < 0 || n >= tiles_x_)
165  sprockit::value_error,"switch x value %d out of range",n);
166  }
167 
168  void
169  check_port_y(int n) {
170  if (n < 0 || n >= tiles_y_)
172  sprockit::value_error,"switch y value %d out of range",n);
173  }
174 
175  void
176  check_switch_xyg(int x, int y, int g) {
177  check_switch_x(x);
178  check_switch_y(y);
179  check_switch_g(g);
180  }
181 
182  void
183  check_port_xy(int x, int y) {
184  check_port_x(x);
185  check_port_y(y);
186  }
187 
188 };
189 
190 }
191 } //end of namespace sstmac
192 
193 #endif
std::list< connection > intragrp_conns_
switch_id endpoint_to_injection_switch(node_id nodeaddr, int ports[], int &num_ports) const
virtual int port(int replica, int dim, int dir)
std::pair< int, int > xy_t
virtual void minimal_routes_to_coords(const coordinates &src_coords, const coordinates &dest_coords, structured_routable::path &current_path, structured_routable::path_set &paths) const
virtual void minimal_routes_to_switch(switch_id current_sw_addr, switch_id dest_sw_addr, structured_routable::path &current_path, structured_routable::path_set &paths) const
struct sstmac::hw::tiled_dragonfly::connection connection
void configure_geometric_paths(std::vector< int > &redundancies)
configure_geometric_paths For all possible geometric or structure paths, compute their redundances in...
virtual int convert_to_port(int dim, int dir) const
std::map< int, int > port_to_geomid_
virtual void init_factory_params(sprockit::sim_parameters *params)
void make_intragroup_connections(internal_connectable_map &objects)
void check_switch_xyg(int x, int y, int g)
std::vector< std::set< int > > switch_to_connected_groups_
virtual void eject_paths_on_switch(node_id dest_addr, switch_id sw_addr, structured_routable::path_set &paths) const
switch_id endpoint_to_ejection_switch(node_id nodeaddr, int ports[], int &num_ports) const
std::vector< coormap_xy_map_t * > gconn_map_t
void check_port_xy(int x, int y)
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...
void connect_objects(internal_connectable_map &switches)
Given a set of connectables, connect them appropriately.
virtual bool xy_connected_to_group(int myX, int myY, int myG, int dstg) const
std::map< int, xy_list_t * > coormap_xy_map_t
std::list< xy_t > xy_list_t
std::vector< int > injection_ports_
virtual void minimal_route_to_coords(const coordinates &current_coords, const coordinates &dest_coords, structured_routable::path &path) const
Workhorse function for implementing minimal_route_to_switch and #minimal_route_to_node.
#define spkt_throw_printf(exc, template_str,...)
Definition: errors.h:37
std::vector< coor_xy_map_t * > conn_map_t
void make_intergroup_connections(internal_connectable_map &objects)
virtual std::string to_string() const
std::list< connection > intergrp_conns_
xy_list_t::iterator xy_list_iter
std::vector< xy_list_t * > coor_xy_map_t
endpoint_id node_id
Definition: node_address.h:20
int xy_to_int(xy_t xy) const
Error indicating some internal value was unexpected.
Definition: errors.h:83