SST/macro
hdtorus.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 // hdtorus.h: Interface for torus networks.
13 //
14 // Author: Jeremiah Wilke <jjwilke@sandia.gov>
15 
16 #ifndef SSTMAC_HARDWARE_NETWORK_TOPOLOGY_HDTORUS_H_INCLUDED
17 #define SSTMAC_HARDWARE_NETWORK_TOPOLOGY_HDTORUS_H_INCLUDED
18 
20 
21 namespace sstmac {
22 namespace hw {
23 
24 /**
25  * @class hdtorus
26  * Implements a high dimensional torus network.
27  */
28 
29 class hdtorus :
30  public cartesian_topology
31 {
32 
33  public:
34  typedef enum {
35  pos = 0,
36  neg = 1
37  } direction_t;
38 
39  virtual std::string
40  to_string() const {
41  return "hdtorus";
42  }
43 
44  virtual ~hdtorus() {}
45 
46  void
47  init_factory_params(sprockit::sim_parameters* params);
48 
49  virtual void
51  int dim,
52  const coordinates& src,
53  const coordinates& dst,
54  structured_routable::path& path) const;
55 
56  switch_id
57  switch_number(const coordinates& v) const;
58 
59  int
60  diameter() const {
61  return diameter_;
62  }
63 
64  /// Returns the vector giving each dimension of the torus.
65  const std::vector<int> &
66  dimensions() const {
67  return dimensions_;
68  }
69 
71  neighbor_at_port(switch_id sid, int port) const;
72 
73  virtual int
74  num_switches() const {
75  return num_switches_;
76  }
77 
78  virtual int
80  return num_switches();
81  }
82 
83  void
84  configure_geometric_paths(std::vector<int> &redundancies);
85 
86  virtual int
87  ndimensions() const {
88  return dimensions_.size();
89  }
90 
91  void
93  const coordinates &src_coords,
94  const coordinates &dest_coords,
95  structured_routable::path& path) const;
96 
97  virtual void
98  connect_objects(internal_connectable_map& switches);
99 
100  virtual int
101  convert_to_port(int dim, int dir) const;
102 
103  int
105  const coordinates& src_coords,
106  const coordinates& dest_coords) const;
107 
108  void
109  partners(
111  const coordinates &src_sw_coords,
112  std::list<node_id>& partners) const;
113 
114  void
115  configure_vc_routing(std::map<routing::algorithm_t, int> &m) const;
116 
117  private:
118  virtual void
119  compute_switch_coords(switch_id uid, coordinates& coords) const;
120 
121  void
123  const coordinates& src_sw_coords,
124  int port,
125  std::vector<node_id>& partners) const;
126 
127  void
129  const coordinates &src_sw_coords,
130  int port,
131  std::vector<node_id>& partners) const;
132 
133  void
135  const coordinates &src_sw_coords,
136  int port,
137  std::vector<node_id>& partners) const;
138 
139  void
141  const coordinates &src_sw_coords,
142  int port,
143  std::vector<node_id>& partners) const;
144 
145  void
146  pick_vc(structured_routable::path& path) const;
147 
148  void
149  down_path(
150  int dim,
151  const coordinates& src,
152  const coordinates& dst,
153  structured_routable::path& path) const;
154 
155  void
156  up_path(
157  int dim,
158  const coordinates& src,
159  const coordinates& dst,
160  structured_routable::path& path) const;
161 
162  int
163  shortest_distance(int dim, int src, int dst) const;
164 
165  int
166  distance(int dim, int dir, int src, int dst) const;
167 
168  bool
170  int dim,
171  const coordinates& src,
172  const coordinates& dst) const;
173 
174  private:
175  virtual void
176  connect_dim(int dim,
177  connectable* center,
178  connectable* plus,
179  connectable* minus);
180 
181  protected: //must be visible to hypercube
184  std::vector<int> dimensions_;
185 
186 };
187 
188 }
189 } //end of namespace sstmac
190 
191 #endif
const std::vector< int > & dimensions() const
Returns the vector giving each dimension of the torus.
Definition: hdtorus.h:66
int diameter() const
Definition: hdtorus.h:60
bool shortest_path_positive(int dim, const coordinates &src, const coordinates &dst) const
virtual int convert_to_port(int dim, int dir) const
void up_path(int dim, const coordinates &src, const coordinates &dst, structured_routable::path &path) const
void bit_complement_partners(const coordinates &src_sw_coords, int port, std::vector< node_id > &partners) const
void pick_vc(structured_routable::path &path) const
coordinates neighbor_at_port(switch_id sid, int port) const
virtual void compute_switch_coords(switch_id uid, coordinates &coords) const
Compute coordinates (e.g.
int minimal_distance(const coordinates &src_coords, const coordinates &dest_coords) const
The function accepts either source or node coordinates.
void down_path(int dim, const coordinates &src, const coordinates &dst, structured_routable::path &path) const
virtual std::string to_string() const
Definition: hdtorus.h:40
virtual int num_switches() const
Definition: hdtorus.h:74
void tornado_recv_partners(const coordinates &src_sw_coords, int port, std::vector< node_id > &partners) 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.
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
virtual int num_leaf_switches() const
Structured topologies can be direct (torus) or indirect (fat tree).
Definition: hdtorus.h:79
SUMI = Simulator unified messagine interface It is also the name for a solid ink in Japanese - i...
int distance(int dim, int dir, int src, int dst) const
void partners(traffic_pattern::type_t ty, const coordinates &src_sw_coords, std::list< node_id > &partners) const
virtual void connect_dim(int dim, connectable *center, connectable *plus, connectable *minus)
std::vector< int > dimensions_
Definition: hdtorus.h:184
void init_factory_params(sprockit::sim_parameters *params)
switch_id switch_number(const coordinates &v) const
virtual void productive_path(int dim, const coordinates &src, const coordinates &dst, structured_routable::path &path) const
virtual void connect_objects(internal_connectable_map &switches)
Given a set of connectables, connect them appropriately.
void configure_geometric_paths(std::vector< int > &redundancies)
configure_geometric_paths For all possible geometric or structure paths, compute their redundances in...
int shortest_distance(int dim, int src, int dst) const
virtual int ndimensions() const
The number of distinct &#39;dimensions&#39; in the topology.
Definition: hdtorus.h:87
void nearest_neighbor_partners(const coordinates &src_sw_coords, int port, std::vector< node_id > &partners) const
Implements a high dimensional torus network.
Definition: hdtorus.h:29
void tornado_send_partners(const coordinates &src_sw_coords, int port, std::vector< node_id > &partners) const
virtual ~hdtorus()
Definition: hdtorus.h:44
void configure_vc_routing(std::map< routing::algorithm_t, int > &m) const