diff options
author | Andreas Hansson <andreas.hansson@arm.com> | 2016-10-13 03:17:19 -0400 |
---|---|---|
committer | Andreas Hansson <andreas.hansson@arm.com> | 2016-10-13 03:17:19 -0400 |
commit | 68fdccb30bd85cd99823fb411ec7ae67112062d7 (patch) | |
tree | e6ef3d54238c64c63b00a3b83da96a9a1cdaad8b /configs/example | |
parent | 2e5e9085792b1a7c47c231a2adf0da6f7ff8f20d (diff) | |
download | gem5-68fdccb30bd85cd99823fb411ec7ae67112062d7.tar.xz |
ruby: Fix regressions and make Ruby configs Python packages
This patch moves the addition of network options into the Ruby module
to avoid the regressions all having to add it explicitly. Doing this
exposes an issue in our current config system though, namely the fact
that addtoPath is relative to the Python script being executed. Since
both example and regression scripts use the Ruby module we would end
up with two different (relative) paths being added. Instead we take a
first step at turning the config modules into Python packages, simply
by adding a __init__.py in the configs/ruby, configs/topologies and
configs/network subdirectories.
As a result, we can now add the top-level configs directory to the
Python search path, and then use the package names in the various
modules. The example scripts are also updated, and the messy
path-deducing variations in the scripts are unified.
Diffstat (limited to 'configs/example')
-rw-r--r-- | configs/example/apu_se.py | 9 | ||||
-rw-r--r-- | configs/example/fs.py | 7 | ||||
-rw-r--r-- | configs/example/garnet_synth_traffic.py | 8 | ||||
-rw-r--r-- | configs/example/ruby_direct_test.py | 8 | ||||
-rw-r--r-- | configs/example/ruby_gpu_random_test.py | 8 | ||||
-rw-r--r-- | configs/example/ruby_mem_test.py | 8 | ||||
-rw-r--r-- | configs/example/ruby_random_test.py | 8 | ||||
-rw-r--r-- | configs/example/se.py | 8 |
8 files changed, 18 insertions, 46 deletions
diff --git a/configs/example/apu_se.py b/configs/example/apu_se.py index 2069daccb..84fadee3f 100644 --- a/configs/example/apu_se.py +++ b/configs/example/apu_se.py @@ -42,14 +42,12 @@ import m5 from m5.objects import * from m5.util import addToPath -addToPath('../ruby') -addToPath('../network') +addToPath('../') addToPath('../common') -addToPath('../topologies') + +from ruby import Ruby import Options -import Ruby -import Network import Simulation import GPUTLBOptions, GPUTLBConfig @@ -159,7 +157,6 @@ parser.add_option('--fast-forward-pseudo-op', action='store_true', Ruby.define_options(parser) -Network.define_options(parser) #add TLB options to the parser GPUTLBOptions.tlb_options(parser) diff --git a/configs/example/fs.py b/configs/example/fs.py index 32fc699ba..13a8b0cf9 100644 --- a/configs/example/fs.py +++ b/configs/example/fs.py @@ -49,12 +49,10 @@ from m5.defines import buildEnv from m5.objects import * from m5.util import addToPath, fatal +addToPath('../') addToPath('../common') -addToPath('../ruby') -addToPath('../network') -import Ruby -import Network +from ruby import Ruby from FSConfig import * from SysPaths import * @@ -308,7 +306,6 @@ Options.addFSOptions(parser) # Add the ruby specific and protocol specific options if '--ruby' in sys.argv: Ruby.define_options(parser) - Network.define_options(parser) (options, args) = parser.parse_args() diff --git a/configs/example/garnet_synth_traffic.py b/configs/example/garnet_synth_traffic.py index 8962c4af1..f11022006 100644 --- a/configs/example/garnet_synth_traffic.py +++ b/configs/example/garnet_synth_traffic.py @@ -32,13 +32,10 @@ from m5.defines import buildEnv from m5.util import addToPath import os, optparse, sys addToPath('../common') -addToPath('../ruby') -addToPath('../network') -addToPath('../topologies') +addToPath('../') import Options -import Ruby -import Network +from ruby import Ruby # Get paths we might need. It's expected this file is in m5/configs/example. config_path = os.path.dirname(os.path.abspath(__file__)) @@ -87,7 +84,6 @@ parser.add_option("--inj-vnet", type="int", default=-1, # Add the ruby specific and protocol specific options # Ruby.define_options(parser) -Network.define_options(parser) execfile(os.path.join(config_root, "common", "Options.py")) diff --git a/configs/example/ruby_direct_test.py b/configs/example/ruby_direct_test.py index cc74aec5d..128a7889a 100644 --- a/configs/example/ruby_direct_test.py +++ b/configs/example/ruby_direct_test.py @@ -34,13 +34,10 @@ from m5.defines import buildEnv from m5.util import addToPath import os, optparse, sys addToPath('../common') -addToPath('../ruby') -addToPath('../network') -addToPath('../topologies') +addToPath('../') import Options -import Ruby -import Network +from ruby import Ruby # Get paths we might need. It's expected this file is in m5/configs/example. config_path = os.path.dirname(os.path.abspath(__file__)) @@ -65,7 +62,6 @@ parser.add_option("--percent-writes", type="int", default=100, # Add the ruby specific and protocol specific options # Ruby.define_options(parser) -Network.define_options(parser) (options, args) = parser.parse_args() if args: diff --git a/configs/example/ruby_gpu_random_test.py b/configs/example/ruby_gpu_random_test.py index 005546712..9af446799 100644 --- a/configs/example/ruby_gpu_random_test.py +++ b/configs/example/ruby_gpu_random_test.py @@ -39,13 +39,10 @@ from m5.defines import buildEnv from m5.util import addToPath import os, optparse, sys addToPath('../common') -addToPath('../ruby') -addToPath('../network') -addToPath('../topologies') +addToPath('../') import Options -import Ruby -import Network +from ruby import Ruby # Get paths we might need. config_path = os.path.dirname(os.path.abspath(__file__)) @@ -78,7 +75,6 @@ parser.add_option("--wfs-per-simd", type="int", default=10, help="Number of " \ # Add the ruby specific and protocol specific options # Ruby.define_options(parser) -Network.define_options(parser) execfile(os.path.join(config_root, "common", "Options.py")) diff --git a/configs/example/ruby_mem_test.py b/configs/example/ruby_mem_test.py index d7d36d687..1958c139d 100644 --- a/configs/example/ruby_mem_test.py +++ b/configs/example/ruby_mem_test.py @@ -34,13 +34,10 @@ from m5.defines import buildEnv from m5.util import addToPath import os, optparse, sys addToPath('../common') -addToPath('../ruby') -addToPath('../network') -addToPath('../topologies') +addToPath('../') import Options -import Ruby -import Network +from ruby import Ruby # Get paths we might need. It's expected this file is in m5/configs/example. config_path = os.path.dirname(os.path.abspath(__file__)) @@ -65,7 +62,6 @@ parser.add_option("--suppress-func-warnings", action="store_true", # Add the ruby specific and protocol specific options # Ruby.define_options(parser) -Network.define_options(parser) execfile(os.path.join(config_root, "common", "Options.py")) diff --git a/configs/example/ruby_random_test.py b/configs/example/ruby_random_test.py index 44df082b3..a0dca297e 100644 --- a/configs/example/ruby_random_test.py +++ b/configs/example/ruby_random_test.py @@ -34,13 +34,10 @@ from m5.defines import buildEnv from m5.util import addToPath import os, optparse, sys addToPath('../common') -addToPath('../ruby') -addToPath('../network') -addToPath('../topologies') +addToPath('../') import Options -import Ruby -import Network +from ruby import Ruby # Get paths we might need. It's expected this file is in m5/configs/example. config_path = os.path.dirname(os.path.abspath(__file__)) @@ -59,7 +56,6 @@ parser.add_option("-f", "--wakeup_freq", metavar="N", default=10, # Add the ruby specific and protocol specific options # Ruby.define_options(parser) -Network.define_options(parser) execfile(os.path.join(config_root, "common", "Options.py")) diff --git a/configs/example/se.py b/configs/example/se.py index 238aa9e64..cfc82e83a 100644 --- a/configs/example/se.py +++ b/configs/example/se.py @@ -51,13 +51,12 @@ from m5.defines import buildEnv from m5.objects import * from m5.util import addToPath, fatal +addToPath('../') addToPath('../common') -addToPath('../ruby') -addToPath('../network') + +from ruby import Ruby import Options -import Ruby -import Network import Simulation import CacheConfig import CpuConfig @@ -129,7 +128,6 @@ Options.addSEOptions(parser) if '--ruby' in sys.argv: Ruby.define_options(parser) - Network.define_options(parser) (options, args) = parser.parse_args() |