1# Copyright (c) 2005-2006 The Regents of The University of Michigan
| 1# Copyright (c) 2005-2007 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 10# documentation and/or other materials provided with the distribution; 11# neither the name of the copyright holders nor the names of its 12# contributors may be used to endorse or promote products derived from 13# this software without specific prior written permission. 14# 15# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 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 29# Splash2 Run Script 30# 31 32import m5 33from m5.objects import * 34import os, optparse, sys 35m5.AddToPath('../common') 36 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 default = "1GHz", 50 help="Frequency of each CPU") 51parser.add_option("-p", "--protocol", 52 default="moesi", 53 help="The coherence protocol to use for the L1'a (i.e. MOESI, MOSI)") 54parser.add_option("--l1size", 55 default = "32kB") 56parser.add_option("--l1latency", 57 default = 1) 58parser.add_option("--l2size", 59 default = "256kB") 60parser.add_option("--l2latency", 61 default = 10) 62parser.add_option("--rootdir",
| 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 10# documentation and/or other materials provided with the distribution; 11# neither the name of the copyright holders nor the names of its 12# contributors may be used to endorse or promote products derived from 13# this software without specific prior written permission. 14# 15# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 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 29# Splash2 Run Script 30# 31 32import m5 33from m5.objects import * 34import os, optparse, sys 35m5.AddToPath('../common') 36 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 default = "1GHz", 50 help="Frequency of each CPU") 51parser.add_option("-p", "--protocol", 52 default="moesi", 53 help="The coherence protocol to use for the L1'a (i.e. MOESI, MOSI)") 54parser.add_option("--l1size", 55 default = "32kB") 56parser.add_option("--l1latency", 57 default = 1) 58parser.add_option("--l2size", 59 default = "256kB") 60parser.add_option("--l2latency", 61 default = 10) 62parser.add_option("--rootdir",
|
63 help="ROot directory of Splash2",
| 63 help="Root directory of Splash2",
|
64 default="/dist/splash2/codes") 65parser.add_option("-b", "--benchmark", 66 help="Splash 2 benchmark to run") 67 68(options, args) = parser.parse_args() 69 70if args: 71 print "Error: script doesn't take any positional arguments" 72 sys.exit(1) 73 74if not options.numcpus: 75 print "Specify the number of cpus with -n" 76 sys.exit(1) 77 78# -------------------- 79# Define Splash2 Benchmarks 80# ==================== 81class Cholesky(LiveProcess):
| 64 default="/dist/splash2/codes") 65parser.add_option("-b", "--benchmark", 66 help="Splash 2 benchmark to run") 67 68(options, args) = parser.parse_args() 69 70if args: 71 print "Error: script doesn't take any positional arguments" 72 sys.exit(1) 73 74if not options.numcpus: 75 print "Specify the number of cpus with -n" 76 sys.exit(1) 77 78# -------------------- 79# Define Splash2 Benchmarks 80# ==================== 81class Cholesky(LiveProcess):
|
82 executable = options.rootdir + '/kernels/cholesky/CHOLESKY' 83 cmd = 'CHOLESKY -p' + str(options.numcpus) + ' '\ 84 + options.rootdir + '/kernels/cholesky/inputs/tk23.O'
| 82 cwd = options.rootdir + '/kernels/cholesky' 83 executable = options.rootdir + '/kernels/cholesky/CHOLESKY' 84 cmd = 'CHOLESKY -p' + str(options.numcpus) + ' '\ 85 + options.rootdir + '/kernels/cholesky/inputs/tk23.O'
|
85 86class FFT(LiveProcess):
| 86 87class FFT(LiveProcess):
|
87 executable = options.rootdir + '/kernels/fft/FFT' 88 cmd = 'FFT -p' + str(options.numcpus) + ' -m18'
| 88 cwd = options.rootdir + '/kernels/fft' 89 executable = options.rootdir + '/kernels/fft/FFT' 90 cmd = 'FFT -p' + str(options.numcpus) + ' -m18'
|
89 90class LU_contig(LiveProcess):
| 91 92class LU_contig(LiveProcess):
|
91 executable = options.rootdir + '/kernels/lu/contiguous_blocks/LU' 92 cmd = 'LU -p' + str(options.numcpus)
| 93 executable = options.rootdir + '/kernels/lu/contiguous_blocks/LU' 94 cmd = 'LU -p' + str(options.numcpus) 95 cwd = options.rootdir + '/kernels/lu/contiguous_blocks'
|
93 94class LU_noncontig(LiveProcess):
| 96 97class LU_noncontig(LiveProcess):
|
95 executable = options.rootdir + '/kernels/lu/non_contiguous_blocks/LU' 96 cmd = 'LU -p' + str(options.numcpus)
| 98 executable = options.rootdir + '/kernels/lu/non_contiguous_blocks/LU' 99 cmd = 'LU -p' + str(options.numcpus) 100 cwd = options.rootdir + '/kernels/lu/non_contiguous_blocks'
|
97 98class Radix(LiveProcess):
| 101 102class Radix(LiveProcess):
|
99 executable = options.rootdir + '/kernels/radix/RADIX' 100 cmd = 'RADIX -n524288 -p' + str(options.numcpus)
| 103 executable = options.rootdir + '/kernels/radix/RADIX' 104 cmd = 'RADIX -n524288 -p' + str(options.numcpus) 105 cwd = options.rootdir + '/kernels/radix'
|
101 102class Barnes(LiveProcess):
| 106 107class Barnes(LiveProcess):
|
103 executable = options.rootdir + '/apps/barnes/BARNES' 104 cmd = 'BARNES' 105 input = options.rootdir + '/apps/barnes/input.p' + str(options.numcpus)
| 108 executable = options.rootdir + '/apps/barnes/BARNES' 109 cmd = 'BARNES' 110 input = options.rootdir + '/apps/barnes/input.p' + str(options.numcpus) 111 cwd = options.rootdir + '/apps/barnes'
|
106 107class FMM(LiveProcess):
| 112 113class FMM(LiveProcess):
|
108 executable = options.rootdir + '/apps/fmm/FMM' 109 cmd = 'FMM'
| 114 executable = options.rootdir + '/apps/fmm/FMM' 115 cmd = 'FMM' 116 if str(options.numcpus) == '1': 117 input = options.rootdir + '/apps/fmm/inputs/input.2048' 118 else:
|
110 input = options.rootdir + '/apps/fmm/inputs/input.2048.p' + str(options.numcpus)
| 119 input = options.rootdir + '/apps/fmm/inputs/input.2048.p' + str(options.numcpus)
|
| 120 cwd = options.rootdir + '/apps/fmm'
|
111 112class Ocean_contig(LiveProcess):
| 121 122class Ocean_contig(LiveProcess):
|
113 executable = options.rootdir + '/apps/ocean/contiguous_partitions/OCEAN' 114 cmd = 'OCEAN -p' + str(options.numcpus)
| 123 executable = options.rootdir + '/apps/ocean/contiguous_partitions/OCEAN' 124 cmd = 'OCEAN -p' + str(options.numcpus) 125 cwd = options.rootdir + '/apps/ocean/contiguous_partitions'
|
115 116class Ocean_noncontig(LiveProcess):
| 126 127class Ocean_noncontig(LiveProcess):
|
117 executable = options.rootdir + '/apps/ocean/non_contiguous_partitions/OCEAN' 118 cmd = 'OCEAN -p' + str(options.numcpus)
| 128 executable = options.rootdir + '/apps/ocean/non_contiguous_partitions/OCEAN' 129 cmd = 'OCEAN -p' + str(options.numcpus) 130 cwd = options.rootdir + '/apps/ocean/non_contiguous_partitions'
|
119 120class Raytrace(LiveProcess):
| 131 132class Raytrace(LiveProcess):
|
121 executable = options.rootdir + '/apps/raytrace/RAYTRACE' 122 cmd = 'RAYTRACE -p' + str(options.numcpus) + ' ' \ 123 + options.rootdir + 'apps/raytrace/inputs/teapot.env'
| 133 executable = options.rootdir + '/apps/raytrace/RAYTRACE' 134 cmd = 'RAYTRACE -p' + str(options.numcpus) + ' ' \ 135 + options.rootdir + '/apps/raytrace/inputs/teapot.env' 136 cwd = options.rootdir + '/apps/raytrace'
|
124 125class Water_nsquared(LiveProcess):
| 137 138class Water_nsquared(LiveProcess):
|
126 executable = options.rootdir + '/apps/water-nsquared/WATER-NSQUARED' 127 cmd = 'WATER-NSQUARED'
| 139 executable = options.rootdir + '/apps/water-nsquared/WATER-NSQUARED' 140 cmd = 'WATER-NSQUARED' 141 if options.numcpus==1: 142 input = options.rootdir + '/apps/water-nsquared/input' 143 else:
|
128 input = options.rootdir + '/apps/water-nsquared/input.p' + str(options.numcpus)
| 144 input = options.rootdir + '/apps/water-nsquared/input.p' + str(options.numcpus)
|
| 145 cwd = options.rootdir + '/apps/water-nsquared'
|
129 130class Water_spatial(LiveProcess):
| 146 147class Water_spatial(LiveProcess):
|
131 executable = options.rootdir + '/apps/water-spatial/WATER-SPATIAL' 132 cmd = 'WATER-SPATIAL'
| 148 executable = options.rootdir + '/apps/water-spatial/WATER-SPATIAL' 149 cmd = 'WATER-SPATIAL' 150 if options.numcpus==1: 151 input = options.rootdir + '/apps/water-spatial/input' 152 else:
|
133 input = options.rootdir + '/apps/water-spatial/input.p' + str(options.numcpus)
| 153 input = options.rootdir + '/apps/water-spatial/input.p' + str(options.numcpus)
|
| 154 cwd = options.rootdir + '/apps/water-spatial'
|
134
| 155
|
135
| |
136# -------------------- 137# Base L1 Cache Definition 138# ==================== 139 140class L1(BaseCache): 141 latency = options.l1latency 142 block_size = 64 143 mshrs = 12 144 tgts_per_mshr = 8 145 protocol = CoherenceProtocol(protocol=options.protocol) 146 147# ---------------------- 148# Base L2 Cache Definition 149# ---------------------- 150 151class L2(BaseCache): 152 block_size = 64 153 latency = options.l2latency 154 mshrs = 92 155 tgts_per_mshr = 16 156 write_buffers = 8 157 158# ---------------------- 159# Define the cpus 160# ---------------------- 161 162busFrequency = Frequency(options.frequency) 163 164if options.timing: 165 cpus = [TimingSimpleCPU(cpu_id = i, 166 clock=options.frequency) 167 for i in xrange(options.numcpus)] 168elif options.detailed: 169 cpus = [DerivO3CPU(cpu_id = i, 170 clock=options.frequency) 171 for i in xrange(options.numcpus)] 172else: 173 cpus = [AtomicSimpleCPU(cpu_id = i, 174 clock=options.frequency) 175 for i in xrange(options.numcpus)] 176 177# ---------------------- 178# Create a system, and add system wide objects 179# ---------------------- 180system = System(cpu = cpus, physmem = PhysicalMemory(), 181 membus = Bus(clock = busFrequency)) 182 183system.toL2bus = Bus(clock = busFrequency) 184system.l2 = L2(size = options.l2size, assoc = 8) 185 186# ---------------------- 187# Connect the L2 cache and memory together 188# ---------------------- 189 190system.physmem.port = system.membus.port 191system.l2.cpu_side = system.toL2bus.port 192system.l2.mem_side = system.membus.port 193 194# ---------------------- 195# Connect the L2 cache and clusters together 196# ---------------------- 197for cpu in cpus: 198 cpu.addPrivateSplitL1Caches(L1(size = options.l1size, assoc = 1), 199 L1(size = options.l1size, assoc = 4)) 200 cpu.mem = cpu.dcache 201 # connect cpu level-1 caches to shared level-2 cache 202 cpu.connectMemPorts(system.toL2bus) 203 204 205# ---------------------- 206# Define the root 207# ---------------------- 208 209root = Root(system = system) 210 211# -------------------- 212# Pick the correct Splash2 Benchmarks 213# ==================== 214if options.benchmark == 'Cholesky': 215 root.workload = Cholesky() 216elif options.benchmark == 'FFT': 217 root.workload = FFT() 218elif options.benchmark == 'LUContig': 219 root.workload = LU_contig() 220elif options.benchmark == 'LUNoncontig': 221 root.workload = LU_noncontig() 222elif options.benchmark == 'Radix': 223 root.workload = Radix() 224elif options.benchmark == 'Barnes': 225 root.workload = Barnes() 226elif options.benchmark == 'FMM': 227 root.workload = FMM() 228elif options.benchmark == 'OceanContig': 229 root.workload = Ocean_contig() 230elif options.benchmark == 'OceanNoncontig': 231 root.workload = Ocean_noncontig() 232elif options.benchmark == 'Raytrace': 233 root.workload = Raytrace() 234elif options.benchmark == 'WaterNSquared': 235 root.workload = Water_nsquared() 236elif options.benchmark == 'WaterSpatial': 237 root.workload = Water_spatial() 238else: 239 panic("The --benchmark environment variable was set to something" \ 240 +" improper.\nUse Cholesky, FFT, LUContig, LUNoncontig, Radix" \ 241 +", Barnes, FMM, OceanContig,\nOceanNoncontig, Raytrace," \ 242 +" WaterNSquared, or WaterSpatial\n") 243 244# -------------------- 245# Assign the workload to the cpus 246# ==================== 247 248for cpu in cpus: 249 cpu.workload = root.workload 250 251# ---------------------- 252# Run the simulation 253# ---------------------- 254 255if options.timing or options.detailed: 256 root.system.mem_mode = 'timing' 257 258# instantiate configuration 259m5.instantiate(root) 260 261# simulate until program terminates 262if options.maxtick: 263 exit_event = m5.simulate(options.maxtick) 264else: 265 exit_event = m5.simulate(m5.MaxTick) 266 267print 'Exiting @ tick', m5.curTick(), 'because', exit_event.getCause() 268
| 156# -------------------- 157# Base L1 Cache Definition 158# ==================== 159 160class L1(BaseCache): 161 latency = options.l1latency 162 block_size = 64 163 mshrs = 12 164 tgts_per_mshr = 8 165 protocol = CoherenceProtocol(protocol=options.protocol) 166 167# ---------------------- 168# Base L2 Cache Definition 169# ---------------------- 170 171class L2(BaseCache): 172 block_size = 64 173 latency = options.l2latency 174 mshrs = 92 175 tgts_per_mshr = 16 176 write_buffers = 8 177 178# ---------------------- 179# Define the cpus 180# ---------------------- 181 182busFrequency = Frequency(options.frequency) 183 184if options.timing: 185 cpus = [TimingSimpleCPU(cpu_id = i, 186 clock=options.frequency) 187 for i in xrange(options.numcpus)] 188elif options.detailed: 189 cpus = [DerivO3CPU(cpu_id = i, 190 clock=options.frequency) 191 for i in xrange(options.numcpus)] 192else: 193 cpus = [AtomicSimpleCPU(cpu_id = i, 194 clock=options.frequency) 195 for i in xrange(options.numcpus)] 196 197# ---------------------- 198# Create a system, and add system wide objects 199# ---------------------- 200system = System(cpu = cpus, physmem = PhysicalMemory(), 201 membus = Bus(clock = busFrequency)) 202 203system.toL2bus = Bus(clock = busFrequency) 204system.l2 = L2(size = options.l2size, assoc = 8) 205 206# ---------------------- 207# Connect the L2 cache and memory together 208# ---------------------- 209 210system.physmem.port = system.membus.port 211system.l2.cpu_side = system.toL2bus.port 212system.l2.mem_side = system.membus.port 213 214# ---------------------- 215# Connect the L2 cache and clusters together 216# ---------------------- 217for cpu in cpus: 218 cpu.addPrivateSplitL1Caches(L1(size = options.l1size, assoc = 1), 219 L1(size = options.l1size, assoc = 4)) 220 cpu.mem = cpu.dcache 221 # connect cpu level-1 caches to shared level-2 cache 222 cpu.connectMemPorts(system.toL2bus) 223 224 225# ---------------------- 226# Define the root 227# ---------------------- 228 229root = Root(system = system) 230 231# -------------------- 232# Pick the correct Splash2 Benchmarks 233# ==================== 234if options.benchmark == 'Cholesky': 235 root.workload = Cholesky() 236elif options.benchmark == 'FFT': 237 root.workload = FFT() 238elif options.benchmark == 'LUContig': 239 root.workload = LU_contig() 240elif options.benchmark == 'LUNoncontig': 241 root.workload = LU_noncontig() 242elif options.benchmark == 'Radix': 243 root.workload = Radix() 244elif options.benchmark == 'Barnes': 245 root.workload = Barnes() 246elif options.benchmark == 'FMM': 247 root.workload = FMM() 248elif options.benchmark == 'OceanContig': 249 root.workload = Ocean_contig() 250elif options.benchmark == 'OceanNoncontig': 251 root.workload = Ocean_noncontig() 252elif options.benchmark == 'Raytrace': 253 root.workload = Raytrace() 254elif options.benchmark == 'WaterNSquared': 255 root.workload = Water_nsquared() 256elif options.benchmark == 'WaterSpatial': 257 root.workload = Water_spatial() 258else: 259 panic("The --benchmark environment variable was set to something" \ 260 +" improper.\nUse Cholesky, FFT, LUContig, LUNoncontig, Radix" \ 261 +", Barnes, FMM, OceanContig,\nOceanNoncontig, Raytrace," \ 262 +" WaterNSquared, or WaterSpatial\n") 263 264# -------------------- 265# Assign the workload to the cpus 266# ==================== 267 268for cpu in cpus: 269 cpu.workload = root.workload 270 271# ---------------------- 272# Run the simulation 273# ---------------------- 274 275if options.timing or options.detailed: 276 root.system.mem_mode = 'timing' 277 278# instantiate configuration 279m5.instantiate(root) 280 281# simulate until program terminates 282if options.maxtick: 283 exit_event = m5.simulate(options.maxtick) 284else: 285 exit_event = m5.simulate(m5.MaxTick) 286 287print 'Exiting @ tick', m5.curTick(), 'because', exit_event.getCause() 288
|