python: Apply Black formatter to Python files
The command executed was `black src configs tests util`. Change-Id: I8dfaa6ab04658fea37618127d6ac19270028d771 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/47024 Maintainer: Bobby Bruce <bbruce@ucdavis.edu> Reviewed-by: Jason Lowe-Power <power.jg@gmail.com> Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
committed by
Giacomo Travaglini
parent
1cfaa8da83
commit
787204c92d
@@ -43,24 +43,22 @@ parser = argparse.ArgumentParser()
|
||||
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")
|
||||
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")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
@@ -72,99 +70,127 @@ if not args.numcpus:
|
||||
# Define Splash2 Benchmarks
|
||||
# ====================
|
||||
class Cholesky(Process):
|
||||
cwd = args.rootdir + '/kernels/cholesky'
|
||||
executable = args.rootdir + '/kernels/cholesky/CHOLESKY'
|
||||
cmd = ['CHOLESKY', '-p' + str(args.numcpus),
|
||||
args.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 = args.rootdir + '/kernels/fft'
|
||||
executable = args.rootdir + '/kernels/fft/FFT'
|
||||
cmd = ['FFT', '-p', str(args.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 = args.rootdir + '/kernels/lu/contiguous_blocks/LU'
|
||||
cmd = ['LU', '-p', str(args.numcpus)]
|
||||
cwd = args.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 = args.rootdir + '/kernels/lu/non_contiguous_blocks/LU'
|
||||
cmd = ['LU', '-p', str(args.numcpus)]
|
||||
cwd = args.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 = args.rootdir + '/kernels/radix/RADIX'
|
||||
cmd = ['RADIX', '-n524288', '-p', str(args.numcpus)]
|
||||
cwd = args.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 = args.rootdir + '/apps/barnes/BARNES'
|
||||
cmd = ['BARNES']
|
||||
input = args.rootdir + '/apps/barnes/input.p' + str(args.numcpus)
|
||||
cwd = args.rootdir + '/apps/barnes'
|
||||
executable = args.rootdir + "/apps/barnes/BARNES"
|
||||
cmd = ["BARNES"]
|
||||
input = args.rootdir + "/apps/barnes/input.p" + str(args.numcpus)
|
||||
cwd = args.rootdir + "/apps/barnes"
|
||||
|
||||
|
||||
class FMM(Process):
|
||||
executable = args.rootdir + '/apps/fmm/FMM'
|
||||
cmd = ['FMM']
|
||||
if str(args.numcpus) == '1':
|
||||
input = args.rootdir + '/apps/fmm/inputs/input.2048'
|
||||
executable = args.rootdir + "/apps/fmm/FMM"
|
||||
cmd = ["FMM"]
|
||||
if str(args.numcpus) == "1":
|
||||
input = args.rootdir + "/apps/fmm/inputs/input.2048"
|
||||
else:
|
||||
input = args.rootdir + '/apps/fmm/inputs/input.2048.p' + str(args.numcpus)
|
||||
cwd = args.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 = args.rootdir + '/apps/ocean/contiguous_partitions/OCEAN'
|
||||
cmd = ['OCEAN', '-p', str(args.numcpus)]
|
||||
cwd = args.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 = args.rootdir + '/apps/ocean/non_contiguous_partitions/OCEAN'
|
||||
cmd = ['OCEAN', '-p', str(args.numcpus)]
|
||||
cwd = args.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 = args.rootdir + '/apps/raytrace/RAYTRACE'
|
||||
cmd = ['RAYTRACE', '-p' + str(args.numcpus),
|
||||
args.rootdir + '/apps/raytrace/inputs/teapot.env']
|
||||
cwd = args.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 = args.rootdir + '/apps/water-nsquared/WATER-NSQUARED'
|
||||
cmd = ['WATER-NSQUARED']
|
||||
if args.numcpus==1:
|
||||
input = args.rootdir + '/apps/water-nsquared/input'
|
||||
executable = args.rootdir + "/apps/water-nsquared/WATER-NSQUARED"
|
||||
cmd = ["WATER-NSQUARED"]
|
||||
if args.numcpus == 1:
|
||||
input = args.rootdir + "/apps/water-nsquared/input"
|
||||
else:
|
||||
input = args.rootdir + '/apps/water-nsquared/input.p' + str(args.numcpus)
|
||||
cwd = args.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 = args.rootdir + '/apps/water-spatial/WATER-SPATIAL'
|
||||
cmd = ['WATER-SPATIAL']
|
||||
if args.numcpus==1:
|
||||
input = args.rootdir + '/apps/water-spatial/input'
|
||||
executable = args.rootdir + "/apps/water-spatial/WATER-SPATIAL"
|
||||
cmd = ["WATER-SPATIAL"]
|
||||
if args.numcpus == 1:
|
||||
input = args.rootdir + "/apps/water-spatial/input"
|
||||
else:
|
||||
input = args.rootdir + '/apps/water-spatial/input.p' + str(args.numcpus)
|
||||
cwd = args.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 = args.l1latency
|
||||
mshrs = 12
|
||||
tgts_per_mshr = 8
|
||||
|
||||
|
||||
# ----------------------
|
||||
# Base L2 Cache Definition
|
||||
# ----------------------
|
||||
|
||||
|
||||
class L2(Cache):
|
||||
latency = args.l2latency
|
||||
mshrs = 92
|
||||
tgts_per_mshr = 16
|
||||
write_buffers = 8
|
||||
|
||||
|
||||
# ----------------------
|
||||
# Define the cpus
|
||||
# ----------------------
|
||||
@@ -172,27 +198,30 @@ class L2(Cache):
|
||||
busFrequency = Frequency(args.frequency)
|
||||
|
||||
if args.timing:
|
||||
cpus = [TimingSimpleCPU(cpu_id = i,
|
||||
clock=args.frequency)
|
||||
for i in range(args.numcpus)]
|
||||
cpus = [
|
||||
TimingSimpleCPU(cpu_id=i, clock=args.frequency)
|
||||
for i in range(args.numcpus)
|
||||
]
|
||||
elif args.detailed:
|
||||
cpus = [DerivO3CPU(cpu_id = i,
|
||||
clock=args.frequency)
|
||||
for i in range(args.numcpus)]
|
||||
cpus = [
|
||||
DerivO3CPU(cpu_id=i, clock=args.frequency) for i in range(args.numcpus)
|
||||
]
|
||||
else:
|
||||
cpus = [AtomicSimpleCPU(cpu_id = i,
|
||||
clock=args.frequency)
|
||||
for i in range(args.numcpus)]
|
||||
cpus = [
|
||||
AtomicSimpleCPU(cpu_id=i, clock=args.frequency)
|
||||
for i in range(args.numcpus)
|
||||
]
|
||||
|
||||
# ----------------------
|
||||
# Create a system, and add system wide objects
|
||||
# ----------------------
|
||||
system = System(cpu = cpus, physmem = SimpleMemory(),
|
||||
membus = SystemXBar(clock = busFrequency))
|
||||
system.clock = '1GHz'
|
||||
system = System(
|
||||
cpu=cpus, physmem=SimpleMemory(), membus=SystemXBar(clock=busFrequency)
|
||||
)
|
||||
system.clock = "1GHz"
|
||||
|
||||
system.toL2bus = L2XBar(clock = busFrequency)
|
||||
system.l2 = L2(size = args.l2size, assoc = 8)
|
||||
system.toL2bus = L2XBar(clock=busFrequency)
|
||||
system.l2 = L2(size=args.l2size, assoc=8)
|
||||
|
||||
# ----------------------
|
||||
# Connect the L2 cache and memory together
|
||||
@@ -207,53 +236,58 @@ system.system_port = system.membus.cpu_side_ports
|
||||
# Connect the L2 cache and clusters together
|
||||
# ----------------------
|
||||
for cpu in cpus:
|
||||
cpu.addPrivateSplitL1Caches(L1(size = args.l1size, assoc = 1),
|
||||
L1(size = args.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.cpu_side_ports,
|
||||
system.membus.cpu_side_ports,
|
||||
system.membus.mem_side_ports)
|
||||
system.membus.mem_side_ports,
|
||||
)
|
||||
|
||||
|
||||
# ----------------------
|
||||
# Define the root
|
||||
# ----------------------
|
||||
|
||||
root = Root(full_system = False, system = system)
|
||||
root = Root(full_system=False, system=system)
|
||||
|
||||
# --------------------
|
||||
# Pick the correct Splash2 Benchmarks
|
||||
# ====================
|
||||
if args.benchmark == 'Cholesky':
|
||||
if args.benchmark == "Cholesky":
|
||||
root.workload = Cholesky()
|
||||
elif args.benchmark == 'FFT':
|
||||
elif args.benchmark == "FFT":
|
||||
root.workload = FFT()
|
||||
elif args.benchmark == 'LUContig':
|
||||
elif args.benchmark == "LUContig":
|
||||
root.workload = LU_contig()
|
||||
elif args.benchmark == 'LUNoncontig':
|
||||
elif args.benchmark == "LUNoncontig":
|
||||
root.workload = LU_noncontig()
|
||||
elif args.benchmark == 'Radix':
|
||||
elif args.benchmark == "Radix":
|
||||
root.workload = Radix()
|
||||
elif args.benchmark == 'Barnes':
|
||||
elif args.benchmark == "Barnes":
|
||||
root.workload = Barnes()
|
||||
elif args.benchmark == 'FMM':
|
||||
elif args.benchmark == "FMM":
|
||||
root.workload = FMM()
|
||||
elif args.benchmark == 'OceanContig':
|
||||
elif args.benchmark == "OceanContig":
|
||||
root.workload = Ocean_contig()
|
||||
elif args.benchmark == 'OceanNoncontig':
|
||||
elif args.benchmark == "OceanNoncontig":
|
||||
root.workload = Ocean_noncontig()
|
||||
elif args.benchmark == 'Raytrace':
|
||||
elif args.benchmark == "Raytrace":
|
||||
root.workload = Raytrace()
|
||||
elif args.benchmark == 'WaterNSquared':
|
||||
elif args.benchmark == "WaterNSquared":
|
||||
root.workload = Water_nsquared()
|
||||
elif args.benchmark == 'WaterSpatial':
|
||||
elif args.benchmark == "WaterSpatial":
|
||||
root.workload = Water_spatial()
|
||||
else:
|
||||
print("The --benchmark environment variable was set to something "
|
||||
"improper. Use Cholesky, FFT, LUContig, LUNoncontig, Radix, "
|
||||
"Barnes, FMM, OceanContig, OceanNoncontig, Raytrace, WaterNSquared, "
|
||||
"or WaterSpatial", file=sys.stderr)
|
||||
print(
|
||||
"The --benchmark environment variable was set to something "
|
||||
"improper. Use Cholesky, FFT, LUContig, LUNoncontig, Radix, "
|
||||
"Barnes, FMM, OceanContig, OceanNoncontig, Raytrace, WaterNSquared, "
|
||||
"or WaterSpatial",
|
||||
file=sys.stderr,
|
||||
)
|
||||
sys.exit(1)
|
||||
|
||||
# --------------------
|
||||
@@ -270,7 +304,7 @@ system.workload = SEWorkload.init_compatible(root.workload.executable)
|
||||
# ----------------------
|
||||
|
||||
if args.timing or args.detailed:
|
||||
root.system.mem_mode = 'timing'
|
||||
root.system.mem_mode = "timing"
|
||||
|
||||
# instantiate configuration
|
||||
m5.instantiate()
|
||||
@@ -281,5 +315,4 @@ if args.maxtick:
|
||||
else:
|
||||
exit_event = m5.simulate(m5.MaxTick)
|
||||
|
||||
print('Exiting @ tick', m5.curTick(), 'because', exit_event.getCause())
|
||||
|
||||
print("Exiting @ tick", m5.curTick(), "because", exit_event.getCause())
|
||||
|
||||
Reference in New Issue
Block a user