12 #ifndef SSTMAC_HARDWARE_NETWORK_SWITCHES_SWITCHTOPOLOGY_H_INCLUDED 13 #define SSTMAC_HARDWARE_NETWORK_SWITCHES_SWITCHTOPOLOGY_H_INCLUDED 31 #define top_debug(...) \ 32 debug_printf(sprockit::dbg::topology, __VA_ARGS__) 37 template <
class InputMap,
class OutputMap>
39 copy_map(InputMap& input, OutputMap& output){
40 typedef typename InputMap::mapped_type input_cls_type;
41 typedef typename OutputMap::mapped_type output_cls_type;
43 typename InputMap::iterator it, end = input.end();
44 for (it = input.begin(); it != end; ++it) {
45 output[it->first] =
dynamic_cast<output_cls_type
>(it->second);
53 static const int eject;
56 typedef spkt_unordered_map<switch_id, connectable*> internal_connectable_map;
57 typedef spkt_unordered_map<node_id, connectable*> end_point_connectable_map;
63 to_string()
const = 0;
66 init_factory_params(sprockit::sim_parameters* params);
76 endpoints_per_switch(
switch_id addr)
const = 0;
80 return num_nodes_per_netlink_ * endpoints_per_switch(addr);
90 num_switches()
const = 0;
93 num_endpoints()
const = 0;
99 num_nodes()
const = 0;
109 connect_objects(internal_connectable_map& objects) = 0;
112 connect_end_point_objects(internal_connectable_map&
internal,
113 end_point_connectable_map& end_points);
124 endpoint_to_injection_switch(
node_id nodeaddr,
int& switch_port)
const = 0;
135 endpoint_to_ejection_switch(
node_id nodeaddr,
int& switch_port)
const = 0;
138 configure_vc_routing(std::map<routing::algorithm_t, int>& m)
const = 0;
149 endpoint_to_injection_port(
node_id nodeaddr)
const = 0;
160 endpoint_to_ejection_port(
node_id nodeaddr)
const = 0;
169 virtual std::vector<node_id>
170 nodes_connected_to_injection_switch(
switch_id swid)
const = 0;
172 virtual std::vector<node_id>
173 nodes_connected_to_ejection_switch(
switch_id swid)
const = 0;
177 int* switches_per_lp,
179 int *switch_to_thread,
180 int& local_num_switches,
197 convert_to_port(
int dim,
int dir)
const = 0;
212 minimal_route_to_switch(
215 structured_routable::path& path)
const = 0;
229 std::vector<node_id>& partners)
const = 0;
248 std::vector<node_id>& partners)
const = 0;
270 virtual std::vector <std::pair <switch_id, int> >
271 cheapest_path(
const node_id src,
const node_id dst,
void * stats)
const {
275 virtual std::vector <std::pair <switch_id, int> >
276 cheapest_path(
const std::pair <node_id, node_id> & sd,
void * stats)
const {
277 return cheapest_path(sd.first, sd.second, stats);
286 template <
class MapTypeInternal,
class MapTypeEndPo
int>
288 connect_end_points(MapTypeInternal& internal_nodes, MapTypeEndPoint& end_points) {
289 internal_connectable_map internal_clone_map;
290 end_point_connectable_map end_clone_map;
291 copy_map(internal_nodes, internal_clone_map);
292 copy_map(end_points, end_clone_map);
293 connect_end_point_objects(internal_clone_map, end_clone_map);
302 template <
class MapType>
304 connect_topology(MapType& objects) {
305 typedef typename MapType::mapped_type cls_type;
306 typedef typename MapType::value_type val_type;
307 internal_connectable_map clone_map;
308 copy_map(objects, clone_map);
309 connect_objects(clone_map);
324 random_intermediate_switch(
switch_id current_sw,
335 endpoint_to_injection_switch(
node_id nodeaddr)
const {
337 return endpoint_to_injection_switch(nodeaddr, ignore);
341 endpoint_to_injection_switch(
342 node_id nodeaddr,
int ports[],
int& num_ports)
const {
344 return endpoint_to_injection_switch(nodeaddr, ports[0]);
348 node_to_ejection_switch(
node_id addr)
const {
349 node_id netid(addr / num_nodes_per_netlink_);
350 return endpoint_to_ejection_switch(netid);
361 endpoint_to_ejection_switch(
node_id nodeaddr)
const {
363 return endpoint_to_ejection_switch(nodeaddr, ignore);
367 endpoint_to_ejection_switch(
368 node_id nodeaddr,
int ports[],
int& num_ports)
const {
370 return endpoint_to_ejection_switch(nodeaddr, ports[0]);
374 max_num_ports()
const {
375 return max_ports_injection_ + max_ports_intra_network_;
379 max_ports_injection()
const {
380 return max_ports_injection_;
384 max_ports_intra_network()
const {
385 return max_ports_intra_network_;
389 is_injection_port(
int port)
const {
390 return port >= max_ports_intra_network_;
399 eject_port(
int ith)
const {
400 return max_ports_intra_network() + ith;
413 label(event_loc_id
id)
const;
416 endpoint_label(
node_id nid)
const;
434 minimal_route_to_node(
437 structured_routable::path& path)
const;
445 new_routing_stage(structured_routable* rtbl) { }
448 num_nodes_per_netlink()
const {
449 return num_nodes_per_netlink_;
453 netlink_endpoints()
const {
454 return netlink_endpoints_;
458 build_internal_connectables(
459 internal_connectable_map& connectables,
463 sprockit::sim_parameters *params,
464 connectable* dummy) = 0;
467 build_endpoint_connectables(
468 end_point_connectable_map& connectables,
472 sprockit::sim_parameters *params) = 0;
475 build_interface_connectables(
477 end_point_connectable_map& connectables,
481 sprockit::sim_parameters* params,
485 static_topology(sprockit::sim_parameters* params);
488 set_interconnect(interconnect * ic){
493 get_interconnect()
const {
494 return interconnect_;
500 uint32_t random_number(uint32_t max, uint32_t attempt)
const;
509 int endpoints_per_switch_;
511 bool netlink_endpoints_;
523 int num_nodes_per_netlink_;
525 int max_ports_intra_network_;
527 int max_ports_injection_;
531 interconnect * interconnect_;
DeclareDebugSlot(topology) namespace sstmac
The multiple-with-carry random number generator by George Marsaglia (1999; internet posting)...
SUMI = Simulator unified messagine interface It is also the name for a solid ink in Japanese - i...