1 # Copyright (c) 2006-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
38 from m5
.objects
import *
40 m5
.util
.addToPath('../common')
42 # --------------------
43 # Define Command Line Options
44 # ====================
46 parser
= optparse
.OptionParser()
48 parser
.add_option("-d", "--detailed", action
="store_true")
49 parser
.add_option("-t", "--timing", action
="store_true")
50 parser
.add_option("-m", "--maxtick", type="int")
51 parser
.add_option("-c", "--numclusters",
52 help="Number of clusters", type="int")
53 parser
.add_option("-n", "--numcpus",
54 help="Number of cpus in total", type="int")
55 parser
.add_option("-f", "--frequency",
57 help="Frequency of each CPU")
58 parser
.add_option("--l1size",
60 parser
.add_option("--l1latency",
62 parser
.add_option("--l2size",
64 parser
.add_option("--l2latency",
66 parser
.add_option("--rootdir",
67 help="ROot directory of Splash2",
68 default
="/dist/splash2/codes/")
69 parser
.add_option("-b", "--benchmark",
70 help="Splash 2 benchmark to run")
72 (options
, args
) = parser
.parse_args()
75 print "Error: script doesn't take any positional arguments"
78 # --------------------
79 # Define Splash2 Benchmarks
80 # ====================
81 class Cholesky(LiveProcess
):
82 executable
= options
.rootdir
+ '/kernels/cholesky/CHOLESKY'
83 cmd
= 'CHOLESKY -p' + str(options
.numcpus
) + ' '\
84 + options
.rootdir
+ '/kernels/cholesky/inputs/tk23.O'
86 class FFT(LiveProcess
):
87 executable
= options
.rootdir
+ 'kernels/fft/FFT'
88 cmd
= 'FFT -p' + str(options
.numcpus
) + ' -m18'
90 class LU_contig(LiveProcess
):
91 executable
= options
.rootdir
+ 'kernels/lu/contiguous_blocks/LU'
92 cmd
= 'LU -p' + str(options
.numcpus
)
94 class LU_noncontig(LiveProcess
):
95 executable
= options
.rootdir
+ 'kernels/lu/non_contiguous_blocks/LU'
96 cmd
= 'LU -p' + str(options
.numcpus
)
98 class Radix(LiveProcess
):
99 executable
= options
.rootdir
+ 'kernels/radix/RADIX'
100 cmd
= 'RADIX -n524288 -p' + str(options
.numcpus
)
102 class Barnes(LiveProcess
):
103 executable
= options
.rootdir
+ 'apps/barnes/BARNES'
105 input = options
.rootdir
+ 'apps/barnes/input.p' + str(options
.numcpus
)
107 class FMM(LiveProcess
):
108 executable
= options
.rootdir
+ 'apps/fmm/FMM'
110 input = options
.rootdir
+ 'apps/fmm/inputs/input.2048.p' + str(options
.numcpus
)
112 class Ocean_contig(LiveProcess
):
113 executable
= options
.rootdir
+ 'apps/ocean/contiguous_partitions/OCEAN'
114 cmd
= 'OCEAN -p' + str(options
.numcpus
)
116 class Ocean_noncontig(LiveProcess
):
117 executable
= options
.rootdir
+ 'apps/ocean/non_contiguous_partitions/OCEAN'
118 cmd
= 'OCEAN -p' + str(options
.numcpus
)
120 class Raytrace(LiveProcess
):
121 executable
= options
.rootdir
+ 'apps/raytrace/RAYTRACE'
122 cmd
= 'RAYTRACE -p' + str(options
.numcpus
) + ' ' \
123 + options
.rootdir
+ 'apps/raytrace/inputs/teapot.env'
125 class Water_nsquared(LiveProcess
):
126 executable
= options
.rootdir
+ 'apps/water-nsquared/WATER-NSQUARED'
127 cmd
= 'WATER-NSQUARED'
128 input = options
.rootdir
+ 'apps/water-nsquared/input.p' + str(options
.numcpus
)
130 class Water_spatial(LiveProcess
):
131 executable
= options
.rootdir
+ 'apps/water-spatial/WATER-SPATIAL'
132 cmd
= 'WATER-SPATIAL'
133 input = options
.rootdir
+ 'apps/water-spatial/input.p' + str(options
.numcpus
)
136 # --------------------
137 # Base L1 Cache Definition
138 # ====================
141 latency
= options
.l1latency
145 # ----------------------
146 # Base L2 Cache Definition
147 # ----------------------
150 latency
= options
.l2latency
155 # ----------------------
156 # Define the clusters with their cpus
157 # ----------------------
161 cpusPerCluster
= options
.numcpus
/options
.numclusters
163 busFrequency
= Frequency(options
.frequency
)
164 busFrequency
*= cpusPerCluster
170 clusters
= [ Cluster() for i
in xrange(options
.numclusters
)]
171 for j
in xrange(options
.numclusters
):
173 for cluster
in clusters
:
174 cluster
.clusterbus
= CoherentXBar(clock
=busFrequency
)
175 all_l1buses
+= [cluster
.clusterbus
]
176 cluster
.cpus
= [TimingSimpleCPU(cpu_id
= i
+ cluster
.id,
177 clock
=options
.frequency
)
178 for i
in xrange(cpusPerCluster
)]
179 all_cpus
+= cluster
.cpus
180 cluster
.l1
= L1(size
=options
.l1size
, assoc
= 4)
181 all_l1s
+= [cluster
.l1
]
182 elif options
.detailed
:
183 clusters
= [ Cluster() for i
in xrange(options
.numclusters
)]
184 for j
in xrange(options
.numclusters
):
186 for cluster
in clusters
:
187 cluster
.clusterbus
= CoherentXBar(clock
=busFrequency
)
188 all_l1buses
+= [cluster
.clusterbus
]
189 cluster
.cpus
= [DerivO3CPU(cpu_id
= i
+ cluster
.id,
190 clock
=options
.frequency
)
191 for i
in xrange(cpusPerCluster
)]
192 all_cpus
+= cluster
.cpus
193 cluster
.l1
= L1(size
=options
.l1size
, assoc
= 4)
194 all_l1s
+= [cluster
.l1
]
196 clusters
= [ Cluster() for i
in xrange(options
.numclusters
)]
197 for j
in xrange(options
.numclusters
):
199 for cluster
in clusters
:
200 cluster
.clusterbus
= CoherentXBar(clock
=busFrequency
)
201 all_l1buses
+= [cluster
.clusterbus
]
202 cluster
.cpus
= [AtomicSimpleCPU(cpu_id
= i
+ cluster
.id,
203 clock
=options
.frequency
)
204 for i
in xrange(cpusPerCluster
)]
205 all_cpus
+= cluster
.cpus
206 cluster
.l1
= L1(size
=options
.l1size
, assoc
= 4)
207 all_l1s
+= [cluster
.l1
]
209 # ----------------------
210 # Create a system, and add system wide objects
211 # ----------------------
212 system
= System(cpu
= all_cpus
, l1_
= all_l1s
, l1bus_
= all_l1buses
,
213 physmem
= SimpleMemory(),
214 membus
= CoherentXBar(clock
= busFrequency
))
215 system
.clock
= '1GHz'
217 system
.toL2bus
= CoherentXBar(clock
= busFrequency
)
218 system
.l2
= L2(size
= options
.l2size
, assoc
= 8)
220 # ----------------------
221 # Connect the L2 cache and memory together
222 # ----------------------
224 system
.physmem
.port
= system
.membus
.master
225 system
.l2
.cpu_side
= system
.toL2bus
.slave
226 system
.l2
.mem_side
= system
.membus
.master
228 # ----------------------
229 # Connect the L2 cache and clusters together
230 # ----------------------
231 for cluster
in clusters
:
232 cluster
.l1
.cpu_side
= cluster
.clusterbus
.master
233 cluster
.l1
.mem_side
= system
.toL2bus
.slave
234 for cpu
in cluster
.cpus
:
235 cpu
.icache_port
= cluster
.clusterbus
.slave
236 cpu
.dcache_port
= cluster
.clusterbus
.slave
238 # ----------------------
240 # ----------------------
242 root
= Root(full_system
= False, system
= system
)
244 # --------------------
245 # Pick the correct Splash2 Benchmarks
246 # ====================
247 if options
.benchmark
== 'Cholesky':
248 root
.workload
= Cholesky()
249 elif options
.benchmark
== 'FFT':
250 root
.workload
= FFT()
251 elif options
.benchmark
== 'LUContig':
252 root
.workload
= LU_contig()
253 elif options
.benchmark
== 'LUNoncontig':
254 root
.workload
= LU_noncontig()
255 elif options
.benchmark
== 'Radix':
256 root
.workload
= Radix()
257 elif options
.benchmark
== 'Barnes':
258 root
.workload
= Barnes()
259 elif options
.benchmark
== 'FMM':
260 root
.workload
= FMM()
261 elif options
.benchmark
== 'OceanContig':
262 root
.workload
= Ocean_contig()
263 elif options
.benchmark
== 'OceanNoncontig':
264 root
.workload
= Ocean_noncontig()
265 elif options
.benchmark
== 'Raytrace':
266 root
.workload
= Raytrace()
267 elif options
.benchmark
== 'WaterNSquared':
268 root
.workload
= Water_nsquared()
269 elif options
.benchmark
== 'WaterSpatial':
270 root
.workload
= Water_spatial()
273 The --benchmark environment variable was set to something improper.
274 Use Cholesky, FFT, LUContig, LUNoncontig, Radix, Barnes, FMM, OceanContig,
275 OceanNoncontig, Raytrace, WaterNSquared, or WaterSpatial
278 # --------------------
279 # Assign the workload to the cpus
280 # ====================
282 for cluster
in clusters
:
283 for cpu
in cluster
.cpus
:
284 cpu
.workload
= root
.workload
286 # ----------------------
288 # ----------------------
290 if options
.timing
or options
.detailed
:
291 root
.system
.mem_mode
= 'timing'
293 # instantiate configuration
296 # simulate until program terminates
298 exit_event
= m5
.simulate(options
.maxtick
)
300 exit_event
= m5
.simulate(m5
.MaxTick
)
302 print 'Exiting @ tick', m5
.curTick(), 'because', exit_event
.getCause()