SST/macro
simple_switch.h
Go to the documentation of this file.
1 #ifndef SIMPLE_SWITCH_H
2 #define SIMPLE_SWITCH_H
3 
9 #include <sprockit/unordered.h>
10 
11 namespace sstmac {
12 namespace hw {
13 
15  public network_switch
16 {
17 
18  public:
19  virtual void
20  initialize();
21 
22  int
23  queue_length(int port) const {
24  return 0;
25  }
26 
27  void
28  set_topology(topology* top);
29 
30  virtual void
31  connect_output(int src_outport,
32  int dst_inport,
33  connectable *mod,
34  config *cfg);
35 
36  virtual void
37  connect_input(int src_outport,
38  int dst_inport,
39  connectable *mod,
40  config *cfg);
41 
42  std::vector<switch_id>
43  connected_switches() const;
44 
45  /**
46  Cast message and pass to #send
47  @param msg Incoming message (should cast to packet_train)
48  */
49  virtual void
50  handle(event* ev);
51 
52 #if !SSTMAC_INTEGRATED_SST_CORE
53  virtual void
55 #endif
56 
57  virtual std::string
58  to_string() const {
59  return "simple switch";
60  }
61 
62  virtual
64 
65  timestamp
66  hop_latency() const {
67  return hop_latency_;
68  }
69 
70  double
71  inverse_bw() const {
72  return inverse_bw_;
73  }
74 
75  timestamp
76  lookahead() const;
77 
78  double
79  hop_bandwidth() const {
80  return 1.0/inverse_bw_;
81  }
82 
83  virtual void
84  init_factory_params(sprockit::sim_parameters* params);
85 
86  virtual void
87  finalize_init();
88 
89  protected:
90  virtual void
91  connect_injector(int src_outport, int dst_inport, event_handler* nic);
92 
93  virtual void
94  connect_ejector(int src_outport, int dst_inport, event_handler* nic);
95 
96  void
98 
99  protected:
102 
104 
106 
107  double inverse_bw_;
108 
109  double inv_min_bw_;
110 
112 
113  spkt_unordered_map<node_id, network_switch*> neighbors_;
114 
115  spkt_unordered_map<node_id, nic*> nics_;
116 
117 
118  private:
119  void send_to_nic(timestamp delay, node_id dst, message* msg);
120  void send_to_switch(timestamp delay, node_id dst, message* msg);
121 
122 };
123 
124 }
125 }
126 
127 #endif // SIMPLE_SWITCH_H
virtual void finalize_init()
A class describing an event.
Definition: sst_message.h:42
double hop_bandwidth() const
Definition: simple_switch.h:79
spkt_unordered_map< node_id, nic * > nics_
virtual void init_factory_params(sprockit::sim_parameters *params)
int queue_length(int port) const
Definition: simple_switch.h:23
virtual void connect_input(int src_outport, int dst_inport, connectable *mod, config *cfg)
Base type for implementations of an engine that is able to schedule events and advance simulation tim...
Definition: event_manager.h:47
virtual std::string to_string() const
Definition: simple_switch.h:58
virtual void connect_ejector(int src_outport, int dst_inport, event_handler *nic)
virtual void connect_output(int src_outport, int dst_inport, connectable *mod, config *cfg)
virtual void initialize()
virtual void handle(event *ev)
Cast message and pass to #send.
void send_to_switch(timestamp delay, node_id dst, message *msg)
The main interface for something that can respond to an event (sst_message).
Definition: event_handler.h:24
void send_to_nic(timestamp delay, node_id dst, message *msg)
std::vector< switch_id > connected_switches() const
A basic container for time (subject to future transplant).
Definition: timestamp.h:29
SUMI = Simulator unified messagine interface It is also the name for a solid ink in Japanese - i...
A networkinterface is a delegate between a node and a server module.
Definition: nic.h:45
timestamp lookahead() const
timestamp hop_latency() const
Definition: simple_switch.h:66
double inverse_bw() const
Definition: simple_switch.h:71
void set_topology(topology *top)
void add_switch(connectable *sw)
spkt_unordered_map< node_id, network_switch * > neighbors_
endpoint_id node_id
Definition: node_address.h:20
virtual void set_event_manager(event_manager *m)
virtual void connect_injector(int src_outport, int dst_inport, event_handler *nic)