SPEC2000使用攻略

首先要有spec2000的測試程序纔行,可以通過光盤安裝,或者通過一定方式拷貝到本機硬盤進行安裝。通過閱讀其中的readme文件按照其中步驟一步步來就是了。
假定安裝到了spec2000/目錄下。

安裝完成之後要配置運行環境,打開一個shell,進入到spec2000目錄。
1. $ . shrc
通常是當前shell中運行這樣的命令。這樣就在當前的shell環境中配置了運行spec2000所需要的環境,否則的話不能運行的。
2. $ runspec --size=test --noreportable --iterations=1 mcf
這樣就可以使用test數據集測試mcf程序了!!
一共有三個測試集test,train,ref,若想運行ref測試集,只需要把上面的—size=ref就可以了。有若干個測試程序,若想運行gzip程序,只需要改變程序名字爲gzip即可。
===============================================
CINT2000程序在不同測試集下的運行方式
代碼:
<test>
bzip2 input.random 2 >input.random.out 2>input.random.err
</test>
<train>
bzip2 input.compressed 8 >input.compressed.out 2>input.compressed.err
</train>
<ref>
bzip2 input.source 58 > input.source.out 2> input.source.err
bzip2 input.graphic 58 > input.graphic.out 2> input.graphic.err
bzip2 input.program 58 > input.program.out 2> input.program.err
</ref>

<test>
crafty <crafty.in >crafty.out 2>crafty.err
</test>
<train>
crafty <crafty.in >crafty.out 2>crafty.err
</train>
<ref>
crafty <crafty.in >crafty.out 2>crafty.err
</ref>

<test>
gap -l ./ -q -m 64M <test.in >test.out 2>test.err
</test>
<train>
gap -l ./-q -m 128M <train.in >train.out 2>train.err
</train>
<ref>
gap -l ./ -q -m 192M <ref.in >ref.out 2>ref.err
</ref>

<test>
cc1 cccp.i -o cccp.s >cccp.out 2>cccp.err
</test>
<train>
cc1 cp-decl.i -o cp-decl.s >cp-decl.out 2>cp-decl.err
</train>
<ref>
cc1 166.i -o 166.s >166.out 2>166.err
cc1 200.i -o 200.s >200.out 2>200.err
cc1 expr.i -o expr.s >expr.out 2>expr.err
cc1 integrate.i -o integrate.s >integrate.out 2>integrate.err
cc1 scilab.i -o scilab.s >scilab.out 2>scilab.err
</ref>

<test>
gzip input.compressed 2 >input.compressed.out 2>input.compressed.err
</test>
<train>
gzip input.combined 32 >input.combined.out 2>input.combined.err
</train>
<ref>
gzip input.source 60 >input.source.out 2>input.source.err
gzip input.log 60 >input.log.out 2>input.log.err
gzip input.graphic 60 >input.graphic.out 2>input.graphic.err
gzip input.random 60 >input.random.out 2>input.random.err
gzip input.program 60 >input.program.out 2>input.program.err
</ref>

<test>
mcf inp.in >inp.out 2>inp.err
</test>
<train>
mcf inp.in >inp.out 2>inp.err
</train>
<ref>
mcf inp.in >inp.out 2>inp.err
</ref>

<test>
parser 2.1.dict -batch <test.in >test.out 2>test.err
</test>
<train>
parser 2.1.dict -batch <train.in >train.out 2>train.err
</train>
<ref>
parser 2.1.dict -batch <ref.in >ref.out 2>ref.err
</ref>

<test>
perlbmk -I. -I./lib test.pl <test.in >test.out 2>test.err
</test>
<train>
perlbmk -I./lib diffmail.pl 2 350 15 24 23 150 >2.350.15.24.23.150.out 2>2.350.15.24.23.150.err
perlbmk -I./lib perfect.pl b 3 >b.3.out 2>b.3.err
perlbmk -I. -I./lib scrabbl.pl <scrabbl.in >scrabbl.out 2>scrabbl.err
</train>
<ref>
perlbmk -I./lib diffmail.pl 2 550 15 24 23 100 >2.550.15.24.23.100.out 2>2.550.15.24.23.100.err
perlbmk -I. -I./lib makerand.pl >makerand.out 2>makerand.err
perlbmk -I./lib perfect.pl b 3 m 4 >b.3.m.4.out 2>b.3.m.4.err
perlbmk -I./lib splitmail.pl 850 5 19 18 1500 >850.5.19.18.1500.out 2>850.5.19.18.1500.err
perlbmk -I./lib splitmail.pl 704 12 26 16 836 >704.12.26.16.836.out 2>704.12.26.16.836.err
perlbmk -I./lib splitmail.pl 535 13 25 24 1091 >535.13.25.24.1091.out 2>535.13.25.24.1091.err
perlbmk -I./lib splitmail.pl 957 12 23 26 1014 >957.12.23.26.1014.out 2>957.12.23.26.1014.err
</ref>

<test>
twolf test >test.stdout 2>test.err
</test>
<train>
twolf train >train.stdout 2>train.err
</train>
<ref>
twolf ref >ref.stdout 2>ref.err
</ref>

<test>
vortex lendian.raw >vortex.out2 2>vortex.err
</test>
<train>
vortex lendian.raw >vortex.out2 2>vortex.err
</train>
<ref>
vortex lendian1.raw >vortex1.out2 2>vortex1.err
vortex lendian2.raw >vortex2.out2 2>vortex2.err
vortex lendian3.raw >vortex3.out2 2>vortex3.err
</ref>

<test>
vpr net.in arch.in place.out dum.out -nodisp -place_only -init_t 5 -exit_t 0.005 -alpha_t 0.9412 -inner_num 2 >place_log.out 2>place_log.err
vpr net.in arch.in place.in route.out -nodisp -route_only -route_chan_width 15 -pres_fac_mult 2 -acc_fac 1 -first_iter_pres_fac 4 -initial_pres_fac 8 >route_log.out 2>route_log.err
</test>
<train>
vpr net.in arch.in place.out dum.out -nodisp -place_only -init_t 5 -exit_t 0.005 -alpha_t 0.9412 -inner_num 2 >place_log.out 2>place_log.err
vpr net.in arch.in place.in route.out -nodisp -route_only -route_chan_width 15 -pres_fac_mult 2 -acc_fac 1 -first_iter_pres_fac 4 -initial_pres_fac 8 >route_log.out 2>route_log.err
</train>
<ref>
vpr net.in arch.in place.out dum.out -nodisp -place_only -init_t 5 -exit_t 0.005 -alpha_t 0.9412 -inner_num 2 >place_log.out 2>place_log.err
vpr net.in arch.in place.in route.out -nodisp -route_only -route_chan_width 15 -pres_fac_mult 2 -acc_fac 1 -first_iter_pres_fac 4 -initial_pres_fac 8 >route_log.out 2>route_log.err
</ref>
自動使用各個數據集測試所有程序,並記錄運行時間,我寫的腳本如下:
代碼:
#/bin/bash
#filename:myrun.sh

#runspec --size=test  --noreportable --iterations=1 gzip
#application names
apps="bzip2 crafty gzip gcc gap mcf parser perlbmk twolf vpr vortex"
tmp=tmpfile
log=timelog`date +"%m-%d-%Y"`
# config running environment
. shrc
# running with test dataset
echo ' '>>$log
echo '==============running with test dataset=================' >>$log
for app in $apps
do
        echo "--------------testing: $app ------------" >>$log
        (time runspec --size=test  --noreportable --iterations=1 $app) > $tmp 2>>$log
done

# running with train dataset
echo '==============running with train dataset=================' >>$log
for app in $apps
do
        echo "--------------testing: $app ------------" >>$log
        (time runspec --size=train --noreportable --iterations=1 $app) > $tmp 2>>$log
done

# running with ref dataset
echo '==============running with ref dataset=================' >>$log
for app in $apps
do
        echo "--------------testing: $app ------------" >>$log
        (time runspec --size=ref  --noreportable --iterations=1 $app) > $tmp 2>>$log
done
rm $tmp
對於我們來講,我們做的是一個模擬器的項目,所以我們需要使用spec2000來測我們模擬器的性能,但是我們模擬器使用的不是x86指令集,而是mips指令,所以我需要對每個程序進行重新編譯,並配置不同的編譯選項。我的想法是把這些程序編譯出來後,可執行文件和測試數據集拷貝到另外一個目錄下,然後在那個目錄下進行自己的測試工作。我的這個prepare.sh腳本就是用來做這項工作的。
代碼:
#!/bin/bash
#filename: prepare.sh
apps="256.bzip2 186.crafty 254.gap 176.gcc 164.gzip 181.mcf 197.parser 253.perlbmk 300.twolf 255.vortex 175.vpr"
#apps="181.mcf"
home="/samba/data/spec2000/"
srcpath="/samba/data/spec2000/benchspec/CINT2000/"
dstpath="/work/lirui/SandFox2/bin/spec2000/CINT2000/"
for app in $apps
do
        # first step: copy dataset to each test destination
        dst="${dstpath}${app##[^.]*.}"
        if ! [ -d $dst ]
        then
                mkdir $dst
        fi
        cp ${srcpath}${app}/data/* ${dst} -rf

        # second step: build x86, mips-dynamic, mips-static binaries
        src="${srcpath}${app}/run/00000001"
        if [ -d $src ]
        then
                cd $src
                if [ -e "Makefile.spec" ]
                then
                        cp Makefile.spec Makefile.spec.orig
                        #build x86
                        make clean
                        make
                        for f in ./*
                        do
                                if [ -f $f ] && [ -x $f ]
                                then
                                        name=`basename $f`
                                        cp $name ${dst}/${name}-x86
                                fi
                        done
                        #build mips-dynamic
                        make clean
                        sed -e 's//(CC[[:space:]]*=[[:space:]]*/)gcc//1mipsel-dsag-linux-gnu-gcc/g'                      Makefile.spec.orig > Makefile.spec
                        make
                        for f in ./*
                        do
                                if [ -f $f ] && [ -x $f ]
                                then
                                        name=`basename $f`
                                        cp $name ${dst}/${name}-mips-dy
                                fi
                        done
                        #build mips-static
                        make clean
                        sed -e 's//(CC[[:space:]]*=[[:space:]]*/)gcc//1mipsel-dsag-linux-gnu-gcc -static/g' Makefile.spec.orig > Makefile.spec
                        make
                        for f in ./*
                        do
                                if [ -f $f ] && [ -x $f ]
                                then
                                        name=`basename $f`
                                        cp $name ${dst}/${name}-mips-st
                                fi
                        done
                        make clean
                        cp Makefile.spec.orig Makefile.spec
                        rm Makefile.spec.orig
                else
                        echo "There are no file /"Makefile.spec/" for ${app##[^.]*.}"
                fi
        else
                echo "There are no source files for ${app##[^.]*.}"
        fi
        # finally: copy cmds file to destination
done
cd $home
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章