问题来源:为了模拟和测试cpu架构的性能,故摸索了下gem5下如何运行spec2006的。

步骤一 (编译spec2006):
1. 购买或下载spec2006源码;
2. 参考Docs/install-guide-unix.html中的方法安装,进入spec2006目录,执行 ./install.sh,然后选择y执行;
3. 执行 . ./shrc (注意是点,空格,点,斜杠shrc。此为bash编译系统);
4. 测试是否安装成功。runspec –config=macosx-ia32-iccifortv91.cfg –action=build –tune=base bzip2;
5. 看到提示成功信息即可,现在可在benchspec/CPU2006/401.bzip2/目录下看到生成的文件;

为了使spec在alpha架构下运行,需要进行交叉编译(已经预编译好的交叉工具链gcc-4.3.2,glibc-2.6.1(NPTL,x86/32),gcc-4.3.2, glibc-2.6.1 (NPTL,x86/64)):
1.在spec/configs/下复制一份副本cp linux32-i386-gcc42.cfg my-alpha.cfg
2.修改编译环境:

For example:CC =  /home/mjwu/crosstool/gcc-4.1.0-glibc-2.3.6/alpha/bin/alpha-gcc CXX = /home/mjwu/crosstool/gcc-4.1.0-glibc-2.3.6/alpha/bin/alpha-g++ FC =  /home/mjwu/crosstool/gcc-4.1.0-glibc-2.3.6/alpha/bin/alpha-gfortran# gem5下运行spec需要静态编译的,而默认是动态编译需加上static
default=base=default=default:
COPTIMIZE     = -O2 -static
CXXOPTIMIZE  = -O2 -static
FOPTIMIZE    = -O2 -static

3.生成二进制文件:

runspec --config=my-alpha.cfg --size=ref --noreportable --tune=base --iterations=1 bzip2

4.基于alpha体系结构的测试集就准备好了,下一步就是在gem5中运行。


步骤二(gem5中运行spec2006):
说明:通常在gem5中以se模式运行spec2006,基本上已经足够运行,很少有人在fs模式下运行。因为spec2006是单线程,cpu内存密集型测试集。参考:mailing list的说明

以下步骤参考:tutorial-easily-running-spec-cpu2006-benchmarks-in-the-gem5-simulator
1.在gem5/configs/example/目录下复制se.py;

cp se.py spec06_se.py

2.在spec2006.py第一行中加入:

import spec06_benchmarks

3.增加benchmark的选项:

parser = optparse.OptionParser()
Options.addCommonOptions(parser)
Options.addSEOptions(parser)#在后面加入下面几行选项
parser.add_option("-b", "--benchmark", type="string", default="", help="The SPEC benchmark to be loaded.")
parser.add_option("--benchmark_stdout", type="string", default="", help="Absolute path for stdout redirection for the benchmark.")
parser.add_option("--benchmark_stderr", type="string", default="", help="Absolute path for stderr redirection for the benchmark.")

4.找到multiprocesses = []将其注释掉,当作单线执行,因为spec2006的所有测试集都是单线程的应用程序。

# multiprocesses = []
numThreads = 1

5.在numThreads = 1下加入如下内容:

#增加如下选项信息
if options.benchmark:print 'Selected SPEC_CPU2006 benchmark'if options.benchmark == 'perlbench':print '--> perlbench'process = spec06_benchmarks.perlbenchelif options.benchmark == 'bzip2':print '--> bzip2'process = spec06_benchmarks.bzip2elif options.benchmark == 'gcc':print '--> gcc'process = spec06_benchmarks.gccelif options.benchmark == 'bwaves':print '--> bwaves' process = spec06_benchmarks.bwaveselif options.benchmark == 'gamess':print '--> gamess' process = spec06_benchmarks.gamesselif options.benchmark == 'mcf':print '--> mcf' process = spec06_benchmarks.mcfelif options.benchmark == 'milc':print '--> milc' process = spec06_benchmarks.milcelif options.benchmark == 'zeusmp':print '--> zeusmp' process = spec06_benchmarks.zeusmpelif options.benchmark == 'gromacs':print '--> gromacs' process = spec06_benchmarks.gromacselif options.benchmark == 'cactusADM':print '--> cactusADM' process = spec06_benchmarks.cactusADMelif options.benchmark == 'leslie3d':print '--> leslie3d' process = spec06_benchmarks.leslie3delif options.benchmark == 'namd':print '--> namd' process = spec06_benchmarks.namdelif options.benchmark == 'gobmk':print '--> gobmk' process = spec06_benchmarks.gobmkelif options.benchmark == 'dealII':print '--> dealII' process = spec06_benchmarks.dealIIelif options.benchmark == 'soplex':print '--> soplex' process = spec06_benchmarks.soplexelif options.benchmark == 'povray':print '--> povray' process = spec06_benchmarks.povrayelif options.benchmark == 'calculix':print '--> calculix' process = spec06_benchmarks.calculixelif options.benchmark == 'hmmer':print '--> hmmer' process = spec06_benchmarks.hmmerelif options.benchmark == 'sjeng':print '--> sjeng' process = spec06_benchmarks.sjengelif options.benchmark == 'GemsFDTD':print '--> GemsFDTD' process = spec06_benchmarks.GemsFDTDelif options.benchmark == 'libquantum':print '--> libquantum' process = spec06_benchmarks.libquantumelif options.benchmark == 'h264ref':print '--> h264ref' process = spec06_benchmarks.h264refelif options.benchmark == 'tonto':print '--> tonto'process = spec06_benchmarks.tontoelif options.benchmark == 'lbm':print '--> lbm'process = spec06_benchmarks.lbmelif options.benchmark == 'omnetpp':print '--> omnetpp'process = spec06_benchmarks.omnetppelif options.benchmark == 'astar':print '--> astar'process = spec06_benchmarks.astarelif options.benchmark == 'wrf':print '--> wrf'process = spec06_benchmarks.wrfelif options.benchmark == 'sphinx3':print '--> sphinx3'process = spec06_benchmarks.sphinx3elif options.benchmark == 'xalancbmk':print '--> xalancbmk'process = spec06_benchmarks.xalancbmkelif options.benchmark == 'specrand_i':print '--> specrand_i'process = spec06_benchmarks.specrand_ielif options.benchmark == 'specrand_f':print '--> specrand_f'process = spec06_benchmarks.specrand_felse:print "No recognized SPEC2006 benchmark selected! Exiting."sys.exit(1)
else:print >> sys.stderr, "Need --benchmark switch to specify SPEC CPU2006 workload. Exiting!\n"sys.exit(1)# Set process stdout/stderr
if options.benchmark_stdout:process.output = options.benchmark_stdoutprint "Process stdout file: " + process.output
if options.benchmark_stderr:process.errout = options.benchmark_stderrprint "Process stderr file: " + process.errout

6.注释掉gem5自带的benchmark;

#自带的测试集
# if options.bench:
#     apps = options.bench.split("-")
#     if len(apps) != options.num_cpus:
#         print "number of benchmarks not equal to set num_cpus!"
#         sys.exit(1)
#
#     for app in apps:
#         try:
#             if buildEnv['TARGET_ISA'] == 'alpha':
#                 exec("workload = %s('alpha', 'tru64', '%s')" % (
#                         app, options.spec_input))
#             elif buildEnv['TARGET_ISA'] == 'arm':
#                 exec("workload = %s('arm_%s', 'linux', '%s')" % (
#                         app, options.arm_iset, options.spec_input))
#             else:
#                 exec("workload = %s(buildEnv['TARGET_ISA', 'linux', '%s')" % (
#                         app, options.spec_input))
#             multiprocesses.append(workload.makeLiveProcess())
#         except:
#             print >>sys.stderr, "Unable to find workload for %s: %s" % (
#                     buildEnv['TARGET_ISA'], app)
#             sys.exit(1)
# elif options.cmd:
#     multiprocesses, numThreads = get_processes(options)
# else:
#     print >> sys.stderr, "No workload specified. Exiting!\n"
#     sys.exit(1)############ 同时注释掉如下内容,因为是单线程:############
# for i in xrange(np):
#     if options.smt:
#         system.cpu[i].workload = multiprocesses
#     elif len(multiprocesses) == 1:
#         system.cpu[i].workload = multiprocesses[0]
#     else:
#         system.cpu[i].workload = multiprocesses[i]
#
#     if options.fastmem:
#         system.cpu[i].fastmem = True
#
#     if options.simpoint_profile:
#         system.cpu[i].simpoint_profile = True
#         system.cpu[i].simpoint_interval = options.simpoint_interval
#
#     if options.checker:
#         system.cpu[i].addCheckerCpu()
#
#     system.cpu[i].createThreads()

7.在上面注释后面添加如下内容:

#因为是单线程的,直接将该测试集给处理器就可以了
for i in xrange(np): system.cpu[i].workload = process print process.cmd

8.到此为止,spec06_se.py修改完成。


接下来创建spec06_benchmarks.py文件:
1.创建该文件:

touch gem5/configs/example/spec06_benchmarks.py

2.将如下代码复制到该文件中,如下文件采取了一个benchmark一个input,且都使用了第一个 reference input,如果有不同的需求,那么请根据自己的情况修改对应的内容。

import m5
from m5.objects import *# These three directory paths are not currently used.
#gem5_dir = '<FULL_PATH_TO_YOUR_GEM5_INSTALL>'
#spec_dir = '<FULL_PATH_TO_YOUR_SPEC_CPU2006_INSTALL>'
#out_dir = '<FULL_PATH_TO_DESIRED_OUTPUT_DIRECTORY>'alpha_suffix = '_base.my-alpha'#temp
#binary_dir = spec_dir
#data_dir = spec_dir#400.perlbench
perlbench = LiveProcess()
perlbench.executable =  'perlbench' + alpha_suffix
# TEST CMDS
#perlbench.cmd = [perlbench.executable] + ['-I.', '-I./lib', 'attrs.pl']
# REF CMDS
perlbench.cmd = [perlbench.executable] + ['-I./lib', 'checkspam.pl', '2500', '5', '25', '11', '150', '1', '1', '1', '1']
#perlbench.cmd = [perlbench.executable] + ['-I./lib', 'diffmail.pl', '4', '800', '10', '17', '19', '300']
#perlbench.cmd = [perlbench.executable] + ['-I./lib', 'splitmail.pl', '1600', '12', '26', '16', '4500']
#perlbench.output = out_dir+'perlbench.out'#401.bzip2
bzip2 = LiveProcess()
bzip2.executable =  'bzip2' + alpha_suffix
# TEST CMDS
#bzip2.cmd = [bzip2.executable] + ['input.program', '5']
# REF CMDS
bzip2.cmd = [bzip2.executable] + ['input.source', '280']
#bzip2.cmd = [bzip2.executable] + ['chicken.jpg', '30']
#bzip2.cmd = [bzip2.executable] + ['liberty.jpg', '30']
#bzip2.cmd = [bzip2.executable] + ['input.program', '280']
#bzip2.cmd = [bzip2.executable] + ['text.html', '280']
#bzip2.cmd = [bzip2.executable] + ['input.combined', '200']
#bzip2.output = out_dir + 'bzip2.out'#403.gcc
gcc = LiveProcess()
gcc.executable = 'gcc' + alpha_suffix
# TEST CMDS
#gcc.cmd = [gcc.executable] + ['cccp.i', '-o', 'cccp.s']
# REF CMDS
gcc.cmd = [gcc.executable] + ['166.i', '-o', '166.s']
#gcc.cmd = [gcc.executable] + ['200.i', '-o', '200.s']
#gcc.cmd = [gcc.executable] + ['c-typeck.i', '-o', 'c-typeck.s']
#gcc.cmd = [gcc.executable] + ['cp-decl.i', '-o', 'cp-decl.s']
#gcc.cmd = [gcc.executable] + ['expr.i', '-o', 'expr.s']
#gcc.cmd = [gcc.executable] + ['expr2.i', '-o', 'expr2.s']
#gcc.cmd = [gcc.executable] + ['g23.i', '-o', 'g23.s']
#gcc.cmd = [gcc.executable] + ['s04.i', '-o', 's04.s']
#gcc.cmd = [gcc.executable] + ['scilab.i', '-o', 'scilab.s']
#gcc.output = out_dir + 'gcc.out'#410.bwaves
bwaves = LiveProcess()
bwaves.executable = 'bwaves' + alpha_suffix
# TEST CMDS
#bwaves.cmd = [bwaves.executable]
# REF CMDS
bwaves.cmd = [bwaves.executable]
#bwaves.output = out_dir + 'bwaves.out'#416.gamess
gamess=LiveProcess()
gamess.executable = 'gamess' + alpha_suffix
# TEST CMDS
#gamess.cmd = [gamess.executable]
#gamess.input = 'exam29.config'
# REF CMDS
gamess.cmd = [gamess.executable]
gamess.input = 'cytosine.2.config'
#gamess.cmd = [gamess.executable]
#gamess.input = 'h2ocu2+.gradient.config'
#gamess.cmd = [gamess.executable]
#gamess.input = 'triazolium.config'
#gamess.output = out_dir + 'gamess.out'#429.mcf
mcf = LiveProcess()
mcf.executable =  'mcf' + alpha_suffix
# TEST CMDS
#mcf.cmd = [mcf.executable] + ['inp.in']
# REF CMDS
mcf.cmd = [mcf.executable] + ['inp.in']
#mcf.output = out_dir + 'mcf.out'#433.milc
milc=LiveProcess()
milc.executable = 'milc' + alpha_suffix
# TEST CMDS
#milc.cmd = [milc.executable]
#milc.input = 'su3imp.in'
# REF CMDS
milc.cmd = [milc.executable]
milc.input = 'su3imp.in'
#milc.output = out_dir + 'milc.out'#434.zeusmp
zeusmp=LiveProcess()
zeusmp.executable = 'zeusmp' + alpha_suffix
# TEST CMDS
#zeusmp.cmd = [zeusmp.executable]
# REF CMDS
zeusmp.cmd = [zeusmp.executable]
#zeusmp.output = out_dir + 'zeusmp.out'#435.gromacs
gromacs = LiveProcess()
gromacs.executable = 'gromacs' + alpha_suffix
# TEST CMDS
#gromacs.cmd = [gromacs.executable] + ['-silent','-deffnm', 'gromacs', '-nice','0']
# REF CMDS
gromacs.cmd = [gromacs.executable] + ['-silent','-deffnm', 'gromacs', '-nice','0']
#gromacs.output = out_dir + 'gromacs.out'#436.cactusADM
cactusADM = LiveProcess()
cactusADM.executable = 'cactusADM' + alpha_suffix
# TEST CMDS
#cactusADM.cmd = [cactusADM.executable] + ['benchADM.par']
# REF CMDS
cactusADM.cmd = [cactusADM.executable] + ['benchADM.par']
#cactusADM.output = out_dir + 'cactusADM.out'#437.leslie3d
leslie3d=LiveProcess()
leslie3d.executable = 'leslie3d' + alpha_suffix
# TEST CMDS
#leslie3d.cmd = [leslie3d.executable]
#leslie3d.input = 'leslie3d.in'
# REF CMDS
leslie3d.cmd = [leslie3d.executable]
leslie3d.input = 'leslie3d.in'
#leslie3d.output = out_dir + 'leslie3d.out'#444.namd
namd = LiveProcess()
namd.executable = 'namd' + alpha_suffix
# TEST CMDS
#namd.cmd = [namd.executable] + ['--input', 'namd.input', '--output', 'namd.out', '--iterations', '1']
# REF CMDS
namd.cmd = [namd.executable] + ['--input', 'namd.input', '--output', 'namd.out', '--iterations', '38']
#namd.output = out_dir + 'namd.out'#445.gobmk
gobmk=LiveProcess()
gobmk.executable = 'gobmk' + alpha_suffix
# TEST CMDS
#gobmk.cmd = [gobmk.executable] + ['--quiet','--mode', 'gtp']
#gobmk.input = 'dniwog.tst'
# REF CMDS
gobmk.cmd = [gobmk.executable] + ['--quiet','--mode', 'gtp']
gobmk.input = '13x13.tst'
#gobmk.cmd = [gobmk.executable] + ['--quiet','--mode', 'gtp']
#gobmk.input = 'nngs.tst'
#gobmk.cmd = [gobmk.executable] + ['--quiet','--mode', 'gtp']
#gobmk.input = 'score2.tst'
#gobmk.cmd = [gobmk.executable] + ['--quiet','--mode', 'gtp']
#gobmk.input = 'trevorc.tst'
#gobmk.cmd = [gobmk.executable] + ['--quiet','--mode', 'gtp']
#gobmk.input = 'trevord.tst'
#gobmk.output = out_dir + 'gobmk.out'#447.dealII
####### NOT WORKING #########
dealII=LiveProcess()
dealII.executable = 'dealII' + alpha_suffix
# TEST CMDS
####### NOT WORKING #########
#dealII.cmd = [gobmk.executable]+['8']
# REF CMDS
####### NOT WORKING #########
#dealII.output = out_dir + 'dealII.out'#450.soplex
soplex=LiveProcess()
soplex.executable = 'soplex' + alpha_suffix
# TEST CMDS
#soplex.cmd = [soplex.executable] + ['-m10000', 'test.mps']
# REF CMDS
soplex.cmd = [soplex.executable] + ['-m45000', 'pds-50.mps']
#soplex.cmd = [soplex.executable] + ['-m3500', 'ref.mps']
#soplex.output = out_dir + 'soplex.out'#453.povray
povray=LiveProcess()
povray.executable = 'povray' + alpha_suffix
# TEST CMDS
#povray.cmd = [povray.executable] + ['SPEC-benchmark-test.ini']
# REF CMDS
povray.cmd = [povray.executable] + ['SPEC-benchmark-ref.ini']
#povray.output = out_dir + 'povray.out'#454.calculix
calculix=LiveProcess()
calculix.executable = 'calculix' + alpha_suffix
# TEST CMDS
#calculix.cmd = [calculix.executable] + ['-i', 'beampic']
# REF CMDS
calculix.cmd = [calculix.executable] + ['-i', 'hyperviscoplastic']
#calculix.output = out_dir + 'calculix.out' #456.hmmer
hmmer=LiveProcess()
hmmer.executable = 'hmmer' + alpha_suffix
# TEST CMDS
#hmmer.cmd = [hmmer.executable] + ['--fixed', '0', '--mean', '325', '--num', '45000', '--sd', '200', '--seed', '0', 'bombesin.hmm']
# REF CMDS
hmmer.cmd = [hmmer.executable] + ['nph3.hmm', 'swiss41']
#hmmer.cmd = [hmmer.executable] + ['--fixed', '0', '--mean', '500', '--num', '500000', '--sd', '350', '--seed', '0', 'retro.hmm']
#hmmer.output = out_dir + 'hmmer.out'#458.sjeng
sjeng=LiveProcess()
sjeng.executable = 'sjeng' + alpha_suffix
# TEST CMDS
#sjeng.cmd = [sjeng.executable] + ['test.txt']
# REF CMDS
sjeng.cmd = [sjeng.executable] + ['ref.txt']
#sjeng.output = out_dir + 'sjeng.out'#459.GemsFDTD
GemsFDTD=LiveProcess()
GemsFDTD.executable = 'GemsFDTD' + alpha_suffix
# TEST CMDS
#GemsFDTD.cmd = [GemsFDTD.executable]
# REF CMDS
GemsFDTD.cmd = [GemsFDTD.executable]
#GemsFDTD.output = out_dir + 'GemsFDTD.out'#462.libquantum
libquantum=LiveProcess()
libquantum.executable = 'libquantum' + alpha_suffix
# TEST CMDS
#libquantum.cmd = [libquantum.executable] + ['33','5']
# REF CMDS
libquantum.cmd = [libquantum.executable] + ['1297','8']
#libquantum.output = out_dir + 'libquantum.out' #464.h264ref
h264ref=LiveProcess()
h264ref.executable = 'h264ref' + alpha_suffix
# TEST CMDS
#h264ref.cmd = [h264ref.executable] + ['-d', 'foreman_test_encoder_baseline.cfg']
# REF CMDS
h264ref.cmd = [h264ref.executable] + ['-d', 'foreman_ref_encoder_baseline.cfg']
#h264ref.cmd = [h264ref.executable] + ['-d', 'foreman_ref_encoder_main.cfg']
#h264ref.cmd = [h264ref.executable] + ['-d', 'sss_encoder_main.cfg']
#h264ref.output = out_dir + 'h264ref.out'#465.tonto
tonto=LiveProcess()
tonto.executable = 'tonto' + alpha_suffix
# TEST CMDS
#tonto.cmd = [tonto.executable]
# REF CMDS
tonto.cmd = [tonto.executable]
#tonto.output = out_dir + 'tonto.out'#470.lbm
lbm=LiveProcess()
lbm.executable = 'lbm' + alpha_suffix
# TEST CMDS
#lbm.cmd = [lbm.executable] + ['20', 'reference.dat', '0', '1', '100_100_130_cf_a.of']
# REF CMDS
lbm.cmd = [lbm.executable] + ['300', 'reference.dat', '0', '0', '100_100_130_ldc.of']
#lbm.output = out_dir + 'lbm.out'#471.omnetpp
omnetpp=LiveProcess()
omnetpp.executable = 'omnetpp' + alpha_suffix
# TEST CMDS
#omnetpp.cmd = [omnetpp.executable] + ['omnetpp.ini']
# REF CMDS
omnetpp.cmd = [omnetpp.executable] + ['omnetpp.ini']
#omnetpp.output = out_dir + 'omnetpp.out'#473.astar
astar=LiveProcess()
astar.executable = 'astar' + alpha_suffix
# TEST CMDS
#astar.cmd = [astar.executable] + ['lake.cfg']
# REF CMDS
astar.cmd = [astar.executable] + ['rivers.cfg']
#astar.output = out_dir + 'astar.out'#481.wrf
wrf=LiveProcess()
wrf.executable = 'wrf' + alpha_suffix
# TEST CMDS
#wrf.cmd = [wrf.executable]
# REF CMDS
wrf.cmd = [wrf.executable]
#wrf.output = out_dir + 'wrf.out'#482.sphinx3
sphinx3=LiveProcess()
sphinx3.executable = 'sphinx_livepretend' + alpha_suffix
# TEST CMDS
#sphinx3.cmd = [sphinx3.executable] + ['ctlfile', '.', 'args.an4']
# REF CMDS
sphinx3.cmd = [sphinx3.executable] + ['ctlfile', '.', 'args.an4']
#sphinx3.output = out_dir + 'sphinx3.out'#483.xalancbmk
######## NOT WORKING ###########
xalancbmk=LiveProcess()
xalancbmk.executable = 'xalancbmk' + alpha_suffix
# TEST CMDS
######## NOT WORKING ###########
#xalancbmk.cmd = [xalancbmk.executable] + ['-v','test.xml','xalanc.xsl']
# REF CMDS
######## NOT WORKING ###########
#xalancbmk.output = out_dir + 'xalancbmk.out'#998.specrand
specrand_i=LiveProcess()
specrand_i.executable = 'specrand' + alpha_suffix
# TEST CMDS
#specrand_i.cmd = [specrand_i.executable] + ['324342', '24239']
# REF CMDS
specrand_i.cmd = [specrand_i.executable] + ['1255432124', '234923']
#specrand_i.output = out_dir + 'specrand_i.out'#999.specrand
specrand_f=LiveProcess()
specrand_f.executable = 'specrand' + alpha_suffix
# TEST CMDS
#specrand_f.cmd = [specrand_f.executable] + ['324342', '24239']
# REF CMDS
specrand_f.cmd = [specrand_f.executable] + ['1255432124', '234923']
#specrand_f.output = out_dir + 'specrand_f.out'

3.到目前为止, gem5不知道spec二进制文件和input在哪里,那么现在通过下面的脚本配置运行环境。先建立脚本文件:

cd gem5
touch run_gem5_alpha_spec06_benchmark.sh

将如下内容粘贴到上面的脚本中:

#!/bin/bash
#
# run_gem5_alpha_spec06_benchmark.sh
# Author: Mark Gottscho Email: mgottscho@ucla.edu
# Copyright (C) 2014 Mark Gottscho
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.############ DIRECTORY VARIABLES: MODIFY ACCORDINGLY #############
GEM5_DIR=<PATH_TO_YOUR_GEM5_INSTALL>                            # Install location of gem5
SPEC_DIR=<PATH_TO_YOUR_SPEC_CPU2006_INSTALL>                    # Install location of your SPEC2006 benchmarks
##################################################################ARGC=$# # Get number of arguments excluding arg0 (the script itself). Check for help message condition.
if [[ "$ARGC" != 2 ]]; then # Bad number of arguments.echo "run_gem5_alpha_spec06_benchmark.sh  Copyright (C) 2014 Mark Gottscho"echo "This program comes with ABSOLUTELY NO WARRANTY; for details see <http://www.gnu.org/licenses/>."echo "This is free software, and you are welcome to redistribute it under certain conditions; see <http://www.gnu.org/licenses/> for details."echo ""echo "Author: Mark Gottscho"echo "mgottscho@ucla.edu"echo ""echo "This script runs a single gem5 simulation of a single SPEC CPU2006 benchmark for Alpha ISA."echo ""echo "USAGE: run_gem5_alpha_spec06_benchmark.sh <BENCHMARK> <OUTPUT_DIR>"echo "EXAMPLE: ./run_gem5_alpha_spec06_benchmark.sh bzip2 /FULL/PATH/TO/output_dir"echo ""echo "A single --help help or -h argument will bring this message back."exit
fi# Get command line input. We will need to check these.
BENCHMARK=$1                   # Benchmark name, e.g. bzip2
OUTPUT_DIR=$2                  # Directory to place run output. Make sure this exists!######################### BENCHMARK CODENAMES ####################
PERLBENCH_CODE=400.perlbench
BZIP2_CODE=401.bzip2
GCC_CODE=403.gcc
BWAVES_CODE=410.bwaves
GAMESS_CODE=416.gamess
MCF_CODE=429.mcf
MILC_CODE=433.milc
ZEUSMP_CODE=434.zeusmp
GROMACS_CODE=435.gromacs
CACTUSADM_CODE=436.cactusADM
LESLIE3D_CODE=437.leslie3d
NAMD_CODE=444.namd
GOBMK_CODE=445.gobmk
DEALII_CODE=447.dealII
SOPLEX_CODE=450.soplex
POVRAY_CODE=453.povray
CALCULIX_CODE=454.calculix
HMMER_CODE=456.hmmer
SJENG_CODE=458.sjeng
GEMSFDTD_CODE=459.GemsFDTD
LIBQUANTUM_CODE=462.libquantum
H264REF_CODE=464.h264ref
TONTO_CODE=465.tonto
LBM_CODE=470.lbm
OMNETPP_CODE=471.omnetpp
ASTAR_CODE=473.astar
WRF_CODE=481.wrf
SPHINX3_CODE=482.sphinx3
XALANCBMK_CODE=483.xalancbmk
SPECRAND_INT_CODE=998.specrand
SPECRAND_FLOAT_CODE=999.specrand
################################################################### Check BENCHMARK input
#################### BENCHMARK CODE MAPPING ######################
BENCHMARK_CODE="none"if [[ "$BENCHMARK" == "perlbench" ]]; thenBENCHMARK_CODE=$PERLBENCH_CODE
fi
if [[ "$BENCHMARK" == "bzip2" ]]; thenBENCHMARK_CODE=$BZIP2_CODE
fi
if [[ "$BENCHMARK" == "gcc" ]]; thenBENCHMARK_CODE=$GCC_CODE
fi
if [[ "$BENCHMARK" == "bwaves" ]]; thenBENCHMARK_CODE=$BWAVES_CODE
fi
if [[ "$BENCHMARK" == "gamess" ]]; thenBENCHMARK_CODE=$GAMESS_CODE
fi
if [[ "$BENCHMARK" == "mcf" ]]; thenBENCHMARK_CODE=$MCF_CODE
fi
if [[ "$BENCHMARK" == "milc" ]]; thenBENCHMARK_CODE=$MILC_CODE
fi
if [[ "$BENCHMARK" == "zeusmp" ]]; thenBENCHMARK_CODE=$ZEUSMP_CODE
fi
if [[ "$BENCHMARK" == "gromacs" ]]; thenBENCHMARK_CODE=$GROMACS_CODE
fi
if [[ "$BENCHMARK" == "cactusADM" ]]; thenBENCHMARK_CODE=$CACTUSADM_CODE
fi
if [[ "$BENCHMARK" == "leslie3d" ]]; thenBENCHMARK_CODE=$LESLIE3D_CODE
fi
if [[ "$BENCHMARK" == "namd" ]]; thenBENCHMARK_CODE=$NAMD_CODE
fi
if [[ "$BENCHMARK" == "gobmk" ]]; thenBENCHMARK_CODE=$GOBMK_CODE
fi
if [[ "$BENCHMARK" == "dealII" ]]; then # DOES NOT WORKBENCHMARK_CODE=$DEALII_CODE
fi
if [[ "$BENCHMARK" == "soplex" ]]; thenBENCHMARK_CODE=$SOPLEX_CODE
fi
if [[ "$BENCHMARK" == "povray" ]]; thenBENCHMARK_CODE=$POVRAY_CODE
fi
if [[ "$BENCHMARK" == "calculix" ]]; thenBENCHMARK_CODE=$CALCULIX_CODE
fi
if [[ "$BENCHMARK" == "hmmer" ]]; thenBENCHMARK_CODE=$HMMER_CODE
fi
if [[ "$BENCHMARK" == "sjeng" ]]; thenBENCHMARK_CODE=$SJENG_CODE
fi
if [[ "$BENCHMARK" == "GemsFDTD" ]]; thenBENCHMARK_CODE=$GEMSFDTD_CODE
fi
if [[ "$BENCHMARK" == "libquantum" ]]; thenBENCHMARK_CODE=$LIBQUANTUM_CODE
fi
if [[ "$BENCHMARK" == "h264ref" ]]; thenBENCHMARK_CODE=$H264REF_CODE
fi
if [[ "$BENCHMARK" == "tonto" ]]; thenBENCHMARK_CODE=$TONTO_CODE
fi
if [[ "$BENCHMARK" == "lbm" ]]; thenBENCHMARK_CODE=$LBM_CODE
fi
if [[ "$BENCHMARK" == "omnetpp" ]]; thenBENCHMARK_CODE=$OMNETPP_CODE
fi
if [[ "$BENCHMARK" == "astar" ]]; thenBENCHMARK_CODE=$ASTAR_CODE
fi
if [[ "$BENCHMARK" == "wrf" ]]; thenBENCHMARK_CODE=$WRF_CODE
fi
if [[ "$BENCHMARK" == "sphinx3" ]]; thenBENCHMARK_CODE=$SPHINX3_CODE
fi
if [[ "$BENCHMARK" == "xalancbmk" ]]; then # DOES NOT WORKBENCHMARK_CODE=$XALANCBMK_CODE
fi
if [[ "$BENCHMARK" == "specrand_i" ]]; thenBENCHMARK_CODE=$SPECRAND_INT_CODE
fi
if [[ "$BENCHMARK" == "specrand_f" ]]; thenBENCHMARK_CODE=$SPECRAND_FLOAT_CODE
fi# Sanity check
if [[ "$BENCHMARK_CODE" == "none" ]]; thenecho "Input benchmark selection $BENCHMARK did not match any known SPEC CPU2006 benchmarks! Exiting."exit 1
fi
################################################################### Check OUTPUT_DIR existence
if [[ !(-d "$OUTPUT_DIR") ]]; thenecho "Output directory $OUTPUT_DIR does not exist! Exiting."exit 1
fiRUN_DIR=$SPEC_DIR/benchspec/CPU2006/$BENCHMARK_CODE/run/run_base_ref\_my-alpha.0000     # Run directory for the selected SPEC benchmark
SCRIPT_OUT=$OUTPUT_DIR/runscript.log                                                                   # File log for this script's stdout henceforth################## REPORT SCRIPT CONFIGURATION ###################echo "Command line:"                                | tee $SCRIPT_OUT
echo "$0 $*"                                       | tee -a $SCRIPT_OUT
echo "================= Hardcoded directories ==================" | tee -a $SCRIPT_OUT
echo "GEM5_DIR:                                     $GEM5_DIR" | tee -a $SCRIPT_OUT
echo "SPEC_DIR:                                     $SPEC_DIR" | tee -a $SCRIPT_OUT
echo "==================== Script inputs =======================" | tee -a $SCRIPT_OUT
echo "BENCHMARK:                                    $BENCHMARK" | tee -a $SCRIPT_OUT
echo "OUTPUT_DIR:                                   $OUTPUT_DIR" | tee -a $SCRIPT_OUT
echo "==========================================================" | tee -a $SCRIPT_OUT
###################################################################################### LAUNCH GEM5 SIMULATION ######################
echo ""
echo "Changing to SPEC benchmark runtime directory: $RUN_DIR" | tee -a $SCRIPT_OUT
cd $RUN_DIRecho "" | tee -a $SCRIPT_OUT
echo "" | tee -a $SCRIPT_OUT
echo "--------- Here goes nothing! Starting gem5! ------------" | tee -a $SCRIPT_OUT
echo "" | tee -a $SCRIPT_OUT
echo "" | tee -a $SCRIPT_OUT# Actually launch gem5!
$GEM5_DIR/build/ALPHA/gem5.opt --outdir=$OUTPUT_DIR $GEM5_DIR/configs/example/spec06_config.py --benchmark=$BENCHMARK --benchmark_stdout=$OUTPUT_DIR/$BENCHMARK.out --benchmark_stderr=$OUTPUT_DIR/$BENCHMARK.err <YOUR_SIMULATOR_OPTIONS_HERE> | tee -a $SCRIPT_OUT

4.根据自己的需求修改好上述文件后,只需执行下面的代码即可在gem5中运行spec。

cd gem5
./run_gem5_alpha_spec06_benchmark.sh <BENCHMARK_NAME> <FULL_PATH_TO_OUTPUT_DIRECTORY>

5.修改完成,开始测试。

测试:
1.为了验证和调试上面代码的有效性,使用如下命令测试:

build/ALPHA/gem5.opt --outdir=m5out/spec/ configs/example/spec06_se.py --benchmark=bzip2 --benchmark_stdout=m5out/spec/bzip2.out --benchmark_stderr=m5out/spec/bzip2.err --caches --l1i_size=32kB --l1d_size=32kB --l2cache --l2_size=4MB

通过上述命令测试可以调试spec06_benchmark.py和run_gem5_alpha_spec06_benchmark.sh中路径配置及测试集名称是否正确等。上述运行成功并有统计结果stats.txt即可。

gem5中运行spec2006相关推荐

  1. GEM5中运行parsec 2.1

    参考<Configure and run parsec 2.1 benchmark in gem5> PARSEC Benchmark需要在GEM5中的全系统(full system)模式 ...

  2. Gem5在X64架构下运行SPEC2006

    问题来源:为了验证GEM5执行banchmark需要的时间是否可以容忍,故摸索了下gem5下如何运行spec2006,分析可用性. 步骤一 (编译spec2006):  1. 购买或下载spec200 ...

  3. 使用Gem5在aarch64架构下运行SPEC2006样例(三)——样例运行

    一.写在前面 如果只是想完成课程设计的话,可以使用本部分的方法.如果需要使用Simpoint加速运行,可以略过本篇,见下一篇. 二.正常执行 1.编写脚本 在Gem5主目录下使用命令: touch r ...

  4. gem5运新spec2006(修改)

    按照我之前的那篇博客(地址:http://blog.csdn.net/wyj7260/article/details/8280278)运行spec2006时,只有两个benchmark是可以运行的,其 ...

  5. 【CXL】在gem5中跑一个实际的应用程序——Viper KV存储

    有了CXL扩展内存,自然是要在DRAM+CXL扩展内存上跑跑实际的应用程序,看看和DRAM+传统磁盘有什么区别. 实际的应用程序其实就是一些工业界部署使用的,比如数据库.深度学习训练项目等等.本文主要 ...

  6. 安卓中运行报错Error:Execution failed for task ':app:transformClassesWithDexForDebug'解决

    在androidstuio中运行我的未完项目,报错: Error:Execution failed for task ':app:transformClassesWithDexForDebug'. & ...

  7. 程序在内存中运行的奥秘

    简介 当丰富多彩的应用程序在计算机上运行,为你每天的工作和生活带来便利时,你是否知道它们是如何在计算机中工作呢?本文用形象的图表与生动的解释,揭示了程序在计算机中运行的奥秘. 内存管理是操作系统的核心 ...

  8. IIS配置相关问题:Framework 4.5 在IIS 7.5中运行

    <system.webServer>     <validation validateIntegratedModeConfiguration="false" /& ...

  9. docker保护python源码_Tensorflow在Docker中运行和源码编译

    本文分享在在Docker中运行Tensorflow和进行源码编译的方法和步骤,包括:编译.构建docker镜像.创建和运行Docker容器.部署完的容器可以通过Jupyter Notebook进行访问 ...

最新文章

  1. 今年我读了四个开源项目的源码,来分享下心得
  2. ScheduledThreadPoolExecutor详解
  3. 流行的编程语言,Audiophile Linux发行版,GNU,Bash,Raspberry PI,DevOps,GIMP等
  4. 【LeetCode】剑指 Offer 58 - II. 左旋转字符串
  5. 计蒜客挑战难题:简单斐波那契
  6. git 常用指令 -
  7. VM虚拟机安装centos详细图文教程
  8. 冒泡排序(bubble sort)算法实现
  9. 计算机病毒有几个阶段,计算机病毒发展9阶段
  10. 安卓平台有哪些好的时间管理软件
  11. 发现Chrome小恐龙彩蛋的第n+1个使用者
  12. 用Python画出奥运五环图 (Python经典编程案例)
  13. 离散数学-数理逻辑知识整理(修改版)
  14. python机器学习实现oneR算法 以鸢尾data为例
  15. rpa打开浏览器_从RPA+AI到 RPA像人一样思考:来也科技发布新产品 UiBot Mage
  16. 219年北京移动校园卡200打一年究竟是不是骗局?到底有没有坑?
  17. php面试英文自我介绍范文,英文自我介绍范文分享
  18. codegear的希望
  19. 微信小程序 点击事件绑定三目方法
  20. php gd2 安装,GD2扩展 安装

热门文章

  1. 2018全国穿越机竞速联赛沪上3月31日启动
  2. mysql 看云_使用mysql
  3. iapp可以用java代码吗_iApp教学||iapp利用java调用图库
  4. java 为什么包装类_Java中为什么需要基本类型包装类?
  5. 取消发送option请求_【JavaWeb】HTTP协议的请求与响应
  6. 2022-2028全球及中国先进储能系统行业研究及十四五规划分析报告
  7. 2017美国数学建模ICM E题 可持续发展的城市需要(Sustainable Cities Needed!)
  8. Android分类导航
  9. 塞缪尔·厄尔曼-青春
  10. AD导出3D模型的各种方法——AD转SW(贴图形式)