d051f1f1beba566bbf42f03329e2b6ed5a715294
1 # Copyright (c) 2005-2007 The Regents of The University of Michigan
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.
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.
27 # Authors: Ron Dreslinski
33 from m5
.objects
import *
34 import os
, optparse
, sys
35 m5
.AddToPath('../common')
37 # --------------------
38 # Define Command Line Options
39 # ====================
41 parser
= optparse
.OptionParser()
43 parser
.add_option("-d", "--detailed", action
="store_true")
44 parser
.add_option("-t", "--timing", action
="store_true")
45 parser
.add_option("-m", "--maxtick", type="int")
46 parser
.add_option("-n", "--numcpus",
47 help="Number of cpus in total", type="int")
48 parser
.add_option("-f", "--frequency",
50 help="Frequency of each CPU")
51 parser
.add_option("-p", "--protocol",
53 help="The coherence protocol to use for the L1'a (i.e. MOESI, MOSI)")
54 parser
.add_option("--l1size",
56 parser
.add_option("--l1latency",
58 parser
.add_option("--l2size",
60 parser
.add_option("--l2latency",
62 parser
.add_option("--rootdir",
63 help="Root directory of Splash2",
64 default
="/dist/splash2/codes")
65 parser
.add_option("-b", "--benchmark",
66 help="Splash 2 benchmark to run")
68 (options
, args
) = parser
.parse_args()
71 print "Error: script doesn't take any positional arguments"
74 if not options
.numcpus
:
75 print "Specify the number of cpus with -n"
78 # --------------------
79 # Define Splash2 Benchmarks
80 # ====================
81 class Cholesky(LiveProcess
):
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'
87 class FFT(LiveProcess
):
88 cwd
= options
.rootdir
+ '/kernels/fft'
89 executable
= options
.rootdir
+ '/kernels/fft/FFT'
90 cmd
= 'FFT -p' + str(options
.numcpus
) + ' -m18'
92 class LU_contig(LiveProcess
):
93 executable
= options
.rootdir
+ '/kernels/lu/contiguous_blocks/LU'
94 cmd
= 'LU -p' + str(options
.numcpus
)
95 cwd
= options
.rootdir
+ '/kernels/lu/contiguous_blocks'
97 class LU_noncontig(LiveProcess
):
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'
102 class Radix(LiveProcess
):
103 executable
= options
.rootdir
+ '/kernels/radix/RADIX'
104 cmd
= 'RADIX -n524288 -p' + str(options
.numcpus
)
105 cwd
= options
.rootdir
+ '/kernels/radix'
107 class Barnes(LiveProcess
):
108 executable
= options
.rootdir
+ '/apps/barnes/BARNES'
110 input = options
.rootdir
+ '/apps/barnes/input.p' + str(options
.numcpus
)
111 cwd
= options
.rootdir
+ '/apps/barnes'
113 class FMM(LiveProcess
):
114 executable
= options
.rootdir
+ '/apps/fmm/FMM'
116 if str(options
.numcpus
) == '1':
117 input = options
.rootdir
+ '/apps/fmm/inputs/input.2048'
119 input = options
.rootdir
+ '/apps/fmm/inputs/input.2048.p' + str(options
.numcpus
)
120 cwd
= options
.rootdir
+ '/apps/fmm'
122 class Ocean_contig(LiveProcess
):
123 executable
= options
.rootdir
+ '/apps/ocean/contiguous_partitions/OCEAN'
124 cmd
= 'OCEAN -p' + str(options
.numcpus
)
125 cwd
= options
.rootdir
+ '/apps/ocean/contiguous_partitions'
127 class Ocean_noncontig(LiveProcess
):
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'
132 class Raytrace(LiveProcess
):
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'
138 class Water_nsquared(LiveProcess
):
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'
144 input = options
.rootdir
+ '/apps/water-nsquared/input.p' + str(options
.numcpus
)
145 cwd
= options
.rootdir
+ '/apps/water-nsquared'
147 class Water_spatial(LiveProcess
):
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'
153 input = options
.rootdir
+ '/apps/water-spatial/input.p' + str(options
.numcpus
)
154 cwd
= options
.rootdir
+ '/apps/water-spatial'
156 # --------------------
157 # Base L1 Cache Definition
158 # ====================
161 latency
= options
.l1latency
165 protocol
= CoherenceProtocol(protocol
=options
.protocol
)
167 # ----------------------
168 # Base L2 Cache Definition
169 # ----------------------
173 latency
= options
.l2latency
178 # ----------------------
180 # ----------------------
182 busFrequency
= Frequency(options
.frequency
)
185 cpus
= [TimingSimpleCPU(cpu_id
= i
,
186 clock
=options
.frequency
)
187 for i
in xrange(options
.numcpus
)]
188 elif options
.detailed
:
189 cpus
= [DerivO3CPU(cpu_id
= i
,
190 clock
=options
.frequency
)
191 for i
in xrange(options
.numcpus
)]
193 cpus
= [AtomicSimpleCPU(cpu_id
= i
,
194 clock
=options
.frequency
)
195 for i
in xrange(options
.numcpus
)]
197 # ----------------------
198 # Create a system, and add system wide objects
199 # ----------------------
200 system
= System(cpu
= cpus
, physmem
= PhysicalMemory(),
201 membus
= Bus(clock
= busFrequency
))
203 system
.toL2bus
= Bus(clock
= busFrequency
)
204 system
.l2
= L2(size
= options
.l2size
, assoc
= 8)
206 # ----------------------
207 # Connect the L2 cache and memory together
208 # ----------------------
210 system
.physmem
.port
= system
.membus
.port
211 system
.l2
.cpu_side
= system
.toL2bus
.port
212 system
.l2
.mem_side
= system
.membus
.port
214 # ----------------------
215 # Connect the L2 cache and clusters together
216 # ----------------------
218 cpu
.addPrivateSplitL1Caches(L1(size
= options
.l1size
, assoc
= 1),
219 L1(size
= options
.l1size
, assoc
= 4))
221 # connect cpu level-1 caches to shared level-2 cache
222 cpu
.connectMemPorts(system
.toL2bus
)
225 # ----------------------
227 # ----------------------
229 root
= Root(system
= system
)
231 # --------------------
232 # Pick the correct Splash2 Benchmarks
233 # ====================
234 if options
.benchmark
== 'Cholesky':
235 root
.workload
= Cholesky()
236 elif options
.benchmark
== 'FFT':
237 root
.workload
= FFT()
238 elif options
.benchmark
== 'LUContig':
239 root
.workload
= LU_contig()
240 elif options
.benchmark
== 'LUNoncontig':
241 root
.workload
= LU_noncontig()
242 elif options
.benchmark
== 'Radix':
243 root
.workload
= Radix()
244 elif options
.benchmark
== 'Barnes':
245 root
.workload
= Barnes()
246 elif options
.benchmark
== 'FMM':
247 root
.workload
= FMM()
248 elif options
.benchmark
== 'OceanContig':
249 root
.workload
= Ocean_contig()
250 elif options
.benchmark
== 'OceanNoncontig':
251 root
.workload
= Ocean_noncontig()
252 elif options
.benchmark
== 'Raytrace':
253 root
.workload
= Raytrace()
254 elif options
.benchmark
== 'WaterNSquared':
255 root
.workload
= Water_nsquared()
256 elif options
.benchmark
== 'WaterSpatial':
257 root
.workload
= Water_spatial()
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")
264 # --------------------
265 # Assign the workload to the cpus
266 # ====================
269 cpu
.workload
= root
.workload
271 # ----------------------
273 # ----------------------
275 if options
.timing
or options
.detailed
:
276 root
.system
.mem_mode
= 'timing'
278 # instantiate configuration
281 # simulate until program terminates
283 exit_event
= m5
.simulate(options
.maxtick
)
285 exit_event
= m5
.simulate(m5
.MaxTick
)
287 print 'Exiting @ tick', m5
.curTick(), 'because', exit_event
.getCause()