resources: Upgrade gem5 configs of spec2006-tests to python3
Signed-off-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
Change-Id: Id76448ac6a29ca7595a0ce8bd46263a40744833b
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5-resources/+/30855
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: Bobby R. Bruce <bbruce@ucdavis.edu>
diff --git a/src/spec2006-tests/configs-spec2006-tests/run_spec.py b/src/spec2006-tests/configs-spec2006-tests/run_spec.py
index 55573fc..b35d3d2 100644
--- a/src/spec2006-tests/configs-spec2006-tests/run_spec.py
+++ b/src/spec2006-tests/configs-spec2006-tests/run_spec.py
@@ -216,6 +216,13 @@
no_copy_logs = args.no_copy_logs
allow_listeners = args.allow_listeners
+ if not no_copy_logs and not os.path.isabs(m5.options.outdir):
+ print("Please specify the --outdir (output directory) of gem5"
+ " in the form of an absolute path")
+ print("An example: build/X86/gem5.opt --outdir /home/user/m5out/"
+ " configs-spec-tests/run_spec ...")
+ exit(1)
+
output_dir = os.path.join(m5.options.outdir, "speclogs")
# Get the DetailedCPU class from its name
diff --git a/src/spec2006-tests/configs-spec2006-tests/system/__init__.py b/src/spec2006-tests/configs-spec2006-tests/system/__init__.py
index 1fc22f3..099d7c5 100644
--- a/src/spec2006-tests/configs-spec2006-tests/system/__init__.py
+++ b/src/spec2006-tests/configs-spec2006-tests/system/__init__.py
@@ -27,4 +27,4 @@
#
# Authors: Jason Lowe-Power
-from system import MySystem
+from .system import MySystem
diff --git a/src/spec2006-tests/configs-spec2006-tests/system/system.py b/src/spec2006-tests/configs-spec2006-tests/system/system.py
index 03ad234..2f39061 100644
--- a/src/spec2006-tests/configs-spec2006-tests/system/system.py
+++ b/src/spec2006-tests/configs-spec2006-tests/system/system.py
@@ -30,8 +30,8 @@
import m5
from m5.objects import *
from m5.util import convert
-from fs_tools import *
-from caches import *
+from .fs_tools import *
+from .caches import *
class MySystem(System):
@@ -104,35 +104,39 @@
def totalInsts(self):
return sum([cpu.totalInsts() for cpu in self.cpu])
+ def createCPUThreads(self, cpu):
+ for c in cpu:
+ c.createThreads()
+
def createCPU(self, num_cpus, TimingCPUModel):
if self._no_kvm:
self.cpu = [AtomicSimpleCPU(cpu_id = i, switched_out = False)
for i in range(num_cpus)]
- map(lambda c: c.createThreads(), self.cpu)
+ self.createCPUThreads(self.cpu)
self.mem_mode = 'timing'
else:
# Note KVM needs a VM and atomic_noncaching
self.cpu = [X86KvmCPU(cpu_id = i)
for i in range(num_cpus)]
- map(lambda c: c.createThreads(), self.cpu)
+ self.createCPUThreads(self.cpu)
self.kvm_vm = KvmVM()
self.mem_mode = 'atomic_noncaching'
self.atomicCpu = [AtomicSimpleCPU(cpu_id = i,
switched_out = True)
for i in range(num_cpus)]
- map(lambda c: c.createThreads(), self.atomicCpu)
+ self.createCPUThreads(self.atomicCpu)
self.detailed_cpu = [TimingCPUModel(cpu_id = i,
- switched_out = True)
- for i in range(num_cpus)]
+ switched_out = True)
+ for i in range(num_cpus)]
- map(lambda c: c.createThreads(), self.detailed_cpu)
+ self.createCPUThreads(self.detailed_cpu)
def switchCpus(self, old, new):
assert(new[0].switchedOut())
- m5.switchCpus(self, zip(old, new))
+ m5.switchCpus(self, list(zip(old, new)))
def setDiskImages(self, img_path_1, img_path_2):
disk0 = CowDisk(img_path_1)