configs, tests: Replace optparse with argparse
JIRA: https://gem5.atlassian.net/browse/GEM5-543 Change-Id: I997d6a4e45319a74e21bd0d61d4af6118474c849 Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/44513 Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
@@ -29,7 +29,7 @@
|
||||
# "m5 test.py"
|
||||
|
||||
import os
|
||||
import optparse
|
||||
import argparse
|
||||
import sys
|
||||
|
||||
import m5
|
||||
@@ -39,94 +39,90 @@ from m5.objects import *
|
||||
# Define Command Line Options
|
||||
# ====================
|
||||
|
||||
parser = optparse.OptionParser()
|
||||
parser = argparse.ArgumentParser()
|
||||
|
||||
parser.add_option("-d", "--detailed", action="store_true")
|
||||
parser.add_option("-t", "--timing", action="store_true")
|
||||
parser.add_option("-m", "--maxtick", type="int")
|
||||
parser.add_option("-c", "--numclusters",
|
||||
help="Number of clusters", type="int")
|
||||
parser.add_option("-n", "--numcpus",
|
||||
help="Number of cpus in total", type="int")
|
||||
parser.add_option("-f", "--frequency",
|
||||
default = "1GHz",
|
||||
help="Frequency of each CPU")
|
||||
parser.add_option("--l1size",
|
||||
default = "32kB")
|
||||
parser.add_option("--l1latency",
|
||||
default = 1)
|
||||
parser.add_option("--l2size",
|
||||
default = "256kB")
|
||||
parser.add_option("--l2latency",
|
||||
default = 10)
|
||||
parser.add_option("--rootdir",
|
||||
help="ROot directory of Splash2",
|
||||
default="/dist/splash2/codes/")
|
||||
parser.add_option("-b", "--benchmark",
|
||||
help="Splash 2 benchmark to run")
|
||||
parser.add_argument("-d", "--detailed", action="store_true")
|
||||
parser.add_argument("-t", "--timing", action="store_true")
|
||||
parser.add_argument("-m", "--maxtick", type=int)
|
||||
parser.add_argument("-c", "--numclusters",
|
||||
help="Number of clusters", type=int)
|
||||
parser.add_argument("-n", "--numcpus",
|
||||
help="Number of cpus in total", type=int)
|
||||
parser.add_argument("-f", "--frequency",
|
||||
default = "1GHz",
|
||||
help="Frequency of each CPU")
|
||||
parser.add_argument("--l1size",
|
||||
default = "32kB")
|
||||
parser.add_argument("--l1latency",
|
||||
default = 1)
|
||||
parser.add_argument("--l2size",
|
||||
default = "256kB")
|
||||
parser.add_argument("--l2latency",
|
||||
default = 10)
|
||||
parser.add_argument("--rootdir",
|
||||
help="ROot directory of Splash2",
|
||||
default="/dist/splash2/codes/")
|
||||
parser.add_argument("-b", "--benchmark",
|
||||
help="Splash 2 benchmark to run")
|
||||
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
if args:
|
||||
print("Error: script doesn't take any positional arguments")
|
||||
sys.exit(1)
|
||||
args = parser.parse_args()
|
||||
|
||||
# --------------------
|
||||
# Define Splash2 Benchmarks
|
||||
# ====================
|
||||
class Cholesky(Process):
|
||||
executable = options.rootdir + '/kernels/cholesky/CHOLESKY'
|
||||
cmd = 'CHOLESKY -p' + str(options.numcpus) + ' '\
|
||||
+ options.rootdir + '/kernels/cholesky/inputs/tk23.O'
|
||||
executable = args.rootdir + '/kernels/cholesky/CHOLESKY'
|
||||
cmd = 'CHOLESKY -p' + str(args.numcpus) + ' '\
|
||||
+ args.rootdir + '/kernels/cholesky/inputs/tk23.O'
|
||||
|
||||
class FFT(Process):
|
||||
executable = options.rootdir + 'kernels/fft/FFT'
|
||||
cmd = 'FFT -p' + str(options.numcpus) + ' -m18'
|
||||
executable = args.rootdir + 'kernels/fft/FFT'
|
||||
cmd = 'FFT -p' + str(args.numcpus) + ' -m18'
|
||||
|
||||
class LU_contig(Process):
|
||||
executable = options.rootdir + 'kernels/lu/contiguous_blocks/LU'
|
||||
cmd = 'LU -p' + str(options.numcpus)
|
||||
executable = args.rootdir + 'kernels/lu/contiguous_blocks/LU'
|
||||
cmd = 'LU -p' + str(args.numcpus)
|
||||
|
||||
class LU_noncontig(Process):
|
||||
executable = options.rootdir + 'kernels/lu/non_contiguous_blocks/LU'
|
||||
cmd = 'LU -p' + str(options.numcpus)
|
||||
executable = args.rootdir + 'kernels/lu/non_contiguous_blocks/LU'
|
||||
cmd = 'LU -p' + str(args.numcpus)
|
||||
|
||||
class Radix(Process):
|
||||
executable = options.rootdir + 'kernels/radix/RADIX'
|
||||
cmd = 'RADIX -n524288 -p' + str(options.numcpus)
|
||||
executable = args.rootdir + 'kernels/radix/RADIX'
|
||||
cmd = 'RADIX -n524288 -p' + str(args.numcpus)
|
||||
|
||||
class Barnes(Process):
|
||||
executable = options.rootdir + 'apps/barnes/BARNES'
|
||||
executable = args.rootdir + 'apps/barnes/BARNES'
|
||||
cmd = 'BARNES'
|
||||
input = options.rootdir + 'apps/barnes/input.p' + str(options.numcpus)
|
||||
input = args.rootdir + 'apps/barnes/input.p' + str(args.numcpus)
|
||||
|
||||
class FMM(Process):
|
||||
executable = options.rootdir + 'apps/fmm/FMM'
|
||||
executable = args.rootdir + 'apps/fmm/FMM'
|
||||
cmd = 'FMM'
|
||||
input = options.rootdir + 'apps/fmm/inputs/input.2048.p' + str(options.numcpus)
|
||||
input = args.rootdir + 'apps/fmm/inputs/input.2048.p' + str(args.numcpus)
|
||||
|
||||
class Ocean_contig(Process):
|
||||
executable = options.rootdir + 'apps/ocean/contiguous_partitions/OCEAN'
|
||||
cmd = 'OCEAN -p' + str(options.numcpus)
|
||||
executable = args.rootdir + 'apps/ocean/contiguous_partitions/OCEAN'
|
||||
cmd = 'OCEAN -p' + str(args.numcpus)
|
||||
|
||||
class Ocean_noncontig(Process):
|
||||
executable = options.rootdir + 'apps/ocean/non_contiguous_partitions/OCEAN'
|
||||
cmd = 'OCEAN -p' + str(options.numcpus)
|
||||
executable = args.rootdir + 'apps/ocean/non_contiguous_partitions/OCEAN'
|
||||
cmd = 'OCEAN -p' + str(args.numcpus)
|
||||
|
||||
class Raytrace(Process):
|
||||
executable = options.rootdir + 'apps/raytrace/RAYTRACE'
|
||||
cmd = 'RAYTRACE -p' + str(options.numcpus) + ' ' \
|
||||
+ options.rootdir + 'apps/raytrace/inputs/teapot.env'
|
||||
executable = args.rootdir + 'apps/raytrace/RAYTRACE'
|
||||
cmd = 'RAYTRACE -p' + str(args.numcpus) + ' ' \
|
||||
+ args.rootdir + 'apps/raytrace/inputs/teapot.env'
|
||||
|
||||
class Water_nsquared(Process):
|
||||
executable = options.rootdir + 'apps/water-nsquared/WATER-NSQUARED'
|
||||
executable = args.rootdir + 'apps/water-nsquared/WATER-NSQUARED'
|
||||
cmd = 'WATER-NSQUARED'
|
||||
input = options.rootdir + 'apps/water-nsquared/input.p' + str(options.numcpus)
|
||||
input = args.rootdir + 'apps/water-nsquared/input.p' + str(args.numcpus)
|
||||
|
||||
class Water_spatial(Process):
|
||||
executable = options.rootdir + 'apps/water-spatial/WATER-SPATIAL'
|
||||
executable = args.rootdir + 'apps/water-spatial/WATER-SPATIAL'
|
||||
cmd = 'WATER-SPATIAL'
|
||||
input = options.rootdir + 'apps/water-spatial/input.p' + str(options.numcpus)
|
||||
input = args.rootdir + 'apps/water-spatial/input.p' + str(args.numcpus)
|
||||
|
||||
|
||||
# --------------------
|
||||
@@ -134,7 +130,7 @@ class Water_spatial(Process):
|
||||
# ====================
|
||||
|
||||
class L1(Cache):
|
||||
latency = options.l1latency
|
||||
latency = args.l1latency
|
||||
mshrs = 12
|
||||
tgts_per_mshr = 8
|
||||
|
||||
@@ -143,7 +139,7 @@ class L1(Cache):
|
||||
# ----------------------
|
||||
|
||||
class L2(Cache):
|
||||
latency = options.l2latency
|
||||
latency = args.l2latency
|
||||
mshrs = 92
|
||||
tgts_per_mshr = 16
|
||||
write_buffers = 8
|
||||
@@ -154,52 +150,52 @@ class L2(Cache):
|
||||
class Cluster:
|
||||
pass
|
||||
|
||||
cpusPerCluster = options.numcpus/options.numclusters
|
||||
cpusPerCluster = args.numcpus/args.numclusters
|
||||
|
||||
busFrequency = Frequency(options.frequency)
|
||||
busFrequency = Frequency(args.frequency)
|
||||
busFrequency *= cpusPerCluster
|
||||
|
||||
all_cpus = []
|
||||
all_l1s = []
|
||||
all_l1buses = []
|
||||
if options.timing:
|
||||
clusters = [ Cluster() for i in range(options.numclusters)]
|
||||
for j in range(options.numclusters):
|
||||
if args.timing:
|
||||
clusters = [ Cluster() for i in range(args.numclusters)]
|
||||
for j in range(args.numclusters):
|
||||
clusters[j].id = j
|
||||
for cluster in clusters:
|
||||
cluster.clusterbus = L2XBar(clock=busFrequency)
|
||||
all_l1buses += [cluster.clusterbus]
|
||||
cluster.cpus = [TimingSimpleCPU(cpu_id = i + cluster.id,
|
||||
clock=options.frequency)
|
||||
clock=args.frequency)
|
||||
for i in range(cpusPerCluster)]
|
||||
all_cpus += cluster.cpus
|
||||
cluster.l1 = L1(size=options.l1size, assoc = 4)
|
||||
cluster.l1 = L1(size=args.l1size, assoc = 4)
|
||||
all_l1s += [cluster.l1]
|
||||
elif options.detailed:
|
||||
clusters = [ Cluster() for i in range(options.numclusters)]
|
||||
for j in range(options.numclusters):
|
||||
elif args.detailed:
|
||||
clusters = [ Cluster() for i in range(args.numclusters)]
|
||||
for j in range(args.numclusters):
|
||||
clusters[j].id = j
|
||||
for cluster in clusters:
|
||||
cluster.clusterbus = L2XBar(clock=busFrequency)
|
||||
all_l1buses += [cluster.clusterbus]
|
||||
cluster.cpus = [DerivO3CPU(cpu_id = i + cluster.id,
|
||||
clock=options.frequency)
|
||||
clock=args.frequency)
|
||||
for i in range(cpusPerCluster)]
|
||||
all_cpus += cluster.cpus
|
||||
cluster.l1 = L1(size=options.l1size, assoc = 4)
|
||||
cluster.l1 = L1(size=args.l1size, assoc = 4)
|
||||
all_l1s += [cluster.l1]
|
||||
else:
|
||||
clusters = [ Cluster() for i in range(options.numclusters)]
|
||||
for j in range(options.numclusters):
|
||||
clusters = [ Cluster() for i in range(args.numclusters)]
|
||||
for j in range(args.numclusters):
|
||||
clusters[j].id = j
|
||||
for cluster in clusters:
|
||||
cluster.clusterbus = L2XBar(clock=busFrequency)
|
||||
all_l1buses += [cluster.clusterbus]
|
||||
cluster.cpus = [AtomicSimpleCPU(cpu_id = i + cluster.id,
|
||||
clock=options.frequency)
|
||||
clock=args.frequency)
|
||||
for i in range(cpusPerCluster)]
|
||||
all_cpus += cluster.cpus
|
||||
cluster.l1 = L1(size=options.l1size, assoc = 4)
|
||||
cluster.l1 = L1(size=args.l1size, assoc = 4)
|
||||
all_l1s += [cluster.l1]
|
||||
|
||||
# ----------------------
|
||||
@@ -211,7 +207,7 @@ system = System(cpu = all_cpus, l1_ = all_l1s, l1bus_ = all_l1buses,
|
||||
system.clock = '1GHz'
|
||||
|
||||
system.toL2bus = L2XBar(clock = busFrequency)
|
||||
system.l2 = L2(size = options.l2size, assoc = 8)
|
||||
system.l2 = L2(size = args.l2size, assoc = 8)
|
||||
|
||||
# ----------------------
|
||||
# Connect the L2 cache and memory together
|
||||
@@ -240,29 +236,29 @@ root = Root(full_system = False, system = system)
|
||||
# --------------------
|
||||
# Pick the correct Splash2 Benchmarks
|
||||
# ====================
|
||||
if options.benchmark == 'Cholesky':
|
||||
if args.benchmark == 'Cholesky':
|
||||
root.workload = Cholesky()
|
||||
elif options.benchmark == 'FFT':
|
||||
elif args.benchmark == 'FFT':
|
||||
root.workload = FFT()
|
||||
elif options.benchmark == 'LUContig':
|
||||
elif args.benchmark == 'LUContig':
|
||||
root.workload = LU_contig()
|
||||
elif options.benchmark == 'LUNoncontig':
|
||||
elif args.benchmark == 'LUNoncontig':
|
||||
root.workload = LU_noncontig()
|
||||
elif options.benchmark == 'Radix':
|
||||
elif args.benchmark == 'Radix':
|
||||
root.workload = Radix()
|
||||
elif options.benchmark == 'Barnes':
|
||||
elif args.benchmark == 'Barnes':
|
||||
root.workload = Barnes()
|
||||
elif options.benchmark == 'FMM':
|
||||
elif args.benchmark == 'FMM':
|
||||
root.workload = FMM()
|
||||
elif options.benchmark == 'OceanContig':
|
||||
elif args.benchmark == 'OceanContig':
|
||||
root.workload = Ocean_contig()
|
||||
elif options.benchmark == 'OceanNoncontig':
|
||||
elif args.benchmark == 'OceanNoncontig':
|
||||
root.workload = Ocean_noncontig()
|
||||
elif options.benchmark == 'Raytrace':
|
||||
elif args.benchmark == 'Raytrace':
|
||||
root.workload = Raytrace()
|
||||
elif options.benchmark == 'WaterNSquared':
|
||||
elif args.benchmark == 'WaterNSquared':
|
||||
root.workload = Water_nsquared()
|
||||
elif options.benchmark == 'WaterSpatial':
|
||||
elif args.benchmark == 'WaterSpatial':
|
||||
root.workload = Water_spatial()
|
||||
else:
|
||||
m5.util.panic("""
|
||||
@@ -285,15 +281,15 @@ system.workload = SEWorkload.init_compatible(root.workload.executable)
|
||||
# Run the simulation
|
||||
# ----------------------
|
||||
|
||||
if options.timing or options.detailed:
|
||||
if args.timing or args.detailed:
|
||||
root.system.mem_mode = 'timing'
|
||||
|
||||
# instantiate configuration
|
||||
m5.instantiate()
|
||||
|
||||
# simulate until program terminates
|
||||
if options.maxtick:
|
||||
exit_event = m5.simulate(options.maxtick)
|
||||
if args.maxtick:
|
||||
exit_event = m5.simulate(args.maxtick)
|
||||
else:
|
||||
exit_event = m5.simulate(m5.MaxTick)
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#
|
||||
|
||||
import os
|
||||
import optparse
|
||||
import argparse
|
||||
import sys
|
||||
|
||||
import m5
|
||||
@@ -38,37 +38,33 @@ from m5.objects import *
|
||||
# Define Command Line Options
|
||||
# ====================
|
||||
|
||||
parser = optparse.OptionParser()
|
||||
parser = argparse.ArgumentParser()
|
||||
|
||||
parser.add_option("-d", "--detailed", action="store_true")
|
||||
parser.add_option("-t", "--timing", action="store_true")
|
||||
parser.add_option("-m", "--maxtick", type="int")
|
||||
parser.add_option("-n", "--numcpus",
|
||||
help="Number of cpus in total", type="int")
|
||||
parser.add_option("-f", "--frequency",
|
||||
default = "1GHz",
|
||||
help="Frequency of each CPU")
|
||||
parser.add_option("--l1size",
|
||||
default = "32kB")
|
||||
parser.add_option("--l1latency",
|
||||
default = "1ns")
|
||||
parser.add_option("--l2size",
|
||||
default = "256kB")
|
||||
parser.add_option("--l2latency",
|
||||
default = "10ns")
|
||||
parser.add_option("--rootdir",
|
||||
help="Root directory of Splash2",
|
||||
default="/dist/splash2/codes")
|
||||
parser.add_option("-b", "--benchmark",
|
||||
help="Splash 2 benchmark to run")
|
||||
parser.add_argument("-d", "--detailed", action="store_true")
|
||||
parser.add_argument("-t", "--timing", action="store_true")
|
||||
parser.add_argument("-m", "--maxtick", type=int)
|
||||
parser.add_argument("-n", "--numcpus",
|
||||
help="Number of cpus in total", type=int)
|
||||
parser.add_argument("-f", "--frequency",
|
||||
default = "1GHz",
|
||||
help="Frequency of each CPU")
|
||||
parser.add_argument("--l1size",
|
||||
default = "32kB")
|
||||
parser.add_argument("--l1latency",
|
||||
default = "1ns")
|
||||
parser.add_argument("--l2size",
|
||||
default = "256kB")
|
||||
parser.add_argument("--l2latency",
|
||||
default = "10ns")
|
||||
parser.add_argument("--rootdir",
|
||||
help="Root directory of Splash2",
|
||||
default="/dist/splash2/codes")
|
||||
parser.add_argument("-b", "--benchmark",
|
||||
help="Splash 2 benchmark to run")
|
||||
|
||||
(options, args) = parser.parse_args()
|
||||
args = parser.parse_args()
|
||||
|
||||
if args:
|
||||
print("Error: script doesn't take any positional arguments")
|
||||
sys.exit(1)
|
||||
|
||||
if not options.numcpus:
|
||||
if not args.numcpus:
|
||||
print("Specify the number of cpus with -n")
|
||||
sys.exit(1)
|
||||
|
||||
@@ -76,86 +72,86 @@ if not options.numcpus:
|
||||
# Define Splash2 Benchmarks
|
||||
# ====================
|
||||
class Cholesky(Process):
|
||||
cwd = options.rootdir + '/kernels/cholesky'
|
||||
executable = options.rootdir + '/kernels/cholesky/CHOLESKY'
|
||||
cmd = ['CHOLESKY', '-p' + str(options.numcpus),
|
||||
options.rootdir + '/kernels/cholesky/inputs/tk23.O']
|
||||
cwd = args.rootdir + '/kernels/cholesky'
|
||||
executable = args.rootdir + '/kernels/cholesky/CHOLESKY'
|
||||
cmd = ['CHOLESKY', '-p' + str(args.numcpus),
|
||||
args.rootdir + '/kernels/cholesky/inputs/tk23.O']
|
||||
|
||||
class FFT(Process):
|
||||
cwd = options.rootdir + '/kernels/fft'
|
||||
executable = options.rootdir + '/kernels/fft/FFT'
|
||||
cmd = ['FFT', '-p', str(options.numcpus), '-m18']
|
||||
cwd = args.rootdir + '/kernels/fft'
|
||||
executable = args.rootdir + '/kernels/fft/FFT'
|
||||
cmd = ['FFT', '-p', str(args.numcpus), '-m18']
|
||||
|
||||
class LU_contig(Process):
|
||||
executable = options.rootdir + '/kernels/lu/contiguous_blocks/LU'
|
||||
cmd = ['LU', '-p', str(options.numcpus)]
|
||||
cwd = options.rootdir + '/kernels/lu/contiguous_blocks'
|
||||
executable = args.rootdir + '/kernels/lu/contiguous_blocks/LU'
|
||||
cmd = ['LU', '-p', str(args.numcpus)]
|
||||
cwd = args.rootdir + '/kernels/lu/contiguous_blocks'
|
||||
|
||||
class LU_noncontig(Process):
|
||||
executable = options.rootdir + '/kernels/lu/non_contiguous_blocks/LU'
|
||||
cmd = ['LU', '-p', str(options.numcpus)]
|
||||
cwd = options.rootdir + '/kernels/lu/non_contiguous_blocks'
|
||||
executable = args.rootdir + '/kernels/lu/non_contiguous_blocks/LU'
|
||||
cmd = ['LU', '-p', str(args.numcpus)]
|
||||
cwd = args.rootdir + '/kernels/lu/non_contiguous_blocks'
|
||||
|
||||
class Radix(Process):
|
||||
executable = options.rootdir + '/kernels/radix/RADIX'
|
||||
cmd = ['RADIX', '-n524288', '-p', str(options.numcpus)]
|
||||
cwd = options.rootdir + '/kernels/radix'
|
||||
executable = args.rootdir + '/kernels/radix/RADIX'
|
||||
cmd = ['RADIX', '-n524288', '-p', str(args.numcpus)]
|
||||
cwd = args.rootdir + '/kernels/radix'
|
||||
|
||||
class Barnes(Process):
|
||||
executable = options.rootdir + '/apps/barnes/BARNES'
|
||||
executable = args.rootdir + '/apps/barnes/BARNES'
|
||||
cmd = ['BARNES']
|
||||
input = options.rootdir + '/apps/barnes/input.p' + str(options.numcpus)
|
||||
cwd = options.rootdir + '/apps/barnes'
|
||||
input = args.rootdir + '/apps/barnes/input.p' + str(args.numcpus)
|
||||
cwd = args.rootdir + '/apps/barnes'
|
||||
|
||||
class FMM(Process):
|
||||
executable = options.rootdir + '/apps/fmm/FMM'
|
||||
executable = args.rootdir + '/apps/fmm/FMM'
|
||||
cmd = ['FMM']
|
||||
if str(options.numcpus) == '1':
|
||||
input = options.rootdir + '/apps/fmm/inputs/input.2048'
|
||||
if str(args.numcpus) == '1':
|
||||
input = args.rootdir + '/apps/fmm/inputs/input.2048'
|
||||
else:
|
||||
input = options.rootdir + '/apps/fmm/inputs/input.2048.p' + str(options.numcpus)
|
||||
cwd = options.rootdir + '/apps/fmm'
|
||||
input = args.rootdir + '/apps/fmm/inputs/input.2048.p' + str(args.numcpus)
|
||||
cwd = args.rootdir + '/apps/fmm'
|
||||
|
||||
class Ocean_contig(Process):
|
||||
executable = options.rootdir + '/apps/ocean/contiguous_partitions/OCEAN'
|
||||
cmd = ['OCEAN', '-p', str(options.numcpus)]
|
||||
cwd = options.rootdir + '/apps/ocean/contiguous_partitions'
|
||||
executable = args.rootdir + '/apps/ocean/contiguous_partitions/OCEAN'
|
||||
cmd = ['OCEAN', '-p', str(args.numcpus)]
|
||||
cwd = args.rootdir + '/apps/ocean/contiguous_partitions'
|
||||
|
||||
class Ocean_noncontig(Process):
|
||||
executable = options.rootdir + '/apps/ocean/non_contiguous_partitions/OCEAN'
|
||||
cmd = ['OCEAN', '-p', str(options.numcpus)]
|
||||
cwd = options.rootdir + '/apps/ocean/non_contiguous_partitions'
|
||||
executable = args.rootdir + '/apps/ocean/non_contiguous_partitions/OCEAN'
|
||||
cmd = ['OCEAN', '-p', str(args.numcpus)]
|
||||
cwd = args.rootdir + '/apps/ocean/non_contiguous_partitions'
|
||||
|
||||
class Raytrace(Process):
|
||||
executable = options.rootdir + '/apps/raytrace/RAYTRACE'
|
||||
cmd = ['RAYTRACE', '-p' + str(options.numcpus),
|
||||
options.rootdir + '/apps/raytrace/inputs/teapot.env']
|
||||
cwd = options.rootdir + '/apps/raytrace'
|
||||
executable = args.rootdir + '/apps/raytrace/RAYTRACE'
|
||||
cmd = ['RAYTRACE', '-p' + str(args.numcpus),
|
||||
args.rootdir + '/apps/raytrace/inputs/teapot.env']
|
||||
cwd = args.rootdir + '/apps/raytrace'
|
||||
|
||||
class Water_nsquared(Process):
|
||||
executable = options.rootdir + '/apps/water-nsquared/WATER-NSQUARED'
|
||||
executable = args.rootdir + '/apps/water-nsquared/WATER-NSQUARED'
|
||||
cmd = ['WATER-NSQUARED']
|
||||
if options.numcpus==1:
|
||||
input = options.rootdir + '/apps/water-nsquared/input'
|
||||
if args.numcpus==1:
|
||||
input = args.rootdir + '/apps/water-nsquared/input'
|
||||
else:
|
||||
input = options.rootdir + '/apps/water-nsquared/input.p' + str(options.numcpus)
|
||||
cwd = options.rootdir + '/apps/water-nsquared'
|
||||
input = args.rootdir + '/apps/water-nsquared/input.p' + str(args.numcpus)
|
||||
cwd = args.rootdir + '/apps/water-nsquared'
|
||||
|
||||
class Water_spatial(Process):
|
||||
executable = options.rootdir + '/apps/water-spatial/WATER-SPATIAL'
|
||||
executable = args.rootdir + '/apps/water-spatial/WATER-SPATIAL'
|
||||
cmd = ['WATER-SPATIAL']
|
||||
if options.numcpus==1:
|
||||
input = options.rootdir + '/apps/water-spatial/input'
|
||||
if args.numcpus==1:
|
||||
input = args.rootdir + '/apps/water-spatial/input'
|
||||
else:
|
||||
input = options.rootdir + '/apps/water-spatial/input.p' + str(options.numcpus)
|
||||
cwd = options.rootdir + '/apps/water-spatial'
|
||||
input = args.rootdir + '/apps/water-spatial/input.p' + str(args.numcpus)
|
||||
cwd = args.rootdir + '/apps/water-spatial'
|
||||
|
||||
# --------------------
|
||||
# Base L1 Cache Definition
|
||||
# ====================
|
||||
|
||||
class L1(Cache):
|
||||
latency = options.l1latency
|
||||
latency = args.l1latency
|
||||
mshrs = 12
|
||||
tgts_per_mshr = 8
|
||||
|
||||
@@ -164,7 +160,7 @@ class L1(Cache):
|
||||
# ----------------------
|
||||
|
||||
class L2(Cache):
|
||||
latency = options.l2latency
|
||||
latency = args.l2latency
|
||||
mshrs = 92
|
||||
tgts_per_mshr = 16
|
||||
write_buffers = 8
|
||||
@@ -173,20 +169,20 @@ class L2(Cache):
|
||||
# Define the cpus
|
||||
# ----------------------
|
||||
|
||||
busFrequency = Frequency(options.frequency)
|
||||
busFrequency = Frequency(args.frequency)
|
||||
|
||||
if options.timing:
|
||||
if args.timing:
|
||||
cpus = [TimingSimpleCPU(cpu_id = i,
|
||||
clock=options.frequency)
|
||||
for i in range(options.numcpus)]
|
||||
elif options.detailed:
|
||||
clock=args.frequency)
|
||||
for i in range(args.numcpus)]
|
||||
elif args.detailed:
|
||||
cpus = [DerivO3CPU(cpu_id = i,
|
||||
clock=options.frequency)
|
||||
for i in range(options.numcpus)]
|
||||
clock=args.frequency)
|
||||
for i in range(args.numcpus)]
|
||||
else:
|
||||
cpus = [AtomicSimpleCPU(cpu_id = i,
|
||||
clock=options.frequency)
|
||||
for i in range(options.numcpus)]
|
||||
clock=args.frequency)
|
||||
for i in range(args.numcpus)]
|
||||
|
||||
# ----------------------
|
||||
# Create a system, and add system wide objects
|
||||
@@ -196,7 +192,7 @@ system = System(cpu = cpus, physmem = SimpleMemory(),
|
||||
system.clock = '1GHz'
|
||||
|
||||
system.toL2bus = L2XBar(clock = busFrequency)
|
||||
system.l2 = L2(size = options.l2size, assoc = 8)
|
||||
system.l2 = L2(size = args.l2size, assoc = 8)
|
||||
|
||||
# ----------------------
|
||||
# Connect the L2 cache and memory together
|
||||
@@ -211,8 +207,8 @@ system.system_port = system.membus.slave
|
||||
# Connect the L2 cache and clusters together
|
||||
# ----------------------
|
||||
for cpu in cpus:
|
||||
cpu.addPrivateSplitL1Caches(L1(size = options.l1size, assoc = 1),
|
||||
L1(size = options.l1size, assoc = 4))
|
||||
cpu.addPrivateSplitL1Caches(L1(size = args.l1size, assoc = 1),
|
||||
L1(size = args.l1size, assoc = 4))
|
||||
# connect cpu level-1 caches to shared level-2 cache
|
||||
cpu.connectAllPorts(system.toL2bus, system.membus)
|
||||
|
||||
@@ -226,29 +222,29 @@ root = Root(full_system = False, system = system)
|
||||
# --------------------
|
||||
# Pick the correct Splash2 Benchmarks
|
||||
# ====================
|
||||
if options.benchmark == 'Cholesky':
|
||||
if args.benchmark == 'Cholesky':
|
||||
root.workload = Cholesky()
|
||||
elif options.benchmark == 'FFT':
|
||||
elif args.benchmark == 'FFT':
|
||||
root.workload = FFT()
|
||||
elif options.benchmark == 'LUContig':
|
||||
elif args.benchmark == 'LUContig':
|
||||
root.workload = LU_contig()
|
||||
elif options.benchmark == 'LUNoncontig':
|
||||
elif args.benchmark == 'LUNoncontig':
|
||||
root.workload = LU_noncontig()
|
||||
elif options.benchmark == 'Radix':
|
||||
elif args.benchmark == 'Radix':
|
||||
root.workload = Radix()
|
||||
elif options.benchmark == 'Barnes':
|
||||
elif args.benchmark == 'Barnes':
|
||||
root.workload = Barnes()
|
||||
elif options.benchmark == 'FMM':
|
||||
elif args.benchmark == 'FMM':
|
||||
root.workload = FMM()
|
||||
elif options.benchmark == 'OceanContig':
|
||||
elif args.benchmark == 'OceanContig':
|
||||
root.workload = Ocean_contig()
|
||||
elif options.benchmark == 'OceanNoncontig':
|
||||
elif args.benchmark == 'OceanNoncontig':
|
||||
root.workload = Ocean_noncontig()
|
||||
elif options.benchmark == 'Raytrace':
|
||||
elif args.benchmark == 'Raytrace':
|
||||
root.workload = Raytrace()
|
||||
elif options.benchmark == 'WaterNSquared':
|
||||
elif args.benchmark == 'WaterNSquared':
|
||||
root.workload = Water_nsquared()
|
||||
elif options.benchmark == 'WaterSpatial':
|
||||
elif args.benchmark == 'WaterSpatial':
|
||||
root.workload = Water_spatial()
|
||||
else:
|
||||
print("The --benchmark environment variable was set to something "
|
||||
@@ -270,15 +266,15 @@ system.workload = SEWorkload.init_compatible(root.workload.executable)
|
||||
# Run the simulation
|
||||
# ----------------------
|
||||
|
||||
if options.timing or options.detailed:
|
||||
if args.timing or args.detailed:
|
||||
root.system.mem_mode = 'timing'
|
||||
|
||||
# instantiate configuration
|
||||
m5.instantiate()
|
||||
|
||||
# simulate until program terminates
|
||||
if options.maxtick:
|
||||
exit_event = m5.simulate(options.maxtick)
|
||||
if args.maxtick:
|
||||
exit_event = m5.simulate(args.maxtick)
|
||||
else:
|
||||
exit_event = m5.simulate(m5.MaxTick)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user