Hi,
When i change the number of router, int_link and external_link error occur.
How to define the value of router and the link. Does extra codding needed.
Thank you
from BaseTopology import BaseTopology
class Cluster(BaseTopology):
""" A cluster is a group of nodes which are all one hop from eachother
Clusters can also contain other clusters
When creating this kind of topology, return a single cluster
(usually
the root cluster) from create_system in configs/ruby/<protocol>.py
"""
_num_int_links = 0
_num_ext_links = 0
_num_routers = 00
# Below methods for auto counting
@classmethod
def num_int_links(cls):
cls._num_int_links += 1
return cls._num_int_links - 1
@classmethod
def num_ext_links(cls):
cls._num_ext_links += 1
return cls._num_ext_links - 1
@classmethod
def num_routers(cls):
cls._num_routers += 1
return cls._num_routers - 1
def __init__(self, controllers, intBW=0, extBW=0, intLatency=0,
extLatency=0):
""" internalBandwidth is bandwidth of all links within the cluster
externalBandwidth is bandwidth from this cluster to any cluster
connecting to it.
internal/externalLatency are similar
**** When creating a cluster with sub-clusters, the sub-cluster
external bandwidth overrides the internal bandwidth of the
super cluster
"""
self.nodes = []
self.router = None # created in makeTopology
self.intBW = intBW
self.extBW = extBW
self.intLatency = intLatency
self.extLatency = extLatency
def add(self, node):
self.nodes.append(node)
def makeTopology(self, options, network, IntLink, ExtLink, Router):
""" Recursively make all of the links and routers
"""
router = []
int_links = []
ext_links = []
# make a router to connect all of the nodes
self.router = Router(router_id=self.num_routers())
network.routers.append(self.router)
for node in self.nodes:
if type(node) == Cluster:
node.makeTopology(options, network, IntLink, ExtLink,
Router)
# connect this cluster to the router
link = IntLink(link_id=self.num_int_links(),
node_a=self.router,
node_b=node.router)
if node.extBW:
link.bandwidth_factor = node.extBW
# if there is an interanl b/w for this node
# and no ext b/w to override
elif self.intBW:
link.bandwidth_factor = self.intBW
if node.extLatency:
link.latency = node.extLatency
elif self.intLatency:
link.latency = self.intLatency
network.int_links.append(link)
else:
# node is just a controller,
# connect it to the router via a ext_link
link = ExtLink(link_id=self.num_ext_links(), ext_node=node,
int_node=self.router)
if self.intBW:
link.bandwidth_factor = self.intBW
if self.intLatency:
link.latency = self.intLatency
network.ext_links.append(link)
def __len__(self):
return len([i for i in self.nodes if type(i) != Cluster]) + \
sum([len(i) for i in self.nodes if type(i) == Cluster])
_______________________________________________
gem5-users mailing list
[email protected]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users