SST/macro
butterfly.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 
13 //
14 // Author: Jeremiah Wilke <jjwilke@sandia.gov>
15 
16 #ifndef SSTMAC_HARDWARE_NETWORK_TOPOLOGY_butterfly_H_INCLUDED
17 #define SSTMAC_HARDWARE_NETWORK_TOPOLOGY_butterfly_H_INCLUDED
18 
20 
21 namespace sstmac {
22 namespace hw {
23 
24 /**
25  * @brief The abstract_butterfly class
26  * Encapsulates operations common to both butterfly and flattened_butterfly
27  */
29  public structured_topology
30 {
31  public:
32  typedef enum {
35  } dimension_t;
36 
37  public:
38  virtual ~abstract_butterfly() {}
39 
40  virtual void
41  init_factory_params(sprockit::sim_parameters* params);
42 
43  /**
44  * @brief kary
45  * @return The branching degree of the butterfly
46  */
47  int
48  kary() const {
49  return kary_;
50  }
51 
52  /**
53  * @brief nfly
54  * @return The number of stages in the butterfly
55  */
56  int
57  nfly() const {
58  return nfly_;
59  }
60 
61  /**
62  * @brief num_switches_per_col
63  * The butterfly is physically laid out as a 2D-graid of cols and rows
64  * @return The number of switches in a column of the 2D physical layout
65  */
66  int
68  return nswitches_per_col_;
69  }
70 
71  /**
72  * @brief num_switches_per_col
73  * The butterfly is physically laid out as a 2D-graid of cols and rows.
74  * A butterfly is an indirect network. Only the first column of switches
75  * are actually connected to compute nodes.
76  * @return The number of switches in a column of the 2D physical layout
77  */
78  virtual int
80  return nswitches_per_col_;
81  }
82 
83  int
84  diameter() const {
85  return nfly_ + 1;
86  }
87 
88  virtual void
90  int dim,
91  const coordinates& src,
92  const coordinates& dst,
93  structured_routable::path& path) const;
94 
95  void
96  configure_vc_routing(std::map<routing::algorithm_t, int> &m) const;
97 
98  protected:
99  void
100  compute_switch_coords(switch_id uid, coordinates& coords) const;
101 
102  switch_id
103  switch_number(const coordinates &coords) const;
104 
105  protected:
106  int kary_;
107  int nfly_;
109 
110 };
111 
112 /**
113  * @brief The butterfly class
114  * Encapsulates a butterfly topology as described in "High Performance Datacenter Networks"
115  * by Abts and Kim
116  */
117 class butterfly :
118  public abstract_butterfly
119 {
120 
121  public:
122  virtual std::string
123  to_string() const {
124  return "butterfly";
125  }
126 
127  virtual void
128  init_factory_params(sprockit::sim_parameters* params);
129 
130  virtual ~butterfly() {}
131 
132  virtual int
133  num_switches() const {
134  return nswitches_per_col_ * nfly_;
135  }
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  switch_id
149  switch_number(const coordinates &coords) const;
150 
151  virtual void
152  connect_objects(internal_connectable_map& switches);
153 
154  switch_id
156  node_id nodeaddr,
157  int &switch_port) const;
158 
159  virtual int
160  convert_to_port(int dim, int dir) const;
161 
162  /**
163  Each level in a kary-nfly counts
164  as a dimension.
165  */
166  int ndimensions() const {
167  return nfly_;
168  }
169 
170  std::vector<node_id>
172 
173  std::vector<node_id>
175 
176  void
179  const coordinates &current,
180  const coordinates &dst);
181 
182  private:
183  virtual void
184  compute_switch_coords(switch_id uid, coordinates& coords) const;
185 
186  int
188  return last_col_index_start_;
189  }
190 
191  private:
193 
194 };
195 
196 }
197 } //end of namespace sstmac
198 
199 #endif
void compute_switch_coords(switch_id uid, coordinates &coords) const
Compute coordinates (e.g.
virtual int minimal_distance(const coordinates &src_coords, const coordinates &dest_coords) const =0
The function accepts either source or node coordinates.
virtual void connect_objects(internal_connectable_map &objects)=0
Given a set of connectables, connect them appropriately.
virtual int num_switches() const
Definition: butterfly.h:133
virtual std::string to_string() const
Definition: butterfly.h:123
The abstract_butterfly class Encapsulates operations common to both butterfly and flattened_butterfly...
Definition: butterfly.h:28
int kary() const
kary
Definition: butterfly.h:48
virtual std::vector< node_id > nodes_connected_to_injection_switch(switch_id swaddr) const
int num_switches_per_col() const
num_switches_per_col The butterfly is physically laid out as a 2D-graid of cols and rows ...
Definition: butterfly.h:67
virtual switch_id endpoint_to_ejection_switch(node_id nodeaddr, int &switch_port) const
virtual int num_leaf_switches() const
num_switches_per_col The butterfly is physically laid out as a 2D-graid of cols and rows...
Definition: butterfly.h:79
int last_col_index_start() const
Definition: butterfly.h:187
switch_id switch_number(const coordinates &coords) const
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...
The butterfly class Encapsulates a butterfly topology as described in "High Performance Datacenter Ne...
Definition: butterfly.h:117
virtual void init_factory_params(sprockit::sim_parameters *params)
virtual void productive_path(int dim, const coordinates &src, const coordinates &dst, structured_routable::path &path) const
int ndimensions() const
Each level in a kary-nfly counts as a dimension.
Definition: butterfly.h:166
virtual std::vector< node_id > nodes_connected_to_ejection_switch(switch_id swid) const
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.
virtual ~butterfly()
Definition: butterfly.h:130
virtual void productive_paths(structured_routable::path_set &paths, const coordinates &current, const coordinates &dst)
Encapsulates a topology like torus, fat tree, butterfly which has a regular, well-defined structure...
int nfly() const
nfly
Definition: butterfly.h:57
endpoint_id node_id
Definition: node_address.h:20
void configure_vc_routing(std::map< routing::algorithm_t, int > &m) const