config: add a separate config file for the network.
This patch adds a new file configs/network/Network.py to setup the network, instead of doing that within Ruby.py.
This commit is contained in:
parent
0f68b50ff1
commit
b9e23a6d74
10 changed files with 131 additions and 52 deletions
|
@ -43,11 +43,13 @@ from m5.objects import *
|
||||||
from m5.util import addToPath
|
from m5.util import addToPath
|
||||||
|
|
||||||
addToPath('../ruby')
|
addToPath('../ruby')
|
||||||
|
addToPath('../network')
|
||||||
addToPath('../common')
|
addToPath('../common')
|
||||||
addToPath('../topologies')
|
addToPath('../topologies')
|
||||||
|
|
||||||
import Options
|
import Options
|
||||||
import Ruby
|
import Ruby
|
||||||
|
import Network
|
||||||
import Simulation
|
import Simulation
|
||||||
import GPUTLBOptions, GPUTLBConfig
|
import GPUTLBOptions, GPUTLBConfig
|
||||||
|
|
||||||
|
@ -157,6 +159,7 @@ parser.add_option('--fast-forward-pseudo-op', action='store_true',
|
||||||
|
|
||||||
|
|
||||||
Ruby.define_options(parser)
|
Ruby.define_options(parser)
|
||||||
|
Network.define_options(parser)
|
||||||
|
|
||||||
#add TLB options to the parser
|
#add TLB options to the parser
|
||||||
GPUTLBOptions.tlb_options(parser)
|
GPUTLBOptions.tlb_options(parser)
|
||||||
|
|
|
@ -51,8 +51,10 @@ from m5.util import addToPath, fatal
|
||||||
|
|
||||||
addToPath('../common')
|
addToPath('../common')
|
||||||
addToPath('../ruby')
|
addToPath('../ruby')
|
||||||
|
addToPath('../network')
|
||||||
|
|
||||||
import Ruby
|
import Ruby
|
||||||
|
import Network
|
||||||
|
|
||||||
from FSConfig import *
|
from FSConfig import *
|
||||||
from SysPaths import *
|
from SysPaths import *
|
||||||
|
@ -306,6 +308,7 @@ Options.addFSOptions(parser)
|
||||||
# Add the ruby specific and protocol specific options
|
# Add the ruby specific and protocol specific options
|
||||||
if '--ruby' in sys.argv:
|
if '--ruby' in sys.argv:
|
||||||
Ruby.define_options(parser)
|
Ruby.define_options(parser)
|
||||||
|
Network.define_options(parser)
|
||||||
|
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
|
|
|
@ -33,10 +33,12 @@ from m5.util import addToPath
|
||||||
import os, optparse, sys
|
import os, optparse, sys
|
||||||
addToPath('../common')
|
addToPath('../common')
|
||||||
addToPath('../ruby')
|
addToPath('../ruby')
|
||||||
|
addToPath('../network')
|
||||||
addToPath('../topologies')
|
addToPath('../topologies')
|
||||||
|
|
||||||
import Options
|
import Options
|
||||||
import Ruby
|
import Ruby
|
||||||
|
import Network
|
||||||
|
|
||||||
# Get paths we might need. It's expected this file is in m5/configs/example.
|
# Get paths we might need. It's expected this file is in m5/configs/example.
|
||||||
config_path = os.path.dirname(os.path.abspath(__file__))
|
config_path = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
@ -85,6 +87,7 @@ parser.add_option("--inj-vnet", type="int", default=-1,
|
||||||
# Add the ruby specific and protocol specific options
|
# Add the ruby specific and protocol specific options
|
||||||
#
|
#
|
||||||
Ruby.define_options(parser)
|
Ruby.define_options(parser)
|
||||||
|
Network.define_options(parser)
|
||||||
|
|
||||||
execfile(os.path.join(config_root, "common", "Options.py"))
|
execfile(os.path.join(config_root, "common", "Options.py"))
|
||||||
|
|
||||||
|
|
|
@ -35,10 +35,12 @@ from m5.util import addToPath
|
||||||
import os, optparse, sys
|
import os, optparse, sys
|
||||||
addToPath('../common')
|
addToPath('../common')
|
||||||
addToPath('../ruby')
|
addToPath('../ruby')
|
||||||
|
addToPath('../network')
|
||||||
addToPath('../topologies')
|
addToPath('../topologies')
|
||||||
|
|
||||||
import Options
|
import Options
|
||||||
import Ruby
|
import Ruby
|
||||||
|
import Network
|
||||||
|
|
||||||
# Get paths we might need. It's expected this file is in m5/configs/example.
|
# Get paths we might need. It's expected this file is in m5/configs/example.
|
||||||
config_path = os.path.dirname(os.path.abspath(__file__))
|
config_path = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
@ -63,6 +65,7 @@ parser.add_option("--percent-writes", type="int", default=100,
|
||||||
# Add the ruby specific and protocol specific options
|
# Add the ruby specific and protocol specific options
|
||||||
#
|
#
|
||||||
Ruby.define_options(parser)
|
Ruby.define_options(parser)
|
||||||
|
Network.define_options(parser)
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
if args:
|
if args:
|
||||||
|
|
|
@ -40,10 +40,12 @@ from m5.util import addToPath
|
||||||
import os, optparse, sys
|
import os, optparse, sys
|
||||||
addToPath('../common')
|
addToPath('../common')
|
||||||
addToPath('../ruby')
|
addToPath('../ruby')
|
||||||
|
addToPath('../network')
|
||||||
addToPath('../topologies')
|
addToPath('../topologies')
|
||||||
|
|
||||||
import Options
|
import Options
|
||||||
import Ruby
|
import Ruby
|
||||||
|
import Network
|
||||||
|
|
||||||
# Get paths we might need.
|
# Get paths we might need.
|
||||||
config_path = os.path.dirname(os.path.abspath(__file__))
|
config_path = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
@ -76,6 +78,7 @@ parser.add_option("--wfs-per-simd", type="int", default=10, help="Number of " \
|
||||||
# Add the ruby specific and protocol specific options
|
# Add the ruby specific and protocol specific options
|
||||||
#
|
#
|
||||||
Ruby.define_options(parser)
|
Ruby.define_options(parser)
|
||||||
|
Network.define_options(parser)
|
||||||
|
|
||||||
execfile(os.path.join(config_root, "common", "Options.py"))
|
execfile(os.path.join(config_root, "common", "Options.py"))
|
||||||
|
|
||||||
|
|
|
@ -35,10 +35,12 @@ from m5.util import addToPath
|
||||||
import os, optparse, sys
|
import os, optparse, sys
|
||||||
addToPath('../common')
|
addToPath('../common')
|
||||||
addToPath('../ruby')
|
addToPath('../ruby')
|
||||||
|
addToPath('../network')
|
||||||
addToPath('../topologies')
|
addToPath('../topologies')
|
||||||
|
|
||||||
import Options
|
import Options
|
||||||
import Ruby
|
import Ruby
|
||||||
|
import Network
|
||||||
|
|
||||||
# Get paths we might need. It's expected this file is in m5/configs/example.
|
# Get paths we might need. It's expected this file is in m5/configs/example.
|
||||||
config_path = os.path.dirname(os.path.abspath(__file__))
|
config_path = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
@ -63,6 +65,7 @@ parser.add_option("--suppress-func-warnings", action="store_true",
|
||||||
# Add the ruby specific and protocol specific options
|
# Add the ruby specific and protocol specific options
|
||||||
#
|
#
|
||||||
Ruby.define_options(parser)
|
Ruby.define_options(parser)
|
||||||
|
Network.define_options(parser)
|
||||||
|
|
||||||
execfile(os.path.join(config_root, "common", "Options.py"))
|
execfile(os.path.join(config_root, "common", "Options.py"))
|
||||||
|
|
||||||
|
|
|
@ -35,10 +35,12 @@ from m5.util import addToPath
|
||||||
import os, optparse, sys
|
import os, optparse, sys
|
||||||
addToPath('../common')
|
addToPath('../common')
|
||||||
addToPath('../ruby')
|
addToPath('../ruby')
|
||||||
|
addToPath('../network')
|
||||||
addToPath('../topologies')
|
addToPath('../topologies')
|
||||||
|
|
||||||
import Options
|
import Options
|
||||||
import Ruby
|
import Ruby
|
||||||
|
import Network
|
||||||
|
|
||||||
# Get paths we might need. It's expected this file is in m5/configs/example.
|
# Get paths we might need. It's expected this file is in m5/configs/example.
|
||||||
config_path = os.path.dirname(os.path.abspath(__file__))
|
config_path = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
@ -57,6 +59,7 @@ parser.add_option("-f", "--wakeup_freq", metavar="N", default=10,
|
||||||
# Add the ruby specific and protocol specific options
|
# Add the ruby specific and protocol specific options
|
||||||
#
|
#
|
||||||
Ruby.define_options(parser)
|
Ruby.define_options(parser)
|
||||||
|
Network.define_options(parser)
|
||||||
|
|
||||||
execfile(os.path.join(config_root, "common", "Options.py"))
|
execfile(os.path.join(config_root, "common", "Options.py"))
|
||||||
|
|
||||||
|
|
|
@ -53,9 +53,11 @@ from m5.util import addToPath, fatal
|
||||||
|
|
||||||
addToPath('../common')
|
addToPath('../common')
|
||||||
addToPath('../ruby')
|
addToPath('../ruby')
|
||||||
|
addToPath('../network')
|
||||||
|
|
||||||
import Options
|
import Options
|
||||||
import Ruby
|
import Ruby
|
||||||
|
import Network
|
||||||
import Simulation
|
import Simulation
|
||||||
import CacheConfig
|
import CacheConfig
|
||||||
import CpuConfig
|
import CpuConfig
|
||||||
|
@ -127,6 +129,7 @@ Options.addSEOptions(parser)
|
||||||
|
|
||||||
if '--ruby' in sys.argv:
|
if '--ruby' in sys.argv:
|
||||||
Ruby.define_options(parser)
|
Ruby.define_options(parser)
|
||||||
|
Network.define_options(parser)
|
||||||
|
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
|
|
93
configs/network/Network.py
Normal file
93
configs/network/Network.py
Normal file
|
@ -0,0 +1,93 @@
|
||||||
|
# Copyright (c) 2016 Georgia Institute of Technology
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions are
|
||||||
|
# met: redistributions of source code must retain the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer;
|
||||||
|
# redistributions in binary form must reproduce the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer in the
|
||||||
|
# documentation and/or other materials provided with the distribution;
|
||||||
|
# neither the name of the copyright holders nor the names of its
|
||||||
|
# contributors may be used to endorse or promote products derived from
|
||||||
|
# this software without specific prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
#
|
||||||
|
# Authors: Tushar Krishna
|
||||||
|
|
||||||
|
import math
|
||||||
|
import m5
|
||||||
|
from m5.objects import *
|
||||||
|
from m5.defines import buildEnv
|
||||||
|
from m5.util import addToPath, fatal
|
||||||
|
|
||||||
|
def define_options(parser):
|
||||||
|
# By default, ruby uses the simple timing cpu
|
||||||
|
parser.set_defaults(cpu_type="timing")
|
||||||
|
|
||||||
|
parser.add_option("--topology", type="string", default="Crossbar",
|
||||||
|
help="check configs/topologies for complete set")
|
||||||
|
parser.add_option("--mesh-rows", type="int", default=1,
|
||||||
|
help="the number of rows in the mesh topology")
|
||||||
|
parser.add_option("--garnet-network", type="choice",
|
||||||
|
choices=['fixed', 'flexible'], help="'fixed'|'flexible'")
|
||||||
|
parser.add_option("--network-fault-model", action="store_true", default=False,
|
||||||
|
help="enable network fault model: see src/mem/ruby/network/fault_model/")
|
||||||
|
|
||||||
|
|
||||||
|
def create_network(options, ruby):
|
||||||
|
|
||||||
|
# Set the network classes based on the command line options
|
||||||
|
if options.garnet_network == "fixed":
|
||||||
|
NetworkClass = GarnetNetwork_d
|
||||||
|
IntLinkClass = GarnetIntLink_d
|
||||||
|
ExtLinkClass = GarnetExtLink_d
|
||||||
|
RouterClass = GarnetRouter_d
|
||||||
|
InterfaceClass = GarnetNetworkInterface_d
|
||||||
|
|
||||||
|
elif options.garnet_network == "flexible":
|
||||||
|
NetworkClass = GarnetNetwork
|
||||||
|
IntLinkClass = GarnetIntLink
|
||||||
|
ExtLinkClass = GarnetExtLink
|
||||||
|
RouterClass = GarnetRouter
|
||||||
|
InterfaceClass = GarnetNetworkInterface
|
||||||
|
|
||||||
|
else:
|
||||||
|
NetworkClass = SimpleNetwork
|
||||||
|
IntLinkClass = SimpleIntLink
|
||||||
|
ExtLinkClass = SimpleExtLink
|
||||||
|
RouterClass = Switch
|
||||||
|
InterfaceClass = None
|
||||||
|
|
||||||
|
# Instantiate the network object
|
||||||
|
# so that the controllers can connect to it.
|
||||||
|
network = NetworkClass(ruby_system = ruby, topology = options.topology,
|
||||||
|
routers = [], ext_links = [], int_links = [], netifs = [])
|
||||||
|
|
||||||
|
return (network, IntLinkClass, ExtLinkClass, RouterClass, InterfaceClass)
|
||||||
|
|
||||||
|
def init_network(options, network, InterfaceClass):
|
||||||
|
|
||||||
|
if options.garnet_network is None:
|
||||||
|
network.setup_buffers()
|
||||||
|
|
||||||
|
if InterfaceClass != None:
|
||||||
|
netifs = [InterfaceClass(id=i) \
|
||||||
|
for (i,n) in enumerate(network.ext_links)]
|
||||||
|
network.netifs = netifs
|
||||||
|
|
||||||
|
if options.network_fault_model:
|
||||||
|
assert(options.garnet_network == "fixed")
|
||||||
|
network.enable_fault_model = True
|
||||||
|
network.fault_model = FaultModel()
|
|
@ -47,6 +47,9 @@ from m5.util import addToPath, fatal
|
||||||
|
|
||||||
import MemConfig
|
import MemConfig
|
||||||
addToPath('../topologies')
|
addToPath('../topologies')
|
||||||
|
addToPath('../network')
|
||||||
|
|
||||||
|
import Network
|
||||||
|
|
||||||
def define_options(parser):
|
def define_options(parser):
|
||||||
# By default, ruby uses the simple timing cpu
|
# By default, ruby uses the simple timing cpu
|
||||||
|
@ -64,15 +67,7 @@ def define_options(parser):
|
||||||
help="used of transitions per cycle which is a proxy \
|
help="used of transitions per cycle which is a proxy \
|
||||||
for the number of ports.")
|
for the number of ports.")
|
||||||
|
|
||||||
# ruby network options
|
# network options are in network/Network.py
|
||||||
parser.add_option("--topology", type="string", default="Crossbar",
|
|
||||||
help="check configs/topologies for complete set")
|
|
||||||
parser.add_option("--mesh-rows", type="int", default=1,
|
|
||||||
help="the number of rows in the mesh topology")
|
|
||||||
parser.add_option("--garnet-network", type="choice",
|
|
||||||
choices=['fixed', 'flexible'], help="'fixed'|'flexible'")
|
|
||||||
parser.add_option("--network-fault-model", action="store_true", default=False,
|
|
||||||
help="enable network fault model: see src/mem/ruby/network/fault_model/")
|
|
||||||
|
|
||||||
# ruby mapping options
|
# ruby mapping options
|
||||||
parser.add_option("--numa-high-bit", type="int", default=0,
|
parser.add_option("--numa-high-bit", type="int", default=0,
|
||||||
|
@ -155,31 +150,9 @@ def create_system(options, full_system, system, piobus = None, dma_ports = []):
|
||||||
system.ruby = RubySystem()
|
system.ruby = RubySystem()
|
||||||
ruby = system.ruby
|
ruby = system.ruby
|
||||||
|
|
||||||
# Set the network classes based on the command line options
|
# Create the network object
|
||||||
if options.garnet_network == "fixed":
|
(network, IntLinkClass, ExtLinkClass, RouterClass, InterfaceClass) = \
|
||||||
NetworkClass = GarnetNetwork_d
|
Network.create_network(options, ruby)
|
||||||
IntLinkClass = GarnetIntLink_d
|
|
||||||
ExtLinkClass = GarnetExtLink_d
|
|
||||||
RouterClass = GarnetRouter_d
|
|
||||||
InterfaceClass = GarnetNetworkInterface_d
|
|
||||||
|
|
||||||
elif options.garnet_network == "flexible":
|
|
||||||
NetworkClass = GarnetNetwork
|
|
||||||
IntLinkClass = GarnetIntLink
|
|
||||||
ExtLinkClass = GarnetExtLink
|
|
||||||
RouterClass = GarnetRouter
|
|
||||||
InterfaceClass = GarnetNetworkInterface
|
|
||||||
|
|
||||||
else:
|
|
||||||
NetworkClass = SimpleNetwork
|
|
||||||
IntLinkClass = SimpleIntLink
|
|
||||||
ExtLinkClass = SimpleExtLink
|
|
||||||
RouterClass = Switch
|
|
||||||
InterfaceClass = None
|
|
||||||
|
|
||||||
# Instantiate the network object so that the controllers can connect to it.
|
|
||||||
network = NetworkClass(ruby_system = ruby, topology = options.topology,
|
|
||||||
routers = [], ext_links = [], int_links = [], netifs = [])
|
|
||||||
ruby.network = network
|
ruby.network = network
|
||||||
|
|
||||||
protocol = buildEnv['PROTOCOL']
|
protocol = buildEnv['PROTOCOL']
|
||||||
|
@ -193,6 +166,13 @@ def create_system(options, full_system, system, piobus = None, dma_ports = []):
|
||||||
print "Error: could not create sytem for ruby protocol %s" % protocol
|
print "Error: could not create sytem for ruby protocol %s" % protocol
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
# Create the network topology
|
||||||
|
topology.makeTopology(options, network, IntLinkClass, ExtLinkClass,
|
||||||
|
RouterClass)
|
||||||
|
|
||||||
|
# Initialize network based on topology
|
||||||
|
Network.init_network(options, network, InterfaceClass)
|
||||||
|
|
||||||
# Create a port proxy for connecting the system port. This is
|
# Create a port proxy for connecting the system port. This is
|
||||||
# independent of the protocol and kept in the protocol-agnostic
|
# independent of the protocol and kept in the protocol-agnostic
|
||||||
# part (i.e. here).
|
# part (i.e. here).
|
||||||
|
@ -207,24 +187,6 @@ def create_system(options, full_system, system, piobus = None, dma_ports = []):
|
||||||
# Connect the system port for loading of binaries etc
|
# Connect the system port for loading of binaries etc
|
||||||
system.system_port = system.sys_port_proxy.slave
|
system.system_port = system.sys_port_proxy.slave
|
||||||
|
|
||||||
# Create the network topology
|
|
||||||
topology.makeTopology(options, network, IntLinkClass, ExtLinkClass,
|
|
||||||
RouterClass)
|
|
||||||
|
|
||||||
if options.garnet_network is None:
|
|
||||||
assert(NetworkClass == SimpleNetwork)
|
|
||||||
assert(RouterClass == Switch)
|
|
||||||
network.setup_buffers()
|
|
||||||
|
|
||||||
if InterfaceClass != None:
|
|
||||||
netifs = [InterfaceClass(id=i) for (i,n) in enumerate(network.ext_links)]
|
|
||||||
network.netifs = netifs
|
|
||||||
|
|
||||||
if options.network_fault_model:
|
|
||||||
assert(options.garnet_network == "fixed")
|
|
||||||
network.enable_fault_model = True
|
|
||||||
network.fault_model = FaultModel()
|
|
||||||
|
|
||||||
setup_memory_controllers(system, ruby, dir_cntrls, options)
|
setup_memory_controllers(system, ruby, dir_cntrls, options)
|
||||||
|
|
||||||
# Connect the cpu sequencers and the piobus
|
# Connect the cpu sequencers and the piobus
|
||||||
|
|
Loading…
Reference in a new issue