SST/macro
switch_interconnect.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_SWITCHES_SWITCHINTERCONNECT_H_INCLUDED
13 #define SSTMAC_HARDWARE_NETWORK_SWITCHES_SWITCHINTERCONNECT_H_INCLUDED
14 
19 #include <sprockit/unordered.h>
20 
21 namespace sstmac {
22 namespace hw {
23 
25  public interconnect_base
26 {
27  protected:
29  interconnect_base(part, rt)
30  {
31  }
32 
33  inline timestamp send_delay(int num_hops, int num_bytes) const {
34  double bw_term = num_bytes / hop_bw_;
35  timestamp delay = hop_latency_ * num_hops + timestamp(bw_term) + 2*injection_latency_;
36  return delay;
37  }
38 
39  protected:
40  double hop_bw_;
41 
43 
45 
47 
48 };
49 
50 #if SSTMAC_INTEGRATED_SST_CORE
51 class sst_switch_interconnect :
53 {
54  public:
55  sst_switch_interconnect(partition* part, parallel_runtime* rt) :
56  switch_interconnect_base(part, rt){}
57 
58  virtual void
59  init_factory_params(sprockit::sim_parameters* params);
60 
62  event_location() const {
63  return event_loc_id::null;
64  }
65 };
66 #else
69 {
70  public:
71  typedef spkt_unordered_map<switch_id, network_switch*> switch_map;
72 
73  public:
75  switch_interconnect_base(part, rt)
76  {
77  }
78 
79  virtual void
80  init_factory_params(sprockit::sim_parameters* params);
81 
82  virtual std::string
83  to_string() const {
84  return "switchinterconnect";
85  }
86 
87  virtual ~macro_switch_interconnect();
88 
89  static network_switch*
90  template_switch(sprockit::sim_parameters* params,
91  topology* topol,
92  switch_id sid = switch_id());
93 
94  virtual void
95  set_event_manager(event_manager* m);
96 
98  switch_at(switch_id id) const
99  {
100  switch_map::const_iterator it = switches_.find(id);
101  if (it == switches_.end()){
102  return 0;
103  }
104  return it->second;
105  }
106 
107  const switch_map&
108  switches() const {
109  return switches_;
110  }
111 
112  virtual void
113  immediate_send(event_scheduler* src, message* msg, timestamp start) const;
114 
115  void
116  write_graph_file(const std::string& graph_file);
117 
118  int
119  thread_for_switch(switch_id sid) const;
120 
121  timestamp
122  hop_latency() const {
123  return hop_latency_;
124  }
125 
126  timestamp
127  lookahead() const {
128  return lookahead_;
129  }
130 
132  event_location() const {
133  return event_loc_id::null;
134  }
135 
136  void deadlock_check();
137 
138  protected:
139  void
140  set_switch_event_manager(
141  int thread_id, switch_id sid,
142  event_manager* m);
143 
144  protected:
145  switch_map switches_;
146 
147 };
148 
149 #endif
150 
151 }
152 }
153 
154 #endif
155 
virtual std::string to_string() const
A class describing an event.
Definition: sst_message.h:42
int thread_id
Definition: thread_id.h:21
network_switch * switch_at(switch_id id) const
Base type for implementations of an engine that is able to schedule events and advance simulation tim...
Definition: event_manager.h:47
static event_loc_id null
spkt_unordered_map< switch_id, network_switch * > switch_map
A basic container for time (subject to future transplant).
Definition: timestamp.h:29
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...
const switch_map & switches() const
switch_interconnect_base(partition *part, parallel_runtime *rt)
The interface for something that can schedule messages.
timestamp send_delay(int num_hops, int num_bytes) const
Class for storing all the partitions given to us by METIS.
Definition: sim_partition.h:35
macro_switch_interconnect(partition *part, parallel_runtime *rt)