run.py (1714:e83b18b0238d) | run.py (3358:f70480ec2642) |
---|---|
1# Copyright (c) 2005 The Regents of The University of Michigan | 1# Copyright (c) 2005-2006 The Regents of The University of Michigan |
2# All rights reserved. 3# 4# Redistribution and use in source and binary forms, with or without 5# modification, are permitted provided that the following conditions are 6# met: redistributions of source code must retain the above copyright 7# notice, this list of conditions and the following disclaimer; 8# redistributions in binary form must reproduce the above copyright 9# notice, this list of conditions and the following disclaimer in the --- 11 unchanged lines hidden (view full) --- 21# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26# 27# Authors: Ron Dreslinski 28 | 2# All rights reserved. 3# 4# Redistribution and use in source and binary forms, with or without 5# modification, are permitted provided that the following conditions are 6# met: redistributions of source code must retain the above copyright 7# notice, this list of conditions and the following disclaimer; 8# redistributions in binary form must reproduce the above copyright 9# notice, this list of conditions and the following disclaimer in the --- 11 unchanged lines hidden (view full) --- 21# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26# 27# Authors: Ron Dreslinski 28 |
29from m5 import * 30import Splash2 | 29# Splash2 Run Script 30# |
31 | 31 |
32if 'SYSTEM' not in env: 33 panic("The SYSTEM environment variable must be set!\ne.g -ESYSTEM=Detailed\n") | 32import m5 33from m5.objects import * 34import os, optparse, sys 35m5.AddToPath('../common') |
34 | 36 |
35if env['SYSTEM'] == 'Simple': 36 from SimpleConfig import * 37 BaseCPU.workload = Parent.workload 38 SimpleStandAlone.cpu = [ CPU() for i in xrange(int(env['NP'])) ] 39 root = SimpleStandAlone() 40elif env['SYSTEM'] == 'Detailed': 41 from DetailedConfig import * 42 BaseCPU.workload = Parent.workload 43 DetailedStandAlone.cpu = [ DetailedCPU() for i in xrange(int(env['NP'])) ] 44 root = DetailedStandAlone() | 37# -------------------- 38# Define Command Line Options 39# ==================== 40 41parser = optparse.OptionParser() 42 43parser.add_option("-d", "--detailed", action="store_true") 44parser.add_option("-t", "--timing", action="store_true") 45parser.add_option("-m", "--maxtick", type="int") 46parser.add_option("-n", "--numcpus", 47 help="Number of cpus in total", type="int") 48parser.add_option("-f", "--frequency", 49 help="Frequency of each CPU") 50parser.add_option("-p", "--protocol", 51 default="moesi", 52 help="The coherence protocol to use for the L1'a (i.e. MOESI, MOSI)") 53parser.add_option("--l1size") 54parser.add_option("--l1latency") 55parser.add_option("--l2size") 56parser.add_option("--l2latency") 57parser.add_option("--rootdir", 58 help="ROot directory of Splash2", 59 default="../../Splash2/codes") 60parser.add_option("-b", "--benchmark", 61 help="Splash 2 benchmark to run") 62 63(options, args) = parser.parse_args() 64 65if args: 66 print "Error: script doesn't take any positional arguments" 67 sys.exit(1) 68 69# -------------------- 70# Define Splash2 Benchmarks 71# ==================== 72class Cholesky(LiveProcess): 73 executable = options.rootdir + '/kernels/cholesky/CHOLESKY' 74 cmd = 'CHOLESKY -p' + str(options.numcpus) + ' '\ 75 + options.rootdir + '/kernels/cholesky/inputs/tk23.O' 76 77class FFT(LiveProcess): 78 executable = options.rootdir + 'kernels/fft/FFT' 79 cmd = 'FFT -p' + str(options.numcpus) + ' -m18' 80 81class LU_contig(LiveProcess): 82 executable = options.rootdir + 'kernels/lu/contiguous_blocks/LU' 83 cmd = 'LU -p' + str(options.numcpus) 84 85class LU_noncontig(LiveProcess): 86 executable = options.rootdir + 'kernels/lu/non_contiguous_blocks/LU' 87 cmd = 'LU -p' + str(options.numcpus) 88 89class Radix(LiveProcess): 90 executable = options.rootdir + 'kernels/radix/RADIX' 91 cmd = 'RADIX -n524288 -p' + str(options.numcpus) 92 93class Barnes(LiveProcess): 94 executable = options.rootdir + 'apps/barnes/BARNES' 95 cmd = 'BARNES' 96 input = options.rootdir + 'apps/barnes/input.p' + str(options.numcpus) 97 98class FMM(LiveProcess): 99 executable = options.rootdir + 'apps/fmm/FMM' 100 cmd = 'FMM' 101 input = options.rootdir + 'apps/fmm/inputs/input.2048.p' + str(options.numcpus) 102 103class Ocean_contig(LiveProcess): 104 executable = options.rootdir + 'apps/ocean/contiguous_partitions/OCEAN' 105 cmd = 'OCEAN -p' + str(options.numcpus) 106 107class Ocean_noncontig(LiveProcess): 108 executable = options.rootdir + 'apps/ocean/non_contiguous_partitions/OCEAN' 109 cmd = 'OCEAN -p' + str(options.numcpus) 110 111class Raytrace(LiveProcess): 112 executable = options.rootdir + 'apps/raytrace/RAYTRACE' 113 cmd = 'RAYTRACE -p' + str(options.numcpus) + ' ' \ 114 + options.rootdir + 'apps/raytrace/inputs/teapot.env' 115 116class Water_nsquared(LiveProcess): 117 executable = options.rootdir + 'apps/water-nsquared/WATER-NSQUARED' 118 cmd = 'WATER-NSQUARED' 119 input = options.rootdir + 'apps/water-nsquared/input.p' + str(options.numcpus) 120 121class Water_spatial(LiveProcess): 122 executable = options.rootdir + 'apps/water-spatial/WATER-SPATIAL' 123 cmd = 'WATER-SPATIAL' 124 input = options.rootdir + 'apps/water-spatial/input.p' + str(options.numcpus) 125 126 127# -------------------- 128# Base L1 Cache Definition 129# ==================== 130 131class L1(BaseCache): 132 latency = options.l1latency 133 block_size = 64 134 mshrs = 12 135 tgts_per_mshr = 8 136 protocol = CoherenceProtocol(protocol=options.protocol) 137 138# ---------------------- 139# Base L2 Cache Definition 140# ---------------------- 141 142class L2(BaseCache): 143 block_size = 64 144 latency = options.l2latency 145 mshrs = 92 146 tgts_per_mshr = 16 147 write_buffers = 8 148 149# ---------------------- 150# Define the cpus 151# ---------------------- 152 153busFrequency = Frequency(options.frequency) 154 155if options.timing: 156 cpus = [TimingSimpleCPU(cpu_id = i, 157 clock=options.frequency) 158 for i in xrange(options.numcpus)] 159elif options.detailed: 160 cpus = [DerivO3CPU(cpu_id = i, 161 clock=options.frequency) 162 for i in xrange(options.numcpus)] |
45else: | 163else: |
46 panic("The SYSTEM environment variable was set to something improper.\n Use Simple or Detailed\n") | 164 cpus = [AtomicSimpleCPU(cpu_id = i, 165 clock=options.frequency) 166 for i in xrange(options.numcpus)] |
47 | 167 |
48if 'BENCHMARK' not in env: 49 panic("The BENCHMARK environment variable must be set!\ne.g. -EBENCHMARK=Cholesky\n") | 168# ---------------------- 169# Create a system, and add system wide objects 170# ---------------------- 171system = System(cpu = cpus, physmem = PhysicalMemory(), 172 membus = Bus(clock = busFrequency)) |
50 | 173 |
51if env['BENCHMARK'] == 'Cholesky': 52 root.workload = Splash2.Cholesky() 53elif env['BENCHMARK'] == 'FFT': 54 root.workload = Splash2.FFT() 55elif env['BENCHMARK'] == 'LUContig': 56 root.workload = Splash2.LU_contig() 57elif env['BENCHMARK'] == 'LUNoncontig': 58 root.workload = Splash2.LU_noncontig() 59elif env['BENCHMARK'] == 'Radix': 60 root.workload = Splash2.Radix() 61elif env['BENCHMARK'] == 'Barnes': 62 root.workload = Splash2.Barnes() 63elif env['BENCHMARK'] == 'FMM': 64 root.workload = Splash2.FMM() 65elif env['BENCHMARK'] == 'OceanContig': 66 root.workload = Splash2.Ocean_contig() 67elif env['BENCHMARK'] == 'OceanNoncontig': 68 root.workload = Splash2.Ocean_noncontig() 69elif env['BENCHMARK'] == 'Raytrace': 70 root.workload = Splash2.Raytrace() 71elif env['BENCHMARK'] == 'WaterNSquared': 72 root.workload = Splash2.Water_nsquared() 73elif env['BENCHMARK'] == 'WaterSpatial': 74 root.workload = Splash2.Water_spatial() | 174system.toL2bus = Bus(clock = busFrequency) 175system.l2 = L2(size = options.l2size, assoc = 8) 176 177# ---------------------- 178# Connect the L2 cache and memory together 179# ---------------------- 180 181system.physmem.port = system.membus.port 182system.l2.cpu_side = system.toL2bus.port 183system.l2.mem_side = system.membus.port 184 185# ---------------------- 186# Connect the L2 cache and clusters together 187# ---------------------- 188for cpu in cpus: 189 cpu.addPrivateSplitL1Caches(L1(size = options.l1size, assoc = 1), 190 L1(size = options.l1size, assoc = 4)) 191 cpu.mem = cpu.dcache 192 # connect cpu level-1 caches to shared level-2 cache 193 cpu.connectMemPorts(system.toL2bus) 194 195 196# ---------------------- 197# Define the root 198# ---------------------- 199 200root = Root(system = system) 201 202# -------------------- 203# Pick the correct Splash2 Benchmarks 204# ==================== 205if options.benchmark == 'Cholesky': 206 root.workload = Cholesky() 207elif options.benchmark == 'FFT': 208 root.workload = FFT() 209elif options.benchmark == 'LUContig': 210 root.workload = LU_contig() 211elif options.benchmark == 'LUNoncontig': 212 root.workload = LU_noncontig() 213elif options.benchmark == 'Radix': 214 root.workload = Radix() 215elif options.benchmark == 'Barnes': 216 root.workload = Barnes() 217elif options.benchmark == 'FMM': 218 root.workload = FMM() 219elif options.benchmark == 'OceanContig': 220 root.workload = Ocean_contig() 221elif options.benchmark == 'OceanNoncontig': 222 root.workload = Ocean_noncontig() 223elif options.benchmark == 'Raytrace': 224 root.workload = Raytrace() 225elif options.benchmark == 'WaterNSquared': 226 root.workload = Water_nsquared() 227elif options.benchmark == 'WaterSpatial': 228 root.workload = Water_spatial() |
75else: | 229else: |
76 panic("The BENCHMARK environment variable was set to something" \ | 230 panic("The --benchmark environment variable was set to something" \ |
77 +" improper.\nUse Cholesky, FFT, LUContig, LUNoncontig, Radix" \ 78 +", Barnes, FMM, OceanContig,\nOceanNoncontig, Raytrace," \ 79 +" WaterNSquared, or WaterSpatial\n") | 231 +" improper.\nUse Cholesky, FFT, LUContig, LUNoncontig, Radix" \ 232 +", Barnes, FMM, OceanContig,\nOceanNoncontig, Raytrace," \ 233 +" WaterNSquared, or WaterSpatial\n") |
234 235# -------------------- 236# Assign the workload to the cpus 237# ==================== 238 239for cpu in cpus: 240 cpu.workload = root.workload 241 242# ---------------------- 243# Run the simulation 244# ---------------------- 245 246if options.timing or options.detailed: 247 root.system.mem_mode = 'timing' 248 249# instantiate configuration 250m5.instantiate(root) 251 252# simulate until program terminates 253if options.maxtick: 254 exit_event = m5.simulate(options.maxtick) 255else: 256 exit_event = m5.simulate() 257 258print 'Exiting @ tick', m5.curTick(), 'because', exit_event.getCause() 259 |
|