Cluster.py (10088:eca928d8a4ab) Cluster.py (11663:cf870cd20cfc)
1# Copyright (c) 2012 Advanced Micro Devices, Inc.
2# All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions are
6# met: redistributions of source code must retain the above copyright
7# notice, this list of conditions and the following disclaimer;
8# redistributions in binary form must reproduce the above copyright

--- 72 unchanged lines hidden (view full) ---

81 self.router = Router(router_id=self.num_routers())
82 network.routers.append(self.router)
83
84 for node in self.nodes:
85 if type(node) == Cluster:
86 node.makeTopology(options, network, IntLink, ExtLink, Router)
87
88 # connect this cluster to the router
1# Copyright (c) 2012 Advanced Micro Devices, Inc.
2# All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions are
6# met: redistributions of source code must retain the above copyright
7# notice, this list of conditions and the following disclaimer;
8# redistributions in binary form must reproduce the above copyright

--- 72 unchanged lines hidden (view full) ---

81 self.router = Router(router_id=self.num_routers())
82 network.routers.append(self.router)
83
84 for node in self.nodes:
85 if type(node) == Cluster:
86 node.makeTopology(options, network, IntLink, ExtLink, Router)
87
88 # connect this cluster to the router
89 link = IntLink(link_id=self.num_int_links(), node_a=self.router,
90 node_b=node.router)
89 link_out = IntLink(link_id=self.num_int_links(), src_node=self.router,
90 dst_node_=node.router)
91 link_in = IntLink(link_id=self.num_int_links(), src_node=node.router,
92 dst_node_=self.router)
91
92 if node.extBW:
93
94 if node.extBW:
93 link.bandwidth_factor = node.extBW
95 link_out.bandwidth_factor = node.extBW
96 link_in.bandwidth_factor = node.extBW
94
97
95 # if there is an interanl b/w for this node
98 # if there is an internal b/w for this node
96 # and no ext b/w to override
97 elif self.intBW:
99 # and no ext b/w to override
100 elif self.intBW:
98 link.bandwidth_factor = self.intBW
101 link_out.bandwidth_factor = self.intBW
102 link_in.bandwidth_factor = self.intBW
99
100 if node.extLatency:
103
104 if node.extLatency:
101 link.latency = node.extLatency
105 link_out.latency = node.extLatency
106 link_in.latency = node.extLatency
102 elif self.intLatency:
107 elif self.intLatency:
103 link.latency = self.intLatency
108 link_out.latency = self.intLatency
109 link_in.latency = self.intLatency
104
110
105 network.int_links.append(link)
111 network.int_links.append(link_out)
112 network.int_links.append(link_in)
106 else:
107 # node is just a controller,
108 # connect it to the router via a ext_link
109 link = ExtLink(link_id=self.num_ext_links(), ext_node=node,
110 int_node=self.router)
111
112 if self.intBW:
113 link.bandwidth_factor = self.intBW
114 if self.intLatency:
115 link.latency = self.intLatency
116
117 network.ext_links.append(link)
118
119 def __len__(self):
120 return len([i for i in self.nodes if type(i) != Cluster]) + \
121 sum([len(i) for i in self.nodes if type(i) == Cluster])
113 else:
114 # node is just a controller,
115 # connect it to the router via a ext_link
116 link = ExtLink(link_id=self.num_ext_links(), ext_node=node,
117 int_node=self.router)
118
119 if self.intBW:
120 link.bandwidth_factor = self.intBW
121 if self.intLatency:
122 link.latency = self.intLatency
123
124 network.ext_links.append(link)
125
126 def __len__(self):
127 return len([i for i in self.nodes if type(i) != Cluster]) + \
128 sum([len(i) for i in self.nodes if type(i) == Cluster])