443399234a51d20cc5dde5b5996dad941e0219a7
1 # Copyright (c) 2006-2008 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: Nathan Binkert
31 from os
.path
import basename
, exists
, join
as joinpath
, normpath
32 from os
.path
import isdir
, isfile
, islink
34 spec_dist
= os
.environ
.get('M5_CPU2000', '/dist/m5/cpu2000')
36 def copyfiles(srcdir
, dstdir
):
37 from filecmp
import cmp as filecmp
38 from shutil
import copyfile
40 srcdir
= normpath(srcdir
)
41 dstdir
= normpath(dstdir
)
46 for root
, dirs
, files
in os
.walk(srcdir
):
48 prefix
= os
.path
.commonprefix([root
, srcdir
])
50 root
= root
[len(prefix
):]
51 if root
.startswith('/'):
55 newdir
= joinpath(dstdir
, root
, entry
)
60 dest
= normpath(joinpath(dstdir
, root
, entry
))
61 src
= normpath(joinpath(srcdir
, root
, entry
))
62 if not isfile(dest
) or not filecmp(src
, dest
):
65 # some of the spec benchmarks expect to be run from one directory up.
66 # just create some symlinks that solve the problem
67 inlink
= joinpath(dstdir
, 'input')
68 outlink
= joinpath(dstdir
, 'output')
69 if not exists(inlink
):
70 os
.symlink('.', inlink
)
71 if not exists(outlink
):
72 os
.symlink('.', outlink
)
74 class Benchmark(object):
75 def __init__(self
, isa
, os
, input_set
):
76 if not hasattr(self
.__class
__, 'name'):
77 self
.name
= self
.__class
__.__name
__
79 if not hasattr(self
.__class
__, 'binary'):
80 self
.binary
= self
.name
82 if not hasattr(self
.__class
__, 'args'):
85 if not hasattr(self
.__class
__, 'output'):
86 self
.output
= '%s.out' % self
.name
88 if not hasattr(self
.__class
__, 'simpoint'):
92 func
= getattr(self
.__class
__, input_set
)
93 except AttributeError:
94 raise AttributeError, \
95 'The benchmark %s does not have the %s input set' % \
96 (self
.name
, input_set
)
98 executable
= joinpath(spec_dist
, 'binaries', isa
, os
, self
.binary
)
99 if not isfile(executable
):
100 raise AttributeError, '%s not found' % executable
101 self
.executable
= executable
103 # root of tree for input & output data files
104 data_dir
= joinpath(spec_dist
, 'data', self
.name
)
105 # optional subtree with files shared across input sets
106 all_dir
= joinpath(data_dir
, 'all')
107 # dirs for input & output files for this input set
108 inputs_dir
= joinpath(data_dir
, input_set
, 'input')
109 outputs_dir
= joinpath(data_dir
, input_set
, 'output')
110 # keep around which input set was specified
111 self
.input_set
= input_set
113 if not isdir(inputs_dir
):
114 raise AttributeError, '%s not found' % inputs_dir
116 self
.inputs_dir
= [ inputs_dir
]
118 self
.inputs_dir
+= [ joinpath(all_dir
, 'input') ]
119 if isdir(outputs_dir
):
120 self
.outputs_dir
= outputs_dir
122 if not hasattr(self
.__class
__, 'stdin'):
123 self
.stdin
= joinpath(inputs_dir
, '%s.in' % self
.name
)
124 if not isfile(self
.stdin
):
127 if not hasattr(self
.__class
__, 'stdout'):
128 self
.stdout
= joinpath(outputs_dir
, '%s.out' % self
.name
)
129 if not isfile(self
.stdout
):
134 def makeLiveProcessArgs(self
, **kwargs
):
135 # set up default args for LiveProcess object
137 process_args
['cmd'] = [ self
.name
] + self
.args
138 process_args
['executable'] = self
.executable
140 process_args
['input'] = self
.stdin
142 process_args
['output'] = self
.stdout
144 process_args
['simpoint'] = self
.simpoint
145 # explicit keywords override defaults
146 process_args
.update(kwargs
)
150 def makeLiveProcess(self
, **kwargs
):
151 process_args
= self
.makeLiveProcessArgs(**kwargs
)
153 # figure out working directory: use m5's outdir unless
154 # overridden by LiveProcess's cwd param
155 cwd
= process_args
.get('cwd')
158 from m5
import options
160 process_args
['cwd'] = cwd
163 # copy input files to working directory
164 for d
in self
.inputs_dir
:
166 # generate LiveProcess object
167 from m5
.objects
import LiveProcess
168 return LiveProcess(**process_args
)
173 class DefaultBenchmark(Benchmark
):
174 def ref(self
, isa
, os
): pass
175 def test(self
, isa
, os
): pass
176 def train(self
, isa
, os
): pass
178 class MinneDefaultBenchmark(DefaultBenchmark
):
179 def smred(self
, isa
, os
): pass
180 def mdred(self
, isa
, os
): pass
181 def lgred(self
, isa
, os
): pass
183 class ammp(MinneDefaultBenchmark
):
189 class applu(MinneDefaultBenchmark
):
193 simpoint
= 2179*100E6
195 class apsi(MinneDefaultBenchmark
):
199 simpoint
= 3408*100E6
201 class art(DefaultBenchmark
):
206 def test(self
, isa
, os
):
207 self
.args
= [ '-scanfile', 'c756hel.in',
208 '-trainfile1', 'a10.img',
215 self
.output
= 'test.out'
217 def train(self
, isa
, os
):
218 self
.args
= [ '-scanfile', 'c756hel.in',
219 '-trainfile1', 'a10.img',
226 self
.output
= 'train.out'
228 def lgred(self
, isa
, os
):
229 self
.args
= ['-scanfile', 'c756hel.in',
230 '-trainfile1', 'a10.img',
237 self
.output
= 'lgred.out'
241 def ref(self
, isa
, os
):
242 self
.args
= [ '-scanfile', 'c756hel.in',
243 '-trainfile1', 'a10.img',
244 '-trainfile2', 'hc.img',
251 self
.output
= 'ref.1.out'
252 self
.simpoint
= 340*100E6
255 def ref(self
, isa
, os
):
256 self
.args
= [ '-scanfile', 'c756hel.in',
257 '-trainfile1', 'a10.img',
258 '-trainfile2', 'hc.img',
265 self
.output
= 'ref.2.out'
266 self
.simpoint
= 365*100E6
268 class equake(DefaultBenchmark
):
274 def lgred(self
, isa
, os
): pass
276 class facerec(MinneDefaultBenchmark
):
282 class fma3d(MinneDefaultBenchmark
):
286 simpoint
= 2541*100E6
288 class galgel(MinneDefaultBenchmark
):
292 simpoint
= 2491*100E6
294 class lucas(MinneDefaultBenchmark
):
300 class mesa(Benchmark
):
306 def __set_args(self
, frames
):
307 self
.args
= [ '-frames', frames
, '-meshfile', '%s.in' % self
.name
,
308 '-ppmfile', '%s.ppm' % self
.name
]
310 def test(self
, isa
, os
):
311 self
.__set
_args
('10')
313 def train(self
, isa
, os
):
314 self
.__set
_args
('500')
316 def ref(self
, isa
, os
):
317 self
.__set
_args
('1000')
318 self
.simpoint
= 1135*100E6
320 def lgred(self
, isa
, os
):
323 class mgrid(MinneDefaultBenchmark
):
327 simpoint
= 3292*100E6
329 class sixtrack(DefaultBenchmark
):
333 simpoint
= 3043*100E6
335 def lgred(self
, isa
, os
): pass
337 class swim(MinneDefaultBenchmark
):
341 simpoint
= 2079*100E6
343 class wupwise(DefaultBenchmark
):
347 simpoint
= 3237*100E6
349 def lgred(self
, isa
, os
): pass
351 class bzip2(DefaultBenchmark
):
356 def test(self
, isa
, os
):
357 self
.args
= [ 'input.random' ]
359 def train(self
, isa
, os
):
360 self
.args
= [ 'input.compressed' ]
362 class bzip2_source(bzip2
):
363 def ref(self
, isa
, os
):
364 self
.simpoint
= 977*100E6
365 self
.args
= [ 'input.source', '58' ]
367 def lgred(self
, isa
, os
):
368 self
.args
= [ 'input.source', '1' ]
370 class bzip2_graphic(bzip2
):
371 def ref(self
, isa
, os
):
372 self
.simpoint
= 718*100E6
373 self
.args
= [ 'input.graphic', '58' ]
375 def lgred(self
, isa
, os
):
376 self
.args
= [ 'input.graphic', '1' ]
378 class bzip2_program(bzip2
):
379 def ref(self
, isa
, os
):
380 self
.simpoint
= 458*100E6
381 self
.args
= [ 'input.program', '58' ]
383 def lgred(self
, isa
, os
):
384 self
.args
= [ 'input.program', '1' ]
386 class crafty(MinneDefaultBenchmark
):
392 class eon(MinneDefaultBenchmark
):
398 class eon_kajiya(eon
):
399 args
= [ 'chair.control.kajiya', 'chair.camera', 'chair.surfaces',
400 'chair.kajiya.ppm', 'ppm', 'pixels_out.kajiya']
401 output
= 'kajiya_log.out'
405 args
= [ 'chair.control.cook', 'chair.camera', 'chair.surfaces',
406 'chair.cook.ppm', 'ppm', 'pixels_out.cook' ]
407 output
= 'cook_log.out'
409 class eon_rushmeier(eon
):
410 args
= [ 'chair.control.rushmeier', 'chair.camera', 'chair.surfaces',
411 'chair.rushmeier.ppm', 'ppm', 'pixels_out.rushmeier' ]
412 output
= 'rushmeier_log.out'
415 class gap(DefaultBenchmark
):
420 def __set_args(self
, size
):
421 self
.args
= [ '-l', './', '-q', '-m', size
]
423 def test(self
, isa
, os
):
424 self
.__set
_args
('64M')
426 def train(self
, isa
, os
):
427 self
.__set
_args
('128M')
429 def ref(self
, isa
, os
):
430 self
.__set
_args
('192M')
431 self
.simpoint
= 674*100E6
433 def lgred(self
, isa
, os
):
434 self
.__set
_args
('64M')
436 def mdred(self
, isa
, os
):
437 self
.__set
_args
('64M')
439 def smred(self
, isa
, os
):
440 self
.__set
_args
('64M')
442 class gcc(DefaultBenchmark
):
447 def test(self
, isa
, os
):
448 self
.args
= [ 'cccp.i', '-o', 'cccp.s' ]
450 def train(self
, isa
, os
):
451 self
.args
= [ 'cp-decl.i', '-o', 'cp-decl.s' ]
453 def smred(self
, isa
, os
):
454 self
.args
= [ 'c-iterate.i', '-o', 'c-iterate.s' ]
456 def mdred(self
, isa
, os
):
457 self
.args
= [ 'rdlanal.i', '-o', 'rdlanal.s' ]
459 def lgred(self
, isa
, os
):
460 self
.args
= [ 'cp-decl.i', '-o', 'cp-decl.s' ]
463 def ref(self
, isa
, os
):
464 self
.simpoint
= 389*100E6
465 self
.args
= [ '166.i', '-o', '166.s' ]
468 def ref(self
, isa
, os
):
469 self
.simpoint
= 736*100E6
470 self
.args
= [ '200.i', '-o', '200.s' ]
473 def ref(self
, isa
, os
):
474 self
.simpoint
= 36*100E6
475 self
.args
= [ 'expr.i', '-o', 'expr.s' ]
477 class gcc_integrate(gcc
):
478 def ref(self
, isa
, os
):
479 self
.simpoint
= 4*100E6
480 self
.args
= [ 'integrate.i', '-o', 'integrate.s' ]
482 class gcc_scilab(gcc
):
483 def ref(self
, isa
, os
):
484 self
.simpoint
= 207*100E6
485 self
.args
= [ 'scilab.i', '-o', 'scilab.s' ]
487 class gzip(DefaultBenchmark
):
492 def test(self
, isa
, os
):
493 self
.args
= [ 'input.compressed', '2' ]
495 def train(self
, isa
, os
):
496 self
.args
= [ 'input.combined', '32' ]
498 class gzip_source(gzip
):
499 def ref(self
, isa
, os
):
500 self
.simpoint
= 334*100E6
501 self
.args
= [ 'input.source', '1' ]
502 def smred(self
, isa
, os
):
503 self
.args
= [ 'input.source', '1' ]
504 def mdred(self
, isa
, os
):
505 self
.args
= [ 'input.source', '1' ]
506 def lgred(self
, isa
, os
):
507 self
.args
= [ 'input.source', '1' ]
509 class gzip_log(gzip
):
510 def ref(self
, isa
, os
):
511 self
.simpoint
= 265*100E6
512 self
.args
= [ 'input.log', '60' ]
513 def smred(self
, isa
, os
):
514 self
.args
= [ 'input.log', '1' ]
515 def mdred(self
, isa
, os
):
516 self
.args
= [ 'input.log', '1' ]
517 def lgred(self
, isa
, os
):
518 self
.args
= [ 'input.log', '1' ]
520 class gzip_graphic(gzip
):
521 def ref(self
, isa
, os
):
522 self
.simpoint
= 653*100E6
523 self
.args
= [ 'input.graphic', '60' ]
524 def smred(self
, isa
, os
):
525 self
.args
= [ 'input.graphic', '1' ]
526 def mdred(self
, isa
, os
):
527 self
.args
= [ 'input.graphic', '1' ]
528 def lgred(self
, isa
, os
):
529 self
.args
= [ 'input.graphic', '1' ]
531 class gzip_random(gzip
):
532 def ref(self
, isa
, os
):
533 self
.simpoint
= 623*100E6
534 self
.args
= [ 'input.random', '60' ]
535 def smred(self
, isa
, os
):
536 self
.args
= [ 'input.random', '1' ]
537 def mdred(self
, isa
, os
):
538 self
.args
= [ 'input.random', '1' ]
539 def lgred(self
, isa
, os
):
540 self
.args
= [ 'input.random', '1' ]
542 class gzip_program(gzip
):
543 def ref(self
, isa
, os
):
544 self
.simpoint
= 1189*100E6
545 self
.args
= [ 'input.program', '60' ]
546 def smred(self
, isa
, os
):
547 self
.args
= [ 'input.program', '1' ]
548 def mdred(self
, isa
, os
):
549 self
.args
= [ 'input.program', '1' ]
550 def lgred(self
, isa
, os
):
551 self
.args
= [ 'input.program', '1' ]
553 class mcf(MinneDefaultBenchmark
):
560 class parser(MinneDefaultBenchmark
):
564 args
= [ '2.1.dict', '-batch' ]
565 simpoint
= 1146*100E6
567 class perlbmk(DefaultBenchmark
):
572 def test(self
, isa
, os
):
573 self
.args
= [ '-I.', '-I', 'lib', 'test.pl' ]
574 self
.stdin
= 'test.in'
576 class perlbmk_diffmail(perlbmk
):
577 def ref(self
, isa
, os
):
578 self
.simpoint
= 141*100E6
579 self
.args
= [ '-I', 'lib', 'diffmail.pl', '2', '550', '15', '24',
582 def train(self
, isa
, os
):
583 self
.args
= [ '-I', 'lib', 'diffmail.pl', '2', '350', '15', '24',
586 class perlbmk_scrabbl(perlbmk
):
587 def train(self
, isa
, os
):
588 self
.args
= [ '-I.', '-I', 'lib', 'scrabbl.pl' ]
589 self
.stdin
= 'scrabbl.in'
591 class perlbmk_makerand(perlbmk
):
592 def ref(self
, isa
, os
):
593 self
.simpoint
= 11*100E6
594 self
.args
= [ '-I', 'lib', 'makerand.pl' ]
596 def lgred(self
, isa
, os
):
597 self
.args
= [ '-I.', '-I', 'lib', 'lgred.makerand.pl' ]
599 def mdred(self
, isa
, os
):
600 self
.args
= [ '-I.', '-I', 'lib', 'mdred.makerand.pl' ]
602 def smred(self
, isa
, os
):
603 self
.args
= [ '-I.', '-I', 'lib', 'smred.makerand.pl' ]
605 class perlbmk_perfect(perlbmk
):
606 def ref(self
, isa
, os
):
607 self
.simpoint
= 5*100E6
608 self
.args
= [ '-I', 'lib', 'perfect.pl', 'b', '3', 'm', '4' ]
610 def train(self
, isa
, os
):
611 self
.args
= [ '-I', 'lib', 'perfect.pl', 'b', '3' ]
613 class perlbmk_splitmail1(perlbmk
):
614 def ref(self
, isa
, os
):
615 self
.simpoint
= 405*100E6
616 self
.args
= [ '-I', 'lib', 'splitmail.pl', '850', '5', '19',
619 class perlbmk_splitmail2(perlbmk
):
620 def ref(self
, isa
, os
):
621 self
.args
= [ '-I', 'lib', 'splitmail.pl', '704', '12', '26',
624 class perlbmk_splitmail3(perlbmk
):
625 def ref(self
, isa
, os
):
626 self
.args
= [ '-I', 'lib', 'splitmail.pl', '535', '13', '25',
629 class perlbmk_splitmail4(perlbmk
):
630 def ref(self
, isa
, os
):
631 self
.args
= [ '-I', 'lib', 'splitmail.pl', '957', '12', '23',
634 class twolf(Benchmark
):
640 def test(self
, isa
, os
):
641 self
.args
= [ 'test' ]
643 def train(self
, isa
, os
):
644 self
.args
= [ 'train' ]
646 def ref(self
, isa
, os
):
647 self
.simpoint
= 1066*100E6
648 self
.args
= [ 'ref' ]
650 def smred(self
, isa
, os
):
651 self
.args
= [ 'smred' ]
653 def mdred(self
, isa
, os
):
654 self
.args
= [ 'mdred' ]
656 def lgred(self
, isa
, os
):
657 self
.args
= [ 'lgred' ]
659 class vortex(Benchmark
):
665 def __init__(self
, isa
, os
, input_set
):
666 if (isa
== 'alpha' or isa
== 'arm'):
667 self
.endian
= 'lendian'
668 elif (isa
== 'sparc' or isa
== 'sparc32'):
669 self
.endian
= 'bendian'
671 raise AttributeError, "unknown ISA %s" % isa
673 super(vortex
, self
).__init
__(isa
, os
, input_set
)
675 def test(self
, isa
, os
):
676 self
.args
= [ '%s.raw' % self
.endian
]
677 self
.output
= 'vortex.out'
679 def train(self
, isa
, os
):
680 self
.args
= [ '%s.raw' % self
.endian
]
681 self
.output
= 'vortex.out'
683 def smred(self
, isa
, os
):
684 self
.args
= [ '%s.raw' % self
.endian
]
685 self
.output
= 'vortex.out'
687 def mdred(self
, isa
, os
):
688 self
.args
= [ '%s.raw' % self
.endian
]
689 self
.output
= 'vortex.out'
691 def lgred(self
, isa
, os
):
692 self
.args
= [ '%s.raw' % self
.endian
]
693 self
.output
= 'vortex.out'
695 class vortex1(vortex
):
696 def ref(self
, isa
, os
):
697 self
.args
= [ '%s1.raw' % self
.endian
]
698 self
.output
= 'vortex1.out'
699 self
.simpoint
= 271*100E6
702 class vortex2(vortex
):
703 def ref(self
, isa
, os
):
704 self
.simpoint
= 1024*100E6
705 self
.args
= [ '%s2.raw' % self
.endian
]
706 self
.output
= 'vortex2.out'
708 class vortex3(vortex
):
709 def ref(self
, isa
, os
):
710 self
.simpoint
= 564*100E6
711 self
.args
= [ '%s3.raw' % self
.endian
]
712 self
.output
= 'vortex3.out'
714 class vpr(MinneDefaultBenchmark
):
719 # not sure about vpr minnespec place.in
720 class vpr_place(vpr
):
721 args
= [ 'net.in', 'arch.in', 'place.out', 'dum.out', '-nodisp',
722 '-place_only', '-init_t', '5', '-exit_t', '0.005',
723 '-alpha_t', '0.9412', '-inner_num', '2' ]
724 output
= 'place_log.out'
726 class vpr_route(vpr
):
728 args
= [ 'net.in', 'arch.in', 'place.in', 'route.out', '-nodisp',
729 '-route_only', '-route_chan_width', '15',
730 '-pres_fac_mult', '2', '-acc_fac', '1',
731 '-first_iter_pres_fac', '4', '-initial_pres_fac', '8' ]
732 output
= 'route_log.out'
734 all
= [ ammp
, applu
, apsi
, art
, art110
, art470
, equake
, facerec
, fma3d
, galgel
,
735 lucas
, mesa
, mgrid
, sixtrack
, swim
, wupwise
, bzip2_source
,
736 bzip2_graphic
, bzip2_program
, crafty
, eon_kajiya
, eon_cook
,
737 eon_rushmeier
, gap
, gcc_166
, gcc_200
, gcc_expr
, gcc_integrate
,
738 gcc_scilab
, gzip_source
, gzip_log
, gzip_graphic
, gzip_random
,
739 gzip_program
, mcf
, parser
, perlbmk_diffmail
, perlbmk_makerand
,
740 perlbmk_perfect
, perlbmk_splitmail1
, perlbmk_splitmail2
,
741 perlbmk_splitmail3
, perlbmk_splitmail4
, twolf
, vortex1
, vortex2
,
742 vortex3
, vpr_place
, vpr_route
]
744 __all__
= [ x
.__name
__ for x
in all
]
746 if __name__
== '__main__':
747 from pprint
import pprint
749 for input_set
in 'ref', 'test', 'train':
750 print 'class: %s' % bench
.__name
__
751 x
= bench('alpha', 'tru64', input_set
)
752 print '%s: %s' % (x
, input_set
)
753 pprint(x
.makeLiveProcessArgs())