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
37 from m5
.objects
import *
39 m5
.util
.addToPath('../common')
41 # --------------------
42 # Define Command Line Options
43 # ====================
45 parser
= optparse
.OptionParser()
47 parser
.add_option("-d", "--detailed", action
="store_true")
48 parser
.add_option("-t", "--timing", action
="store_true")
49 parser
.add_option("-m", "--maxtick", type="int")
50 parser
.add_option("-n", "--numcpus",
51 help="Number of cpus in total", type="int")
52 parser
.add_option("-f", "--frequency",
54 help="Frequency of each CPU")
55 parser
.add_option("--l1size",
57 parser
.add_option("--l1latency",
59 parser
.add_option("--l2size",
61 parser
.add_option("--l2latency",
63 parser
.add_option("--rootdir",
64 help="Root directory of Splash2",
65 default
="/dist/splash2/codes")
66 parser
.add_option("-b", "--benchmark",
67 help="Splash 2 benchmark to run")
69 (options
, args
) = parser
.parse_args()
72 print "Error: script doesn't take any positional arguments"
75 if not options
.numcpus
:
76 print "Specify the number of cpus with -n"
79 # --------------------
80 # Define Splash2 Benchmarks
81 # ====================
82 class Cholesky(LiveProcess
):
83 cwd
= options
.rootdir
+ '/kernels/cholesky'
84 executable
= options
.rootdir
+ '/kernels/cholesky/CHOLESKY'
85 cmd
= ['CHOLESKY', '-p' + str(options
.numcpus
),
86 options
.rootdir
+ '/kernels/cholesky/inputs/tk23.O']
88 class FFT(LiveProcess
):
89 cwd
= options
.rootdir
+ '/kernels/fft'
90 executable
= options
.rootdir
+ '/kernels/fft/FFT'
91 cmd
= ['FFT', '-p', str(options
.numcpus
), '-m18']
93 class LU_contig(LiveProcess
):
94 executable
= options
.rootdir
+ '/kernels/lu/contiguous_blocks/LU'
95 cmd
= ['LU', '-p', str(options
.numcpus
)]
96 cwd
= options
.rootdir
+ '/kernels/lu/contiguous_blocks'
98 class LU_noncontig(LiveProcess
):
99 executable
= options
.rootdir
+ '/kernels/lu/non_contiguous_blocks/LU'
100 cmd
= ['LU', '-p', str(options
.numcpus
)]
101 cwd
= options
.rootdir
+ '/kernels/lu/non_contiguous_blocks'
103 class Radix(LiveProcess
):
104 executable
= options
.rootdir
+ '/kernels/radix/RADIX'
105 cmd
= ['RADIX', '-n524288', '-p', str(options
.numcpus
)]
106 cwd
= options
.rootdir
+ '/kernels/radix'
108 class Barnes(LiveProcess
):
109 executable
= options
.rootdir
+ '/apps/barnes/BARNES'
111 input = options
.rootdir
+ '/apps/barnes/input.p' + str(options
.numcpus
)
112 cwd
= options
.rootdir
+ '/apps/barnes'
114 class FMM(LiveProcess
):
115 executable
= options
.rootdir
+ '/apps/fmm/FMM'
117 if str(options
.numcpus
) == '1':
118 input = options
.rootdir
+ '/apps/fmm/inputs/input.2048'
120 input = options
.rootdir
+ '/apps/fmm/inputs/input.2048.p' + str(options
.numcpus
)
121 cwd
= options
.rootdir
+ '/apps/fmm'
123 class Ocean_contig(LiveProcess
):
124 executable
= options
.rootdir
+ '/apps/ocean/contiguous_partitions/OCEAN'
125 cmd
= ['OCEAN', '-p', str(options
.numcpus
)]
126 cwd
= options
.rootdir
+ '/apps/ocean/contiguous_partitions'
128 class Ocean_noncontig(LiveProcess
):
129 executable
= options
.rootdir
+ '/apps/ocean/non_contiguous_partitions/OCEAN'
130 cmd
= ['OCEAN', '-p', str(options
.numcpus
)]
131 cwd
= options
.rootdir
+ '/apps/ocean/non_contiguous_partitions'
133 class Raytrace(LiveProcess
):
134 executable
= options
.rootdir
+ '/apps/raytrace/RAYTRACE'
135 cmd
= ['RAYTRACE', '-p' + str(options
.numcpus
),
136 options
.rootdir
+ '/apps/raytrace/inputs/teapot.env']
137 cwd
= options
.rootdir
+ '/apps/raytrace'
139 class Water_nsquared(LiveProcess
):
140 executable
= options
.rootdir
+ '/apps/water-nsquared/WATER-NSQUARED'
141 cmd
= ['WATER-NSQUARED']
142 if options
.numcpus
==1:
143 input = options
.rootdir
+ '/apps/water-nsquared/input'
145 input = options
.rootdir
+ '/apps/water-nsquared/input.p' + str(options
.numcpus
)
146 cwd
= options
.rootdir
+ '/apps/water-nsquared'
148 class Water_spatial(LiveProcess
):
149 executable
= options
.rootdir
+ '/apps/water-spatial/WATER-SPATIAL'
150 cmd
= ['WATER-SPATIAL']
151 if options
.numcpus
==1:
152 input = options
.rootdir
+ '/apps/water-spatial/input'
154 input = options
.rootdir
+ '/apps/water-spatial/input.p' + str(options
.numcpus
)
155 cwd
= options
.rootdir
+ '/apps/water-spatial'
157 # --------------------
158 # Base L1 Cache Definition
159 # ====================
162 latency
= options
.l1latency
166 # ----------------------
167 # Base L2 Cache Definition
168 # ----------------------
171 latency
= options
.l2latency
176 # ----------------------
178 # ----------------------
180 busFrequency
= Frequency(options
.frequency
)
183 cpus
= [TimingSimpleCPU(cpu_id
= i
,
184 clock
=options
.frequency
)
185 for i
in xrange(options
.numcpus
)]
186 elif options
.detailed
:
187 cpus
= [DerivO3CPU(cpu_id
= i
,
188 clock
=options
.frequency
)
189 for i
in xrange(options
.numcpus
)]
191 cpus
= [AtomicSimpleCPU(cpu_id
= i
,
192 clock
=options
.frequency
)
193 for i
in xrange(options
.numcpus
)]
195 # ----------------------
196 # Create a system, and add system wide objects
197 # ----------------------
198 system
= System(cpu
= cpus
, physmem
= SimpleMemory(),
199 membus
= CoherentXBar(clock
= busFrequency
))
200 system
.clock
= '1GHz'
202 system
.toL2bus
= CoherentXBar(clock
= busFrequency
)
203 system
.l2
= L2(size
= options
.l2size
, assoc
= 8)
205 # ----------------------
206 # Connect the L2 cache and memory together
207 # ----------------------
209 system
.physmem
.port
= system
.membus
.master
210 system
.l2
.cpu_side
= system
.toL2bus
.master
211 system
.l2
.mem_side
= system
.membus
.slave
212 system
.system_port
= system
.membus
.slave
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))
220 # connect cpu level-1 caches to shared level-2 cache
221 cpu
.connectAllPorts(system
.toL2bus
, system
.membus
)
224 # ----------------------
226 # ----------------------
228 root
= Root(full_system
= False, system
= system
)
230 # --------------------
231 # Pick the correct Splash2 Benchmarks
232 # ====================
233 if options
.benchmark
== 'Cholesky':
234 root
.workload
= Cholesky()
235 elif options
.benchmark
== 'FFT':
236 root
.workload
= FFT()
237 elif options
.benchmark
== 'LUContig':
238 root
.workload
= LU_contig()
239 elif options
.benchmark
== 'LUNoncontig':
240 root
.workload
= LU_noncontig()
241 elif options
.benchmark
== 'Radix':
242 root
.workload
= Radix()
243 elif options
.benchmark
== 'Barnes':
244 root
.workload
= Barnes()
245 elif options
.benchmark
== 'FMM':
246 root
.workload
= FMM()
247 elif options
.benchmark
== 'OceanContig':
248 root
.workload
= Ocean_contig()
249 elif options
.benchmark
== 'OceanNoncontig':
250 root
.workload
= Ocean_noncontig()
251 elif options
.benchmark
== 'Raytrace':
252 root
.workload
= Raytrace()
253 elif options
.benchmark
== 'WaterNSquared':
254 root
.workload
= Water_nsquared()
255 elif options
.benchmark
== 'WaterSpatial':
256 root
.workload
= Water_spatial()
258 print >> sys
.stderr
, """The --benchmark environment variable was set to something improper.
259 Use Cholesky, FFT, LUContig, LUNoncontig, Radix, Barnes, FMM, OceanContig,
260 OceanNoncontig, Raytrace, WaterNSquared, or WaterSpatial"""
263 # --------------------
264 # Assign the workload to the cpus
265 # ====================
268 cpu
.workload
= root
.workload
270 # ----------------------
272 # ----------------------
274 if options
.timing
or options
.detailed
:
275 root
.system
.mem_mode
= 'timing'
277 # instantiate configuration
280 # simulate until program terminates
282 exit_event
= m5
.simulate(options
.maxtick
)
284 exit_event
= m5
.simulate(m5
.MaxTick
)
286 print 'Exiting @ tick', m5
.curTick(), 'because', exit_event
.getCause()