summaryrefslogtreecommitdiff
path: root/configs/example
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2018-03-05 22:51:34 -0800
committerGabe Black <gabeblack@google.com>2018-03-06 23:39:43 +0000
commit659900aedd1b4fc69b61b5dbaee39dba26848637 (patch)
tree586dcfc17855c54a4985f596a145730cdeab7309 /configs/example
parent0bb50e6745b35c785c4d8051eb43f6bc419fb924 (diff)
downloadgem5-659900aedd1b4fc69b61b5dbaee39dba26848637.tar.xz
config: Switch from the print statement to the print function.
Change-Id: I701fa58cfcfa2767ce9ad24da314a053889878d0 Reviewed-on: https://gem5-review.googlesource.com/8762 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Reviewed-by: Anthony Gutierrez <anthony.gutierrez@amd.com> Maintainer: Gabe Black <gabeblack@google.com>
Diffstat (limited to 'configs/example')
-rw-r--r--configs/example/apu_se.py19
-rw-r--r--configs/example/arm/fs_bigLITTLE.py8
-rw-r--r--configs/example/arm/fs_power.py12
-rw-r--r--configs/example/arm/starter_fs.py12
-rw-r--r--configs/example/arm/starter_se.py10
-rw-r--r--configs/example/etrace_replay.py8
-rw-r--r--configs/example/fs.py14
-rw-r--r--configs/example/garnet_synth_traffic.py11
-rw-r--r--configs/example/hmctest.py10
-rw-r--r--configs/example/memcheck.py26
-rw-r--r--configs/example/memtest.py28
-rw-r--r--configs/example/read_config.py5
-rw-r--r--configs/example/ruby_direct_test.py8
-rw-r--r--configs/example/ruby_gpu_random_test.py6
-rw-r--r--configs/example/ruby_mem_test.py10
-rw-r--r--configs/example/ruby_random_test.py6
-rw-r--r--configs/example/se.py13
17 files changed, 119 insertions, 87 deletions
diff --git a/configs/example/apu_se.py b/configs/example/apu_se.py
index 012fdd36b..da6305ff9 100644
--- a/configs/example/apu_se.py
+++ b/configs/example/apu_se.py
@@ -33,6 +33,8 @@
# Author: Sooraj Puthoor
#
+from __future__ import print_function
+
import optparse, os, re
import math
import glob
@@ -385,7 +387,7 @@ else:
kernel_path = os.path.dirname(executable)
kernel_files = glob.glob(os.path.join(kernel_path, '*.asm'))
if kernel_files:
- print "Using GPU kernel code file(s)", ",".join(kernel_files)
+ print("Using GPU kernel code file(s)", ",".join(kernel_files))
else:
fatal("Can't locate kernel code (.asm) in " + kernel_path)
@@ -489,7 +491,7 @@ for i in xrange(n_cu):
for i in xrange(n_cu):
if i > 0 and not i % options.cu_per_sqc:
- print "incrementing idx on ", i
+ print("incrementing idx on ", i)
gpu_port_idx += 1
system.cpu[shader_idx].CUs[i].sqc_port = \
system.ruby._cpu_ports[gpu_port_idx].slave
@@ -552,15 +554,14 @@ m5.instantiate(checkpoint_dir)
host_cpu.workload[0].map(0x10000000, 0x200000000, 4096)
if options.fast_forward:
- print "Switch at instruction count: %d" % \
- cpu_list[0].max_insts_any_thread
+ print("Switch at instruction count: %d" % cpu_list[0].max_insts_any_thread)
exit_event = m5.simulate(maxtick)
if options.fast_forward:
if exit_event.getCause() == "a thread reached the max instruction count":
m5.switchCpus(system, switch_cpu_list)
- print "Switched CPUS @ tick %s" % (m5.curTick())
+ print("Switched CPUS @ tick %s" % (m5.curTick()))
m5.stats.reset()
exit_event = m5.simulate(maxtick - m5.curTick())
elif options.fast_forward_pseudo_op:
@@ -568,15 +569,15 @@ elif options.fast_forward_pseudo_op:
# If we are switching *to* kvm, then the current stats are meaningful
# Note that we don't do any warmup by default
if type(switch_cpu_list[0][0]) == FutureCpuClass:
- print "Dumping stats..."
+ print("Dumping stats...")
m5.stats.dump()
m5.switchCpus(system, switch_cpu_list)
- print "Switched CPUS @ tick %s" % (m5.curTick())
+ print("Switched CPUS @ tick %s" % (m5.curTick()))
m5.stats.reset()
# This lets us switch back and forth without keeping a counter
switch_cpu_list = [(x[1], x[0]) for x in switch_cpu_list]
exit_event = m5.simulate(maxtick - m5.curTick())
-print "Ticks:", m5.curTick()
-print 'Exiting because ', exit_event.getCause()
+print("Ticks:", m5.curTick())
+print('Exiting because ', exit_event.getCause())
sys.exit(exit_event.getCode())
diff --git a/configs/example/arm/fs_bigLITTLE.py b/configs/example/arm/fs_bigLITTLE.py
index 7e0555c00..7d66c03a6 100644
--- a/configs/example/arm/fs_bigLITTLE.py
+++ b/configs/example/arm/fs_bigLITTLE.py
@@ -40,6 +40,8 @@
# a generic ARM bigLITTLE system.
+from __future__ import print_function
+
import argparse
import os
import sys
@@ -311,12 +313,12 @@ def run(checkpoint_dir=m5.options.outdir):
event = m5.simulate()
exit_msg = event.getCause()
if exit_msg == "checkpoint":
- print "Dropping checkpoint at tick %d" % m5.curTick()
+ print("Dropping checkpoint at tick %d" % m5.curTick())
cpt_dir = os.path.join(checkpoint_dir, "cpt.%d" % m5.curTick())
m5.checkpoint(cpt_dir)
- print "Checkpoint done."
+ print("Checkpoint done.")
else:
- print exit_msg, " @ ", m5.curTick()
+ print(exit_msg, " @ ", m5.curTick())
break
sys.exit(event.getCode())
diff --git a/configs/example/arm/fs_power.py b/configs/example/arm/fs_power.py
index 14dbae04a..b27455f13 100644
--- a/configs/example/arm/fs_power.py
+++ b/configs/example/arm/fs_power.py
@@ -39,6 +39,8 @@
# This configuration file extends the example ARM big.LITTLE(tm)
# with example power models.
+from __future__ import print_function
+
import argparse
import os
@@ -90,11 +92,11 @@ def main():
bL.instantiate(options)
- print "*" * 70
- print "WARNING: The power numbers generated by this script are " \
- "examples. They are not representative of any particular " \
- "implementation or process."
- print "*" * 70
+ print("*" * 70)
+ print("WARNING: The power numbers generated by this script are "
+ "examples. They are not representative of any particular "
+ "implementation or process.")
+ print("*" * 70)
# Dumping stats periodically
m5.stats.periodicStatDump(m5.ticks.fromSeconds(0.1E-3))
diff --git a/configs/example/arm/starter_fs.py b/configs/example/arm/starter_fs.py
index 2ca1cb800..a1997682e 100644
--- a/configs/example/arm/starter_fs.py
+++ b/configs/example/arm/starter_fs.py
@@ -43,6 +43,8 @@ Research Starter Kit on System Modeling. More information can be found
at: http://www.arm.com/ResearchEnablement/SystemModeling
"""
+from __future__ import print_function
+
import os
import m5
from m5.util import addToPath
@@ -97,7 +99,7 @@ def create(args):
dtb_file = args.dtb
if args.script and not os.path.isfile(args.script):
- print "Error: Bootscript %s does not exist" % args.script
+ print("Error: Bootscript %s does not exist" % args.script)
sys.exit(1)
cpu_class = cpu_types[args.cpu][0]
@@ -175,18 +177,18 @@ def create(args):
def run(args):
cptdir = m5.options.outdir
if args.checkpoint:
- print "Checkpoint directory: %s" % cptdir
+ print("Checkpoint directory: %s" % cptdir)
while True:
event = m5.simulate()
exit_msg = event.getCause()
if exit_msg == "checkpoint":
- print "Dropping checkpoint at tick %d" % m5.curTick()
+ print("Dropping checkpoint at tick %d" % m5.curTick())
cpt_dir = os.path.join(m5.options.outdir, "cpt.%d" % m5.curTick())
m5.checkpoint(os.path.join(cpt_dir))
- print "Checkpoint done."
+ print("Checkpoint done.")
else:
- print exit_msg, " @ ", m5.curTick()
+ print(exit_msg, " @ ", m5.curTick())
break
sys.exit(event.getCode())
diff --git a/configs/example/arm/starter_se.py b/configs/example/arm/starter_se.py
index 902e6e49a..ef218d978 100644
--- a/configs/example/arm/starter_se.py
+++ b/configs/example/arm/starter_se.py
@@ -43,6 +43,8 @@ Research Starter Kit on System Modeling. More information can be found
at: http://www.arm.com/ResearchEnablement/SystemModeling
"""
+from __future__ import print_function
+
import os
import m5
from m5.util import addToPath
@@ -145,7 +147,7 @@ def get_processes(cmd):
process = Process(pid=100 + idx, cwd=cwd, cmd=argv, executable=argv[0])
- print "info: %d. command and arguments: %s" % (idx + 1, process.cmd)
+ print("info: %d. command and arguments: %s" % (idx + 1, process.cmd))
multiprocesses.append(process)
return multiprocesses
@@ -168,8 +170,8 @@ def create(args):
# that we can pass to gem5.
processes = get_processes(args.commands_to_run)
if len(processes) != args.num_cores:
- print "Error: Cannot map %d command(s) onto %d " \
- "CPU(s)" % (len(processes), args.num_cores)
+ print("Error: Cannot map %d command(s) onto %d CPU(s)" %
+ (len(processes), args.num_cores))
sys.exit(1)
# Assign one workload to each CPU
@@ -225,7 +227,7 @@ def main():
# Print the reason for the simulation exit. Some exit codes are
# requests for service (e.g., checkpoints) from the simulation
# script. We'll just ignore them here and exit.
- print event.getCause(), " @ ", m5.curTick()
+ print(event.getCause(), " @ ", m5.curTick())
sys.exit(event.getCode())
diff --git a/configs/example/etrace_replay.py b/configs/example/etrace_replay.py
index f8586d62f..e64871af7 100644
--- a/configs/example/etrace_replay.py
+++ b/configs/example/etrace_replay.py
@@ -37,6 +37,8 @@
# Basic elastic traces replay script that configures a Trace CPU
+from __future__ import print_function
+
import optparse
from m5.util import addToPath, fatal
@@ -53,14 +55,14 @@ parser = optparse.OptionParser()
Options.addCommonOptions(parser)
if '--ruby' in sys.argv:
- print "This script does not support Ruby configuration, mainly"\
- " because Trace CPU has been tested only with classic memory system"
+ print("This script does not support Ruby configuration, mainly"
+ " because Trace CPU has been tested only with classic memory system")
sys.exit(1)
(options, args) = parser.parse_args()
if args:
- print "Error: script doesn't take any positional arguments"
+ print("Error: script doesn't take any positional arguments")
sys.exit(1)
numThreads = 1
diff --git a/configs/example/fs.py b/configs/example/fs.py
index f7115eb48..0f87e2b3a 100644
--- a/configs/example/fs.py
+++ b/configs/example/fs.py
@@ -41,6 +41,8 @@
# Authors: Ali Saidi
# Brad Beckmann
+from __future__ import print_function
+
import optparse
import sys
@@ -74,8 +76,8 @@ def is_kvm_cpu(cpu_class):
def cmd_line_template():
if options.command_line and options.command_line_file:
- print "Error: --command-line and --command-line-file are " \
- "mutually exclusive"
+ print("Error: --command-line and --command-line-file are "
+ "mutually exclusive")
sys.exit(1)
if options.command_line:
return options.command_line
@@ -310,7 +312,7 @@ if '--ruby' in sys.argv:
(options, args) = parser.parse_args()
if args:
- print "Error: script doesn't take any positional arguments"
+ print("Error: script doesn't take any positional arguments")
sys.exit(1)
# system under test can be any CPU
@@ -323,8 +325,8 @@ if options.benchmark:
try:
bm = Benchmarks[options.benchmark]
except KeyError:
- print "Error benchmark %s has not been defined." % options.benchmark
- print "Valid benchmarks are: %s" % DefinedBenchmarks
+ print("Error benchmark %s has not been defined." % options.benchmark)
+ print("Valid benchmarks are: %s" % DefinedBenchmarks)
sys.exit(1)
else:
if options.dual:
@@ -357,7 +359,7 @@ elif len(bm) == 1 and options.dist:
elif len(bm) == 1:
root = Root(full_system=True, system=test_sys)
else:
- print "Error I don't know how to create more than 2 systems."
+ print("Error I don't know how to create more than 2 systems.")
sys.exit(1)
if options.timesync:
diff --git a/configs/example/garnet_synth_traffic.py b/configs/example/garnet_synth_traffic.py
index 0cb1fae9f..92fb3a047 100644
--- a/configs/example/garnet_synth_traffic.py
+++ b/configs/example/garnet_synth_traffic.py
@@ -26,6 +26,8 @@
#
# Author: Tushar Krishna
+from __future__ import print_function
+
import m5
from m5.objects import *
from m5.defines import buildEnv
@@ -90,14 +92,13 @@ execfile(os.path.join(config_root, "common", "Options.py"))
(options, args) = parser.parse_args()
if args:
- print "Error: script doesn't take any positional arguments"
+ print("Error: script doesn't take any positional arguments")
sys.exit(1)
if options.inj_vnet > 2:
- print "Error: Injection vnet %d should be 0 (1-flit), 1 (1-flit) \
- or 2 (5-flit) or -1 (random)"\
- % (options.inj_vnet)
+ print("Error: Injection vnet %d should be 0 (1-flit), 1 (1-flit) "
+ "or 2 (5-flit) or -1 (random)" % (options.inj_vnet))
sys.exit(1)
@@ -153,4 +154,4 @@ m5.instantiate()
# simulate until program terminates
exit_event = m5.simulate(options.abs_max_tick)
-print 'Exiting @ tick', m5.curTick(), 'because', exit_event.getCause()
+print('Exiting @ tick', m5.curTick(), 'because', exit_event.getCause())
diff --git a/configs/example/hmctest.py b/configs/example/hmctest.py
index 9ed3ef45d..c370d0a84 100644
--- a/configs/example/hmctest.py
+++ b/configs/example/hmctest.py
@@ -1,3 +1,5 @@
+from __future__ import print_function
+
import sys
import argparse
import subprocess
@@ -100,13 +102,13 @@ def main():
root = build_system(options)
# instantiate all of the objects we've created so far
m5.instantiate()
- print "Beginning simulation!"
+ print("Beginning simulation!")
event = m5.simulate(10000000000)
m5.stats.dump()
- print 'Exiting @ tick %i because %s (exit code is %i)' % (m5.curTick(),
+ print('Exiting @ tick %i because %s (exit code is %i)' % (m5.curTick(),
event.getCause(),
- event.getCode())
- print "Done"
+ event.getCode()))
+ print("Done")
if __name__ == "__m5_main__":
diff --git a/configs/example/memcheck.py b/configs/example/memcheck.py
index 0bbcd2f7c..c2eed1959 100644
--- a/configs/example/memcheck.py
+++ b/configs/example/memcheck.py
@@ -39,6 +39,8 @@
# Authors: Ron Dreslinski
# Andreas Hansson
+from __future__ import print_function
+
import optparse
import random
import sys
@@ -108,7 +110,7 @@ parser.add_option("--sys-clock", action="store", type="string",
(options, args) = parser.parse_args()
if args:
- print "Error: script doesn't take any positional arguments"
+ print("Error: script doesn't take any positional arguments")
sys.exit(1)
# Start by parsing the command line options and do some basic sanity
@@ -118,36 +120,36 @@ if options.random:
tree_depth = random.randint(1, 4)
cachespec = [random.randint(1, 3) for i in range(tree_depth)]
testerspec = [random.randint(1, 3) for i in range(tree_depth + 1)]
- print "Generated random tree -c", ':'.join(map(str, cachespec)), \
- "-t", ':'.join(map(str, testerspec))
+ print("Generated random tree -c", ':'.join(map(str, cachespec)),
+ "-t", ':'.join(map(str, testerspec)))
else:
try:
cachespec = [int(x) for x in options.caches.split(':')]
testerspec = [int(x) for x in options.testers.split(':')]
except:
- print "Error: Unable to parse caches or testers option"
+ print("Error: Unable to parse caches or testers option")
sys.exit(1)
if len(cachespec) < 1:
- print "Error: Must have at least one level of caches"
+ print("Error: Must have at least one level of caches")
sys.exit(1)
if len(cachespec) != len(testerspec) - 1:
- print "Error: Testers must have one element more than caches"
+ print("Error: Testers must have one element more than caches")
sys.exit(1)
if testerspec[-1] == 0:
- print "Error: Must have testers at the uppermost level"
+ print("Error: Must have testers at the uppermost level")
sys.exit(1)
for t in testerspec:
if t < 0:
- print "Error: Cannot have a negative number of testers"
+ print("Error: Cannot have a negative number of testers")
sys.exit(1)
for c in cachespec:
if c < 1:
- print "Error: Must have 1 or more caches at each level"
+ print("Error: Must have 1 or more caches at each level")
sys.exit(1)
# Determine the tester multiplier for each level as the string
@@ -155,7 +157,7 @@ else:
multiplier = [1]
for c in cachespec:
if c < 1:
- print "Error: Must have at least one cache per level"
+ print("Error: Must have at least one cache per level")
multiplier.append(multiplier[-1] * c)
numtesters = 0
@@ -275,7 +277,7 @@ def make_cache_level(ncaches, prototypes, level, next_cache):
cache.mem_side = xbar.slave
else:
if not next_cache:
- print "Error: No next-level cache at top level"
+ print("Error: No next-level cache at top level")
sys.exit(1)
if ntesters > 1:
@@ -315,4 +317,4 @@ m5.instantiate()
# Simulate until program terminates
exit_event = m5.simulate(options.maxtick)
-print 'Exiting @ tick', m5.curTick(), 'because', exit_event.getCause()
+print('Exiting @ tick', m5.curTick(), 'because', exit_event.getCause())
diff --git a/configs/example/memtest.py b/configs/example/memtest.py
index d6f940e6b..df22609bd 100644
--- a/configs/example/memtest.py
+++ b/configs/example/memtest.py
@@ -39,6 +39,8 @@
# Authors: Ron Dreslinski
# Andreas Hansson
+from __future__ import print_function
+
import optparse
import random
import sys
@@ -107,7 +109,7 @@ parser.add_option("--sys-clock", action="store", type="string",
(options, args) = parser.parse_args()
if args:
- print "Error: script doesn't take any positional arguments"
+ print("Error: script doesn't take any positional arguments")
sys.exit(1)
# Get the total number of testers
@@ -137,41 +139,41 @@ if options.random:
if numtesters(cachespec, testerspec) < block_size:
break
- print "Generated random tree -c", ':'.join(map(str, cachespec)), \
- "-t", ':'.join(map(str, testerspec))
+ print("Generated random tree -c", ':'.join(map(str, cachespec)),
+ "-t", ':'.join(map(str, testerspec)))
else:
try:
cachespec = [int(x) for x in options.caches.split(':')]
testerspec = [int(x) for x in options.testers.split(':')]
except:
- print "Error: Unable to parse caches or testers option"
+ print("Error: Unable to parse caches or testers option")
sys.exit(1)
if len(cachespec) < 1:
- print "Error: Must have at least one level of caches"
+ print("Error: Must have at least one level of caches")
sys.exit(1)
if len(cachespec) != len(testerspec) - 1:
- print "Error: Testers must have one element more than caches"
+ print("Error: Testers must have one element more than caches")
sys.exit(1)
if testerspec[-1] == 0:
- print "Error: Must have testers at the uppermost level"
+ print("Error: Must have testers at the uppermost level")
sys.exit(1)
for t in testerspec:
if t < 0:
- print "Error: Cannot have a negative number of testers"
+ print("Error: Cannot have a negative number of testers")
sys.exit(1)
for c in cachespec:
if c < 1:
- print "Error: Must have 1 or more caches at each level"
+ print("Error: Must have 1 or more caches at each level")
sys.exit(1)
if numtesters(cachespec, testerspec) > block_size:
- print "Error: Limited to %s testers because of false sharing" \
- % (block_size)
+ print("Error: Limited to %s testers because of false sharing"
+ % (block_size))
sys.exit(1)
# Define a prototype L1 cache that we scale for all successive levels
@@ -280,7 +282,7 @@ def make_cache_level(ncaches, prototypes, level, next_cache):
cache.mem_side = xbar.slave
else:
if not next_cache:
- print "Error: No next-level cache at top level"
+ print("Error: No next-level cache at top level")
sys.exit(1)
if ntesters > 1:
@@ -318,4 +320,4 @@ m5.instantiate()
# Simulate until program terminates
exit_event = m5.simulate(options.maxtick)
-print 'Exiting @ tick', m5.curTick(), 'because', exit_event.getCause()
+print('Exiting @ tick', m5.curTick(), 'because', exit_event.getCause())
diff --git a/configs/example/read_config.py b/configs/example/read_config.py
index 7569cd17d..3c17d4b9c 100644
--- a/configs/example/read_config.py
+++ b/configs/example/read_config.py
@@ -45,6 +45,8 @@
# between system construction and run control may allow better
# debugging.
+from __future__ import print_function
+
import argparse
import ConfigParser
import inspect
@@ -540,5 +542,4 @@ mgr.find_all_objects()
m5.instantiate(args.checkpoint_dir)
exit_event = m5.simulate()
-print 'Exiting @ tick %i because %s' % (
- m5.curTick(), exit_event.getCause())
+print('Exiting @ tick %i because %s' % (m5.curTick(), exit_event.getCause()))
diff --git a/configs/example/ruby_direct_test.py b/configs/example/ruby_direct_test.py
index 9e8c87a81..317fb47fd 100644
--- a/configs/example/ruby_direct_test.py
+++ b/configs/example/ruby_direct_test.py
@@ -28,6 +28,8 @@
# Authors: Ron Dreslinski
# Brad Beckmann
+from __future__ import print_function
+
import m5
from m5.objects import *
from m5.defines import buildEnv
@@ -65,7 +67,7 @@ Ruby.define_options(parser)
(options, args) = parser.parse_args()
if args:
- print "Error: script doesn't take any positional arguments"
+ print("Error: script doesn't take any positional arguments")
sys.exit(1)
#
@@ -83,7 +85,7 @@ elif options.test_type == "SeriesGetMixed":
elif options.test_type == "Invalidate":
generator = InvalidateGenerator(num_cpus = options.num_cpus)
else:
- print "Error: unknown direct test generator"
+ print("Error: unknown direct test generator")
sys.exit(1)
# Create the M5 system.
@@ -130,4 +132,4 @@ m5.instantiate()
# simulate until program terminates
exit_event = m5.simulate(options.abs_max_tick)
-print 'Exiting @ tick', m5.curTick(), 'because', exit_event.getCause()
+print('Exiting @ tick', m5.curTick(), 'because', exit_event.getCause())
diff --git a/configs/example/ruby_gpu_random_test.py b/configs/example/ruby_gpu_random_test.py
index 80aecf90e..4f71cd84a 100644
--- a/configs/example/ruby_gpu_random_test.py
+++ b/configs/example/ruby_gpu_random_test.py
@@ -33,6 +33,8 @@
# Author: Brad Beckmann
#
+from __future__ import print_function
+
import m5
from m5.objects import *
from m5.defines import buildEnv
@@ -100,7 +102,7 @@ n_cu = options.num_compute_units
options.num_sqc = int((n_cu + options.cu_per_sqc - 1) / options.cu_per_sqc)
if args:
- print "Error: script doesn't take any positional arguments"
+ print("Error: script doesn't take any positional arguments")
sys.exit(1)
#
@@ -183,4 +185,4 @@ m5.instantiate()
# simulate until program terminates
exit_event = m5.simulate(options.abs_max_tick)
-print 'Exiting @ tick', m5.curTick(), 'because', exit_event.getCause()
+print('Exiting @ tick', m5.curTick(), 'because', exit_event.getCause())
diff --git a/configs/example/ruby_mem_test.py b/configs/example/ruby_mem_test.py
index 010c4a2bc..ab658f787 100644
--- a/configs/example/ruby_mem_test.py
+++ b/configs/example/ruby_mem_test.py
@@ -28,6 +28,8 @@
# Authors: Ron Dreslinski
# Brad Beckmann
+from __future__ import print_function
+
import m5
from m5.objects import *
from m5.defines import buildEnv
@@ -81,14 +83,14 @@ options.l2_assoc=2
options.l3_assoc=2
if args:
- print "Error: script doesn't take any positional arguments"
+ print("Error: script doesn't take any positional arguments")
sys.exit(1)
block_size = 64
if options.num_cpus > block_size:
- print "Error: Number of testers %d limited to %d because of false sharing" \
- % (options.num_cpus, block_size)
+ print("Error: Number of testers %d limited to %d because of false sharing"
+ % (options.num_cpus, block_size))
sys.exit(1)
#
@@ -183,4 +185,4 @@ m5.instantiate()
# simulate until program terminates
exit_event = m5.simulate(options.abs_max_tick)
-print 'Exiting @ tick', m5.curTick(), 'because', exit_event.getCause()
+print('Exiting @ tick', m5.curTick(), 'because', exit_event.getCause())
diff --git a/configs/example/ruby_random_test.py b/configs/example/ruby_random_test.py
index d96905e2c..d6b53cf3e 100644
--- a/configs/example/ruby_random_test.py
+++ b/configs/example/ruby_random_test.py
@@ -28,6 +28,8 @@
# Authors: Ron Dreslinski
# Brad Beckmann
+from __future__ import print_function
+
import m5
from m5.objects import *
from m5.defines import buildEnv
@@ -75,7 +77,7 @@ options.l2_assoc=2
options.l3_assoc=2
if args:
- print "Error: script doesn't take any positional arguments"
+ print("Error: script doesn't take any positional arguments")
sys.exit(1)
#
@@ -156,4 +158,4 @@ m5.instantiate()
# simulate until program terminates
exit_event = m5.simulate(options.abs_max_tick)
-print 'Exiting @ tick', m5.curTick(), 'because', exit_event.getCause()
+print('Exiting @ tick', m5.curTick(), 'because', exit_event.getCause())
diff --git a/configs/example/se.py b/configs/example/se.py
index 56e4753b9..99d79bc57 100644
--- a/configs/example/se.py
+++ b/configs/example/se.py
@@ -42,6 +42,8 @@
#
# "m5 test.py"
+from __future__ import print_function
+
import optparse
import sys
import os
@@ -131,7 +133,7 @@ if '--ruby' in sys.argv:
(options, args) = parser.parse_args()
if args:
- print "Error: script doesn't take any positional arguments"
+ print("Error: script doesn't take any positional arguments")
sys.exit(1)
multiprocesses = []
@@ -140,7 +142,7 @@ numThreads = 1
if options.bench:
apps = options.bench.split("-")
if len(apps) != options.num_cpus:
- print "number of benchmarks not equal to set num_cpus!"
+ print("number of benchmarks not equal to set num_cpus!")
sys.exit(1)
for app in apps:
@@ -156,13 +158,14 @@ if options.bench:
app, options.spec_input))
multiprocesses.append(workload.makeProcess())
except:
- print >>sys.stderr, "Unable to find workload for %s: %s" % (
- buildEnv['TARGET_ISA'], app)
+ print("Unable to find workload for %s: %s" %
+ (buildEnv['TARGET_ISA'], app),
+ file=sys.stderr)
sys.exit(1)
elif options.cmd:
multiprocesses, numThreads = get_processes(options)
else:
- print >> sys.stderr, "No workload specified. Exiting!\n"
+ print("No workload specified. Exiting!\n", file=sys.stderr)
sys.exit(1)