changeset 54d6728d99cf in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=54d6728d99cf
description:
ruby: network: correct naming of routers
The routers are created before the network class. This results in the
routers
becoming children of the first link they are connected to and they get
generic
names like int_node and node_b. This patch creates the network object
first
and passes it to the topology creation function. Now the routers are
children
of the network object and names are much more sensible.
diffstat:
configs/ruby/Ruby.py | 15 +++++----------
configs/topologies/BaseTopology.py | 2 +-
configs/topologies/Cluster.py | 19 ++++++-------------
configs/topologies/Crossbar.py | 19 +++++++++++--------
configs/topologies/Mesh.py | 7 +++++--
configs/topologies/MeshDirCorners.py | 10 +++++++---
configs/topologies/Pt2Pt.py | 11 +++++++----
configs/topologies/Torus.py | 7 +++++--
8 files changed, 47 insertions(+), 43 deletions(-)
diffs (261 lines):
diff -r 022a71603c7e -r 54d6728d99cf configs/ruby/Ruby.py
--- a/configs/ruby/Ruby.py Fri Sep 06 16:21:32 2013 -0500
+++ b/configs/ruby/Ruby.py Fri Sep 06 16:21:33 2013 -0500
@@ -145,17 +145,12 @@
class ExtLinkClass(SimpleExtLink): pass
class RouterClass(Switch): pass
- #
- # Important: the topology must be instantiated before the network and after
- # the controllers. Hence the separation between topology definition and
- # instantiation.
- #
- routers, int_links, ext_links = topology.makeTopology(options,
- IntLinkClass, ExtLinkClass, RouterClass)
- network = NetworkClass(ruby_system = ruby, routers = routers,
- int_links = int_links, ext_links = ext_links,
- topology = topology.description)
+ # Create the network topology
+ network = NetworkClass(ruby_system = ruby, topology = topology.description,
+ routers = [], ext_links = [], int_links = [])
+ topology.makeTopology(options, network, IntLinkClass, ExtLinkClass,
+ RouterClass)
if options.network_fault_model:
assert(options.garnet_network == "fixed")
diff -r 022a71603c7e -r 54d6728d99cf configs/topologies/BaseTopology.py
--- a/configs/topologies/BaseTopology.py Fri Sep 06 16:21:32 2013 -0500
+++ b/configs/topologies/BaseTopology.py Fri Sep 06 16:21:33 2013 -0500
@@ -38,7 +38,7 @@
all of the controllers created in the above file.
"""
- def makeTopology(self, options, IntLink, ExtLink, Router):
+ def makeTopology(self, options, network, IntLink, ExtLink, Router):
""" Called from configs/ruby/Ruby.py
The return value is ( list(Router), list(IntLink), list(ExtLink))
The API of this function cannot change when subclassing!!
diff -r 022a71603c7e -r 54d6728d99cf configs/topologies/Cluster.py
--- a/configs/topologies/Cluster.py Fri Sep 06 16:21:32 2013 -0500
+++ b/configs/topologies/Cluster.py Fri Sep 06 16:21:33 2013 -0500
@@ -73,22 +73,17 @@
def add(self, node):
self.nodes.append(node)
- def makeTopology(self, options, IntLink, ExtLink, Router):
+ def makeTopology(self, options, network, IntLink, ExtLink, Router):
""" Recursively make all of the links and routers
"""
- routers = []
- int_links = []
- ext_links = []
# make a router to connect all of the nodes
self.router = Router(router_id=self.num_routers())
- routers.append(self.router)
+ network.routers.append(self.router)
+
for node in self.nodes:
if type(node) == Cluster:
- subRouters, subIntLinks, subExtLinks =
node.makeTopology(options, IntLink, ExtLink, Router)
- routers += subRouters
- int_links += subIntLinks
- ext_links += subExtLinks
+ 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)
@@ -102,7 +97,7 @@
elif self.intLatency:
link.latency = self.intLatency
- int_links.append(link)
+ 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)
@@ -111,9 +106,7 @@
if self.intLatency:
link.latency = self.intLatency
- ext_links.append(link)
-
- return routers, int_links, ext_links
+ network.ext_links.append(link)
def __len__(self):
return len([i for i in self.nodes if type(i) != Cluster]) + \
diff -r 022a71603c7e -r 54d6728d99cf configs/topologies/Crossbar.py
--- a/configs/topologies/Crossbar.py Fri Sep 06 16:21:32 2013 -0500
+++ b/configs/topologies/Crossbar.py Fri Sep 06 16:21:33 2013 -0500
@@ -34,19 +34,22 @@
class Crossbar(SimpleTopology):
description='Crossbar'
- def makeTopology(self, options, IntLink, ExtLink, Router):
- # Create an individual router for each controller plus one more for the
- # centralized crossbar. The large numbers of routers are needed
because
- # external links do not model outgoing bandwidth in the simple
network, but
- # internal links do.
+ def makeTopology(self, options, network, IntLink, ExtLink, Router):
+ # Create an individual router for each controller plus one more for
+ # the centralized crossbar. The large numbers of routers are needed
+ # because external links do not model outgoing bandwidth in the
+ # simple network, but internal links do.
routers = [Router(router_id=i) for i in range(len(self.nodes)+1)]
+ xbar = routers[len(self.nodes)] # the crossbar router is the last
router created
+ network.routers = routers
+
ext_links = [ExtLink(link_id=i, ext_node=n, int_node=routers[i])
for (i, n) in enumerate(self.nodes)]
+ network.ext_links = ext_links
+
link_count = len(self.nodes)
- xbar = routers[len(self.nodes)] # the crossbar router is the last
router created
int_links = [IntLink(link_id=(link_count+i),
node_a=routers[i], node_b=xbar)
for i in range(len(self.nodes))]
-
- return routers, int_links, ext_links
+ network.int_links = int_links
diff -r 022a71603c7e -r 54d6728d99cf configs/topologies/Mesh.py
--- a/configs/topologies/Mesh.py Fri Sep 06 16:21:32 2013 -0500
+++ b/configs/topologies/Mesh.py Fri Sep 06 16:21:33 2013 -0500
@@ -39,7 +39,7 @@
# Makes a generic mesh assuming an equal number of cache and directory
cntrls
- def makeTopology(self, options, IntLink, ExtLink, Router):
+ def makeTopology(self, options, network, IntLink, ExtLink, Router):
nodes = self.nodes
num_routers = options.num_cpus
@@ -54,6 +54,7 @@
# Create the routers in the mesh
routers = [Router(router_id=i) for i in range(num_routers)]
+ network.routers = routers
# link counter to set unique link ids
link_count = 0
@@ -86,6 +87,8 @@
int_node=routers[0]))
link_count += 1
+ network.ext_links = ext_links
+
# Create the mesh links. First row (east-west) links then column
# (north-south) links
int_links = []
@@ -111,4 +114,4 @@
weight=2))
link_count += 1
- return routers, int_links, ext_links
+ network.int_links = int_links
diff -r 022a71603c7e -r 54d6728d99cf configs/topologies/MeshDirCorners.py
--- a/configs/topologies/MeshDirCorners.py Fri Sep 06 16:21:32 2013 -0500
+++ b/configs/topologies/MeshDirCorners.py Fri Sep 06 16:21:33 2013 -0500
@@ -42,7 +42,7 @@
# configurations. The network specified is similar to GEMS old file
# specified network.
- def makeTopology(self, options, IntLink, ExtLink, Router):
+ def makeTopology(self, options, network, IntLink, ExtLink, Router):
nodes = self.nodes
num_routers = options.num_cpus
@@ -74,6 +74,7 @@
# Create the routers in the mesh
routers = [Router(router_id=i) for i in range(num_routers)]
+ network.routers = routers
# link counter to set unique link ids
link_count = 0
@@ -104,7 +105,10 @@
# Connect the dma nodes to router 0. These should only be DMA nodes.
for (i, node) in enumerate(dma_nodes):
assert(node.type == 'DMA_Controller')
- ext_links.append(ExtLink(link_id=link_count, ext_node=node,
int_node=routers[0]))
+ ext_links.append(ExtLink(link_id=link_count, ext_node=node,
+ int_node=routers[0]))
+
+ network.ext_links = ext_links
# Create the mesh links. First row (east-west) links then column
# (north-south) links
@@ -131,4 +135,4 @@
weight=2))
link_count += 1
- return routers, int_links, ext_links
+ network.int_links = int_links
diff -r 022a71603c7e -r 54d6728d99cf configs/topologies/Pt2Pt.py
--- a/configs/topologies/Pt2Pt.py Fri Sep 06 16:21:32 2013 -0500
+++ b/configs/topologies/Pt2Pt.py Fri Sep 06 16:21:33 2013 -0500
@@ -39,15 +39,18 @@
def __init__(self, controllers):
self.nodes = controllers
- def makeTopology(self, options, IntLink, ExtLink, Router):
+ def makeTopology(self, options, network, IntLink, ExtLink, Router):
nodes = self.nodes
+
# Create an individual router for each controller, and connect all to
all.
+ routers = [Router(router_id=i) for i in range(len(nodes))]
+ network.routers = routers
- routers = [Router(router_id=i) for i in range(len(nodes))]
ext_links = [ExtLink(link_id=i, ext_node=n, int_node=routers[i])
for (i, n) in enumerate(nodes)]
+ network.ext_links = ext_links
+
link_count = len(nodes)
-
int_links = []
for i in xrange(len(nodes)):
for j in xrange(len(nodes)):
@@ -57,4 +60,4 @@
node_a=routers[i],
node_b=routers[j]))
- return routers, int_links, ext_links
+ network.int_links = int_links
diff -r 022a71603c7e -r 54d6728d99cf configs/topologies/Torus.py
--- a/configs/topologies/Torus.py Fri Sep 06 16:21:32 2013 -0500
+++ b/configs/topologies/Torus.py Fri Sep 06 16:21:33 2013 -0500
@@ -44,7 +44,7 @@
# All links (including the wrap-around ones) are of equal length, double
that
# of a mesh. Thus, each link is assigned a latency of 2 cycles.
- def makeTopology(self, options, IntLink, ExtLink, Router):
+ def makeTopology(self, options, network, IntLink, ExtLink, Router):
nodes = self.nodes
num_routers = options.num_cpus
@@ -59,6 +59,7 @@
# Create the routers in the torus
routers = [Router(router_id=i) for i in range(num_routers)]
+ network.routers = routers
# link counter to set unique link ids
link_count = 0
@@ -91,6 +92,8 @@
int_node=routers[0]))
link_count += 1
+ network.ext_links = ext_links
+
# Create the torus links. First row (east-west) links then column
# (north-south) links
# column links are given higher weights to implement XY routing
@@ -123,4 +126,4 @@
weight=2))
link_count += 1
- return routers, int_links, ext_links
+ network.int_links = int_links
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev