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.
This commit is contained in:
@@ -39,15 +39,10 @@ from m5.defines import buildEnv
|
||||
from m5.util import addToPath
|
||||
import os, optparse, sys
|
||||
|
||||
# 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_root = os.path.dirname(config_path)
|
||||
m5_root = os.path.dirname(config_root)
|
||||
addToPath(config_root+'/configs/common')
|
||||
addToPath(config_root+'/configs/ruby')
|
||||
addToPath(config_root+'/configs/topologies')
|
||||
m5.util.addToPath('../configs/common')
|
||||
m5.util.addToPath('../configs/')
|
||||
|
||||
import Ruby
|
||||
from ruby import Ruby
|
||||
import Options
|
||||
|
||||
parser = optparse.OptionParser()
|
||||
|
||||
@@ -39,14 +39,10 @@ from m5.defines import buildEnv
|
||||
from m5.util import addToPath
|
||||
import os, optparse, sys, math, glob
|
||||
|
||||
# Get paths we might need
|
||||
config_path = os.path.dirname(os.path.abspath(__file__))
|
||||
config_root = os.path.dirname(config_path)
|
||||
addToPath(config_root+'/configs/common')
|
||||
addToPath(config_root+'/configs/ruby')
|
||||
addToPath(config_root+'/configs/topologies')
|
||||
m5.util.addToPath('../configs/common')
|
||||
m5.util.addToPath('../configs/')
|
||||
|
||||
import Ruby
|
||||
from ruby import Ruby
|
||||
import Options
|
||||
import GPUTLBOptions, GPUTLBConfig
|
||||
|
||||
|
||||
@@ -33,15 +33,10 @@ from m5.defines import buildEnv
|
||||
from m5.util import addToPath
|
||||
import os, optparse, sys
|
||||
|
||||
# Get paths we might need
|
||||
config_path = os.path.dirname(os.path.abspath(__file__))
|
||||
config_root = os.path.dirname(config_path)
|
||||
m5_root = os.path.dirname(config_root)
|
||||
addToPath(config_root+'/configs/common')
|
||||
addToPath(config_root+'/configs/ruby')
|
||||
addToPath(config_root+'/configs/topologies')
|
||||
m5.util.addToPath('../configs/common')
|
||||
m5.util.addToPath('../configs/')
|
||||
|
||||
import Ruby
|
||||
from ruby import Ruby
|
||||
import Options
|
||||
|
||||
parser = optparse.OptionParser()
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
import m5
|
||||
from m5.objects import *
|
||||
m5.util.addToPath('../configs/common')
|
||||
m5.util.addToPath('../configs/topologies')
|
||||
|
||||
nb_cores = 4
|
||||
cpus = [ DerivO3CPU(cpu_id=i) for i in xrange(nb_cores) ]
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
import m5
|
||||
from m5.objects import *
|
||||
m5.util.addToPath('../configs/common')
|
||||
m5.util.addToPath('../configs/topologies')
|
||||
|
||||
|
||||
import ruby_config
|
||||
|
||||
@@ -32,9 +32,8 @@ m5.util.addToPath('../configs/common')
|
||||
from Benchmarks import SysConfig
|
||||
import FSConfig
|
||||
|
||||
m5.util.addToPath('../configs/ruby')
|
||||
m5.util.addToPath('../configs/topologies')
|
||||
import Ruby
|
||||
m5.util.addToPath('../configs/')
|
||||
from ruby import Ruby
|
||||
import Options
|
||||
|
||||
# Add the ruby specific and protocol specific options
|
||||
|
||||
@@ -34,15 +34,10 @@ from m5.defines import buildEnv
|
||||
from m5.util import addToPath
|
||||
import os, optparse, sys
|
||||
|
||||
# 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_root = os.path.dirname(config_path)
|
||||
m5_root = os.path.dirname(config_root)
|
||||
addToPath(config_root+'/configs/common')
|
||||
addToPath(config_root+'/configs/ruby')
|
||||
addToPath(config_root+'/configs/topologies')
|
||||
m5.util.addToPath('../configs/common')
|
||||
m5.util.addToPath('../configs/')
|
||||
|
||||
import Ruby
|
||||
from ruby import Ruby
|
||||
import Options
|
||||
|
||||
parser = optparse.OptionParser()
|
||||
|
||||
@@ -28,8 +28,6 @@
|
||||
|
||||
import m5
|
||||
from m5.objects import *
|
||||
m5.util.addToPath('../configs/topologies')
|
||||
|
||||
|
||||
nb_cores = 4
|
||||
cpus = [ AtomicSimpleCPU(cpu_id=i) for i in xrange(nb_cores) ]
|
||||
|
||||
@@ -32,16 +32,11 @@ from m5.defines import buildEnv
|
||||
from m5.util import addToPath
|
||||
import os, optparse, sys
|
||||
|
||||
# Get paths we might need
|
||||
config_path = os.path.dirname(os.path.abspath(__file__))
|
||||
config_root = os.path.dirname(config_path)
|
||||
m5_root = os.path.dirname(config_root)
|
||||
addToPath(config_root+'/configs/common')
|
||||
addToPath(config_root+'/configs/ruby')
|
||||
addToPath(config_root+'/configs/topologies')
|
||||
m5.util.addToPath('../configs/common')
|
||||
m5.util.addToPath('../configs/')
|
||||
|
||||
import Options
|
||||
import Ruby
|
||||
from ruby import Ruby
|
||||
|
||||
parser = optparse.OptionParser()
|
||||
Options.addCommonOptions(parser)
|
||||
|
||||
@@ -32,14 +32,10 @@ from m5.defines import buildEnv
|
||||
from m5.util import addToPath
|
||||
import os, optparse, sys
|
||||
|
||||
# Get paths we might need
|
||||
config_path = os.path.dirname(os.path.abspath(__file__))
|
||||
config_root = os.path.dirname(config_path)
|
||||
addToPath(config_root+'/configs/common')
|
||||
addToPath(config_root+'/configs/ruby')
|
||||
addToPath(config_root+'/configs/topologies')
|
||||
m5.util.addToPath('../configs/common')
|
||||
m5.util.addToPath('../configs/')
|
||||
|
||||
import Ruby
|
||||
from ruby import Ruby
|
||||
import Options
|
||||
|
||||
parser = optparse.OptionParser()
|
||||
|
||||
Reference in New Issue
Block a user