2007-04-23 22:03:53 +02:00
|
|
|
# Copyright (c) 2005-2007 The Regents of The University of Michigan
|
2005-06-01 23:08:45 +02:00
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# Redistribution and use in source and binary forms, with or without
|
|
|
|
# modification, are permitted provided that the following conditions are
|
|
|
|
# met: redistributions of source code must retain the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer;
|
|
|
|
# redistributions in binary form must reproduce the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer in the
|
|
|
|
# documentation and/or other materials provided with the distribution;
|
|
|
|
# neither the name of the copyright holders nor the names of its
|
|
|
|
# contributors may be used to endorse or promote products derived from
|
|
|
|
# this software without specific prior written permission.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
#
|
|
|
|
# Authors: Ron Dreslinski
|
|
|
|
|
2006-10-21 01:53:52 +02:00
|
|
|
# Splash2 Run Script
|
|
|
|
#
|
|
|
|
|
2009-09-23 00:24:16 +02:00
|
|
|
import os
|
|
|
|
import optparse
|
|
|
|
import sys
|
|
|
|
|
2006-10-21 01:53:52 +02:00
|
|
|
import m5
|
|
|
|
from m5.objects import *
|
2009-09-23 00:24:16 +02:00
|
|
|
|
|
|
|
m5.util.addToPath('../common')
|
2006-10-21 01:53:52 +02:00
|
|
|
|
|
|
|
# --------------------
|
|
|
|
# Define Command Line Options
|
|
|
|
# ====================
|
|
|
|
|
|
|
|
parser = optparse.OptionParser()
|
|
|
|
|
|
|
|
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",
|
2006-10-21 03:13:10 +02:00
|
|
|
default = "1GHz",
|
2006-10-21 01:53:52 +02:00
|
|
|
help="Frequency of each CPU")
|
2006-10-21 03:13:10 +02:00
|
|
|
parser.add_option("--l1size",
|
|
|
|
default = "32kB")
|
|
|
|
parser.add_option("--l1latency",
|
2007-11-15 09:51:28 +01:00
|
|
|
default = "1ns")
|
2006-10-21 03:13:10 +02:00
|
|
|
parser.add_option("--l2size",
|
|
|
|
default = "256kB")
|
|
|
|
parser.add_option("--l2latency",
|
2007-11-15 09:51:28 +01:00
|
|
|
default = "10ns")
|
2006-10-21 01:53:52 +02:00
|
|
|
parser.add_option("--rootdir",
|
2007-04-23 22:03:53 +02:00
|
|
|
help="Root directory of Splash2",
|
2006-10-21 03:13:10 +02:00
|
|
|
default="/dist/splash2/codes")
|
2006-10-21 01:53:52 +02:00
|
|
|
parser.add_option("-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)
|
|
|
|
|
2006-10-21 03:13:10 +02:00
|
|
|
if not options.numcpus:
|
|
|
|
print "Specify the number of cpus with -n"
|
|
|
|
sys.exit(1)
|
|
|
|
|
2006-10-21 01:53:52 +02:00
|
|
|
# --------------------
|
|
|
|
# Define Splash2 Benchmarks
|
|
|
|
# ====================
|
|
|
|
class Cholesky(LiveProcess):
|
2007-04-23 22:03:53 +02:00
|
|
|
cwd = options.rootdir + '/kernels/cholesky'
|
|
|
|
executable = options.rootdir + '/kernels/cholesky/CHOLESKY'
|
2007-11-15 18:58:06 +01:00
|
|
|
cmd = ['CHOLESKY', '-p' + str(options.numcpus),
|
2007-11-15 09:51:28 +01:00
|
|
|
options.rootdir + '/kernels/cholesky/inputs/tk23.O']
|
2006-10-21 01:53:52 +02:00
|
|
|
|
|
|
|
class FFT(LiveProcess):
|
2007-04-23 22:03:53 +02:00
|
|
|
cwd = options.rootdir + '/kernels/fft'
|
|
|
|
executable = options.rootdir + '/kernels/fft/FFT'
|
2007-11-15 09:51:28 +01:00
|
|
|
cmd = ['FFT', '-p', str(options.numcpus), '-m18']
|
2006-10-21 01:53:52 +02:00
|
|
|
|
|
|
|
class LU_contig(LiveProcess):
|
2007-04-23 22:03:53 +02:00
|
|
|
executable = options.rootdir + '/kernels/lu/contiguous_blocks/LU'
|
2007-11-15 09:51:28 +01:00
|
|
|
cmd = ['LU', '-p', str(options.numcpus)]
|
2007-04-23 22:03:53 +02:00
|
|
|
cwd = options.rootdir + '/kernels/lu/contiguous_blocks'
|
2006-10-21 01:53:52 +02:00
|
|
|
|
|
|
|
class LU_noncontig(LiveProcess):
|
2007-04-23 22:03:53 +02:00
|
|
|
executable = options.rootdir + '/kernels/lu/non_contiguous_blocks/LU'
|
2007-11-15 09:51:28 +01:00
|
|
|
cmd = ['LU', '-p', str(options.numcpus)]
|
2007-04-23 22:03:53 +02:00
|
|
|
cwd = options.rootdir + '/kernels/lu/non_contiguous_blocks'
|
2006-10-21 01:53:52 +02:00
|
|
|
|
|
|
|
class Radix(LiveProcess):
|
2007-04-23 22:03:53 +02:00
|
|
|
executable = options.rootdir + '/kernels/radix/RADIX'
|
2007-11-15 09:51:28 +01:00
|
|
|
cmd = ['RADIX', '-n524288', '-p', str(options.numcpus)]
|
2007-04-23 22:03:53 +02:00
|
|
|
cwd = options.rootdir + '/kernels/radix'
|
2006-10-21 01:53:52 +02:00
|
|
|
|
|
|
|
class Barnes(LiveProcess):
|
2007-04-23 22:03:53 +02:00
|
|
|
executable = options.rootdir + '/apps/barnes/BARNES'
|
2007-11-15 09:51:28 +01:00
|
|
|
cmd = ['BARNES']
|
2007-04-23 22:03:53 +02:00
|
|
|
input = options.rootdir + '/apps/barnes/input.p' + str(options.numcpus)
|
|
|
|
cwd = options.rootdir + '/apps/barnes'
|
2006-10-21 01:53:52 +02:00
|
|
|
|
|
|
|
class FMM(LiveProcess):
|
2007-04-23 22:03:53 +02:00
|
|
|
executable = options.rootdir + '/apps/fmm/FMM'
|
2007-11-15 09:51:28 +01:00
|
|
|
cmd = ['FMM']
|
2007-04-23 22:03:53 +02:00
|
|
|
if str(options.numcpus) == '1':
|
|
|
|
input = options.rootdir + '/apps/fmm/inputs/input.2048'
|
|
|
|
else:
|
2006-10-21 03:13:10 +02:00
|
|
|
input = options.rootdir + '/apps/fmm/inputs/input.2048.p' + str(options.numcpus)
|
2007-04-23 22:03:53 +02:00
|
|
|
cwd = options.rootdir + '/apps/fmm'
|
2006-10-21 01:53:52 +02:00
|
|
|
|
|
|
|
class Ocean_contig(LiveProcess):
|
2007-04-23 22:03:53 +02:00
|
|
|
executable = options.rootdir + '/apps/ocean/contiguous_partitions/OCEAN'
|
2007-11-15 09:51:28 +01:00
|
|
|
cmd = ['OCEAN', '-p', str(options.numcpus)]
|
2007-04-23 22:03:53 +02:00
|
|
|
cwd = options.rootdir + '/apps/ocean/contiguous_partitions'
|
2006-10-21 01:53:52 +02:00
|
|
|
|
|
|
|
class Ocean_noncontig(LiveProcess):
|
2007-04-23 22:03:53 +02:00
|
|
|
executable = options.rootdir + '/apps/ocean/non_contiguous_partitions/OCEAN'
|
2007-11-15 09:51:28 +01:00
|
|
|
cmd = ['OCEAN', '-p', str(options.numcpus)]
|
2007-04-23 22:03:53 +02:00
|
|
|
cwd = options.rootdir + '/apps/ocean/non_contiguous_partitions'
|
2006-10-21 01:53:52 +02:00
|
|
|
|
|
|
|
class Raytrace(LiveProcess):
|
2007-04-23 22:03:53 +02:00
|
|
|
executable = options.rootdir + '/apps/raytrace/RAYTRACE'
|
2007-11-15 18:58:06 +01:00
|
|
|
cmd = ['RAYTRACE', '-p' + str(options.numcpus),
|
2007-11-15 09:51:28 +01:00
|
|
|
options.rootdir + '/apps/raytrace/inputs/teapot.env']
|
2007-04-23 22:03:53 +02:00
|
|
|
cwd = options.rootdir + '/apps/raytrace'
|
2006-10-21 01:53:52 +02:00
|
|
|
|
|
|
|
class Water_nsquared(LiveProcess):
|
2007-04-23 22:03:53 +02:00
|
|
|
executable = options.rootdir + '/apps/water-nsquared/WATER-NSQUARED'
|
2007-11-15 09:51:28 +01:00
|
|
|
cmd = ['WATER-NSQUARED']
|
2007-04-23 22:03:53 +02:00
|
|
|
if options.numcpus==1:
|
|
|
|
input = options.rootdir + '/apps/water-nsquared/input'
|
|
|
|
else:
|
2006-10-21 03:13:10 +02:00
|
|
|
input = options.rootdir + '/apps/water-nsquared/input.p' + str(options.numcpus)
|
2007-04-23 22:03:53 +02:00
|
|
|
cwd = options.rootdir + '/apps/water-nsquared'
|
2006-10-21 01:53:52 +02:00
|
|
|
|
|
|
|
class Water_spatial(LiveProcess):
|
2007-04-23 22:03:53 +02:00
|
|
|
executable = options.rootdir + '/apps/water-spatial/WATER-SPATIAL'
|
2007-11-15 09:51:28 +01:00
|
|
|
cmd = ['WATER-SPATIAL']
|
2007-04-23 22:03:53 +02:00
|
|
|
if options.numcpus==1:
|
|
|
|
input = options.rootdir + '/apps/water-spatial/input'
|
|
|
|
else:
|
2006-10-21 03:13:10 +02:00
|
|
|
input = options.rootdir + '/apps/water-spatial/input.p' + str(options.numcpus)
|
2007-04-23 22:03:53 +02:00
|
|
|
cwd = options.rootdir + '/apps/water-spatial'
|
2006-10-21 01:53:52 +02:00
|
|
|
|
|
|
|
# --------------------
|
|
|
|
# Base L1 Cache Definition
|
|
|
|
# ====================
|
|
|
|
|
|
|
|
class L1(BaseCache):
|
|
|
|
latency = options.l1latency
|
|
|
|
mshrs = 12
|
|
|
|
tgts_per_mshr = 8
|
|
|
|
|
|
|
|
# ----------------------
|
|
|
|
# Base L2 Cache Definition
|
|
|
|
# ----------------------
|
|
|
|
|
|
|
|
class L2(BaseCache):
|
|
|
|
latency = options.l2latency
|
|
|
|
mshrs = 92
|
|
|
|
tgts_per_mshr = 16
|
|
|
|
write_buffers = 8
|
|
|
|
|
|
|
|
# ----------------------
|
|
|
|
# Define the cpus
|
|
|
|
# ----------------------
|
|
|
|
|
|
|
|
busFrequency = Frequency(options.frequency)
|
|
|
|
|
|
|
|
if options.timing:
|
|
|
|
cpus = [TimingSimpleCPU(cpu_id = i,
|
|
|
|
clock=options.frequency)
|
|
|
|
for i in xrange(options.numcpus)]
|
|
|
|
elif options.detailed:
|
|
|
|
cpus = [DerivO3CPU(cpu_id = i,
|
|
|
|
clock=options.frequency)
|
|
|
|
for i in xrange(options.numcpus)]
|
Added config files for splash2 benchmarks. Parameters:
ROOTDIR = root directory of the splash2 code
NP = number of proccessors
BENCHMARK = name of the splash2 benchmark (Cholesky, FFT, LUContig, LUNoncontig, Radix, Barnes, FMM, OceanContig, OceanNoncontig, Raytrace, WaterNSquared, or WaterSpatial)
SYSTEM = Type of system to simulate detailed or simple
Note: They use MOESI protocol and do_events is enabled (Multiple L1's and a shared L2)
--HG--
extra : convert_revision : c39aa73825ea8108b6c32abd4a4fa4c23391ab09
2005-03-12 00:07:07 +01:00
|
|
|
else:
|
2006-10-21 01:53:52 +02:00
|
|
|
cpus = [AtomicSimpleCPU(cpu_id = i,
|
|
|
|
clock=options.frequency)
|
|
|
|
for i in xrange(options.numcpus)]
|
|
|
|
|
|
|
|
# ----------------------
|
|
|
|
# Create a system, and add system wide objects
|
|
|
|
# ----------------------
|
2012-04-06 19:46:31 +02:00
|
|
|
system = System(cpu = cpus, physmem = SimpleMemory(),
|
2014-09-20 23:18:32 +02:00
|
|
|
membus = CoherentXBar(clock = busFrequency))
|
2013-06-27 11:49:49 +02:00
|
|
|
system.clock = '1GHz'
|
2006-10-21 01:53:52 +02:00
|
|
|
|
2014-09-20 23:18:32 +02:00
|
|
|
system.toL2bus = CoherentXBar(clock = busFrequency)
|
2006-10-21 01:53:52 +02:00
|
|
|
system.l2 = L2(size = options.l2size, assoc = 8)
|
|
|
|
|
|
|
|
# ----------------------
|
|
|
|
# Connect the L2 cache and memory together
|
|
|
|
# ----------------------
|
|
|
|
|
2012-02-14 20:15:30 +01:00
|
|
|
system.physmem.port = system.membus.master
|
|
|
|
system.l2.cpu_side = system.toL2bus.master
|
|
|
|
system.l2.mem_side = system.membus.slave
|
|
|
|
system.system_port = system.membus.slave
|
2006-10-21 01:53:52 +02:00
|
|
|
|
|
|
|
# ----------------------
|
|
|
|
# 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))
|
|
|
|
# connect cpu level-1 caches to shared level-2 cache
|
2011-02-04 05:23:00 +01:00
|
|
|
cpu.connectAllPorts(system.toL2bus, system.membus)
|
2006-10-21 01:53:52 +02:00
|
|
|
|
|
|
|
|
|
|
|
# ----------------------
|
|
|
|
# Define the root
|
|
|
|
# ----------------------
|
|
|
|
|
2012-01-28 16:24:34 +01:00
|
|
|
root = Root(full_system = False, system = system)
|
2006-10-21 01:53:52 +02:00
|
|
|
|
|
|
|
# --------------------
|
|
|
|
# Pick the correct Splash2 Benchmarks
|
|
|
|
# ====================
|
|
|
|
if options.benchmark == 'Cholesky':
|
|
|
|
root.workload = Cholesky()
|
|
|
|
elif options.benchmark == 'FFT':
|
|
|
|
root.workload = FFT()
|
|
|
|
elif options.benchmark == 'LUContig':
|
|
|
|
root.workload = LU_contig()
|
|
|
|
elif options.benchmark == 'LUNoncontig':
|
|
|
|
root.workload = LU_noncontig()
|
|
|
|
elif options.benchmark == 'Radix':
|
|
|
|
root.workload = Radix()
|
|
|
|
elif options.benchmark == 'Barnes':
|
|
|
|
root.workload = Barnes()
|
|
|
|
elif options.benchmark == 'FMM':
|
|
|
|
root.workload = FMM()
|
|
|
|
elif options.benchmark == 'OceanContig':
|
|
|
|
root.workload = Ocean_contig()
|
|
|
|
elif options.benchmark == 'OceanNoncontig':
|
|
|
|
root.workload = Ocean_noncontig()
|
|
|
|
elif options.benchmark == 'Raytrace':
|
|
|
|
root.workload = Raytrace()
|
|
|
|
elif options.benchmark == 'WaterNSquared':
|
|
|
|
root.workload = Water_nsquared()
|
|
|
|
elif options.benchmark == 'WaterSpatial':
|
|
|
|
root.workload = Water_spatial()
|
Added config files for splash2 benchmarks. Parameters:
ROOTDIR = root directory of the splash2 code
NP = number of proccessors
BENCHMARK = name of the splash2 benchmark (Cholesky, FFT, LUContig, LUNoncontig, Radix, Barnes, FMM, OceanContig, OceanNoncontig, Raytrace, WaterNSquared, or WaterSpatial)
SYSTEM = Type of system to simulate detailed or simple
Note: They use MOESI protocol and do_events is enabled (Multiple L1's and a shared L2)
--HG--
extra : convert_revision : c39aa73825ea8108b6c32abd4a4fa4c23391ab09
2005-03-12 00:07:07 +01:00
|
|
|
else:
|
2007-11-15 18:58:06 +01:00
|
|
|
print >> sys.stderr, """The --benchmark environment variable was set to something improper.
|
|
|
|
Use Cholesky, FFT, LUContig, LUNoncontig, Radix, Barnes, FMM, OceanContig,
|
|
|
|
OceanNoncontig, Raytrace, WaterNSquared, or WaterSpatial"""
|
|
|
|
sys.exit(1)
|
2006-10-21 01:53:52 +02:00
|
|
|
|
|
|
|
# --------------------
|
|
|
|
# Assign the workload to the cpus
|
|
|
|
# ====================
|
|
|
|
|
|
|
|
for cpu in cpus:
|
|
|
|
cpu.workload = root.workload
|
|
|
|
|
|
|
|
# ----------------------
|
|
|
|
# Run the simulation
|
|
|
|
# ----------------------
|
|
|
|
|
|
|
|
if options.timing or options.detailed:
|
|
|
|
root.system.mem_mode = 'timing'
|
|
|
|
|
|
|
|
# instantiate configuration
|
2010-08-17 14:06:22 +02:00
|
|
|
m5.instantiate()
|
2006-10-21 01:53:52 +02:00
|
|
|
|
|
|
|
# simulate until program terminates
|
|
|
|
if options.maxtick:
|
|
|
|
exit_event = m5.simulate(options.maxtick)
|
|
|
|
else:
|
2006-11-13 22:09:47 +01:00
|
|
|
exit_event = m5.simulate(m5.MaxTick)
|
2006-10-21 01:53:52 +02:00
|
|
|
|
|
|
|
print 'Exiting @ tick', m5.curTick(), 'because', exit_event.getCause()
|
|
|
|
|