SPEC benchmark 测试程序使用教程

目录

  • 1. 官方资料
    • 1.1. 官方文档
    • 1.2. 官方文档阅读顺序
    • 1.3. 官方文档每个文档及每个benchmark的简介
    • 1.4. 获取官方文档已经有的测试结果
  • 2. SPEC-CPU 应用及特点
  • 3. 测量指标
  • 4. SPEC 安装方法
    • 4.1. 第一步: 安装
    • 4.2. 第二步: 配置环境变量
    • 4.3. 参考文档
  • 5. 配置配置文件修改方法
    • 5.1. 参考资料
    • 5.2. config语法包含三个部分
      • 5.2.1. 一个头部分header section.
      • 5.2.2. 任意数量的用户定义named部分,通过 section markers分割
      • 5.2.3. 一个自动生成的MD5部分
    • 5.3. 配置编译器选项
    • 5.4. 配置打印操作系统及芯片信息
      • 5.4.1. 使用spec工具,但是只能打印部分信息
      • 5.4.2. 自定义打印信息
    • 5.5. 配置额外的打印信息
    • 5.6. 配置shell
    • 5.7. 其他设置
    • 5.8. 变量
      • 5.8.1. config被读后,就有值的变量
      • 5.8.2. 运行时,获取的变量值
    • 5.9. 其他
      • 5.9.1. 包含其他文件
      • 5.9.2. 注释
  • 6. spec用法举例
    • 6.1. 只编译不运行某个benchmark
      • 6.1.1. 编译单个测试
      • 6.1.2. 设置base和peak指标
    • 6.2. 编译并运行某个benchmark
      • 6.2.1. 参考链接
      • 6.2.2. 运行结果保存路径
      • 6.2.3. 测试集的选择
      • 6.2.4. 运行单个测试,还是所有测试
      • 6.2.5. 运行测试一次
      • 6.2.6. 不编译,只运行
    • 6.3. 修改配置文件,命令参数和配置文件两种使用方法等价
    • 6.4. 修改配置文件设置语法执行的优先级
      • 6.4.1. benchmark优先级
        • 6.4.1.1. 优先级规定
        • 6.4.1.2. 使用命名 benchmark作为 benchmark specifier(最高优先级)
        • 6.4.1.3. 使用命名 suite作为 benchmark specifier
        • 6.4.1.4. 使用default作为 benchmark specifier
      • 6.4.2. tuning优先级
      • 6.4.3. extension优先级
      • 6.4.4. machine优先级
      • 6.4.5. benchmark、tuning、extension优先级
      • 6.4.6. 组合上面这些优先级
    • 6.5. 删除垃圾文件
    • 6.6. 打印shell变量
    • 6.7. 映射到多个核上执行
    • 6.8. 删除临时文件,释放磁盘空间

1 官方资料

1.2 官方文档阅读顺序

SPEC CPU2006 Documentation

  1. Start with Readme 1st CPU2006 to get an overview of the suite and the process.
  2. Use Requirements SPEC CPU2006 to help you choose which computer to use as your first test system.
  3. Once you've chosen the test system, install the suite, using Unix Install SPEC CPU2006 or install-guide-windows.html.
  4. Read at least the first part of runspec (CPU2006), because runspec is the primary tool in the suite. It is used to build the benchmarks, run them, and report on their results. You should read at least section 1 through section 3.1 of that document.
  5. After that, you can pick and choose which documents to read based on where your needs may take you. The list in the next section can help you decide. Note that the Rules SPEC CPU2006 run rules will need to be studied carefully if you plan to quote results in public.

1.3 官方文档每个文档及每个benchmark的简介

1.4 获取官方文档已经有的测试结果

参考下面的链接SPEC CPU® 2006,对照自己的操作系统和芯片类型,可以找到相应的测试结果文档,如果找不到再进行针对性的测试。

2 SPEC-CPU 应用及特点

  1. 用来测试定点和浮点计算密集型应用,测试计算机处理器、内存架构、编译器。对不同的系统,得到可信赖、可重复、可比较的测试结果。
  2. 但是,SPEC CPU2006不会对网络、操作系统、显卡、IO系统造成压力
  3. 官方源代码是收费的

3 测量指标

  1. 计算峰值
  2. 吞吐量

4 SPEC 安装方法

4.1 第一步: 安装

./install.sh
指定安装位置
/install.sh -d /Users/kgoel/cpu2006

4.2 第二步: 配置环境变量

Users cd/Users/kgoel/cpu2006/cpu2006

. ./shrc <– that's dot-space-dot-slash-shrc

4.3 参考文档

5 配置配置文件修改方法

5.2 config语法包含三个部分

5.2.1 一个头部分header section.
  • 例子
    output_format = asc,ps
    tune = base
    reportable = 1
    runlist = fp
  • 设置只执行特定的benchmark
    runlist = sjeng
  • 设置输入源
    size = test/ref
  • 设置迭代执行次数
    iterations = 1
  • 设置输出格式
    output_format = text
  • 设置tune级别
    tune = base
  • 设置将编译信息打印到屏幕
    teeout = 1
5.2.2 任意数量的用户定义named部分,通过 section markers分割

benchmark[,…]=tuning[,…]=extension[,…]=machine[,…]:

benchmark: 要编译的测试文件
tuning类型
extension:标志某条规则。runspec命令行可以指定extension,执行特定规则

例子,下面三句等价
465.tonto=base=default=default:
465.tonto=base=default:
465.tonto=base:

5.2.3 一个自动生成的MD5部分

该部分是spec运行过程中自动生成的,不用管

5.3 配置编译器选项

III. Config file options for specmake

5.4 配置打印操作系统及芯片信息

5.4.1 使用spec工具,但是只能打印部分信息
  1. 下载使用spec默认工具获取系统信息脚本
    $ . ./shrc
    $ mkdir update
    $ cd update
    $ curl -s -O http://www.spec.org/cpu2006/Docs/sysinfo
    $ chmod +x sysinfo
    $ ./sysinfo -p | grep Rev | tr $ " "
  2. 在配置文件中加上该脚本
    sysinfo_program = specperl $[top]/Docs/sysinfo
5.4.2 自定义打印信息

使用下面的变量
V. Config file options for readers

5.5 配置额外的打印信息

V.C. Additional notes for the reader

notes_os_001 = The operating system used service pack 2 plus patches
notes_os_002 = 31415, 92653, and 58979. At installation time, the
notes_os_003 = optional "Numa Performance Package" was selected.

$ cat tmp.cfg
size = test
iterations = 1
output_format = text
teeout = 1
runlist = sjeng
tune = base

notes_part_greeting_011 = + how
notes_part_greeting_20 = +
you?
notes_part_greeting_012 = + are
notes_part_aname_1 = +
Alex,
notes_part_080 = ++ hi

$ runspec –config tmp > /nev/dull
$ cd ../result
$ ls -t *test.txt | head -1
CINT2006.101.test.txt
$ grep + *101*txt
+
hi
+ Alex,
+
how
+ are
+
you?
$

5.6 配置shell

IV. Config file options for the shell

5.7 其他设置

II.B. Options

5.8 变量

5.8.1 config被读后,就有值的变量

$[variable]

5.8.2 运行时,获取的变量值

$variable, ${variable}

5.9 其他

5.9.1 包含其他文件

include: SUT.inc

5.9.2 注释

#开头

6 spec用法举例

6.1 只编译不运行某个benchmark

6.1.1 编译单个测试

$ cd $SPEC/config
$ cp Example-macosx-gcc421.cfg Khushboo-macosx.cfg
$ runspec –config=Khushboo-macosx.cfg –action=build –tune=base bzip2

成功标志:
Build successes: 401.bzip2(base) <<– what we want to see

6.1.2 设置base和peak指标

The base metrics (e.g. SPECint_base2006) are required for all reported results and have stricter guidelines for compilation. For example, the same flags must be used in the same order for all benchmarks of a given language. This is the point closer to those who might prefer a relatively simple build process.

The peak metrics (e.g. SPECint2006) are optional and have less strict requirements. For example, different compiler options may be used on each benchmark, and feedback-directed optimization is allowed. This point is closer to those who may be willing to invest more time and effort in development of build procedures.

6.2 编译并运行某个benchmark

6.2.1 参考链接

runspec (CPU2006)

$ runspec –config=Khushboo-macosx.cfg –size=test –noreportable –tune=base –iterations=1 bzip2

6.2.2 运行结果保存路径

$SPEC/result

6.2.3 测试集的选择
  1. 最小测试集
    –size=test
    test - data for a simple test that an executable is functional
  2. 真实测试集
    –size=ref
    ref - the real data set, required for all result reporting
  3. all - data used by all runs (if needed by the benchmark)
  4. 训练数据集
    train - data for feedback-directed optimization
6.2.4 运行单个测试,还是所有测试
  1. 仅仅运行某一个测试,而不是所有测试
    –noreportable
  2. 运行所有测试
    runspec –tune=base –config=Khushboo-macosx.cfg int
6.2.5 运行测试一次

–iterations=1

6.2.6 不编译,只运行

–nobuild
bash-2.05$ runspec –config newint.cfg –nobuild –reportable int

6.3 修改配置文件,命令参数和配置文件两种使用方法等价

michael.cfg

output_format = asc,ps
tune = base
reportable = 1
runlist = fp

下面两句等价:
runspec –config=michael
runspec –config=michael –output=asc,ps –tune=base –reportable fp

6.4 修改配置文件设置语法执行的优先级

6.4.1 benchmark优先级
6.4.1.1 优先级规定

当三者同时存在时,优先执行
最高优先级 命令benchmark
其次 套件名 int/fp
最低 default

  1. 规则间的顺序是不重要的,重要的是第一个参数

    $ cat tmp.cfg
    runlist = sjeng
    size = test
    iterations = 1
    tune = base
    output_format = text
    teeout = 1

    458.sjeng=default=default=default:
    OPTIMIZE = -xO4 -w

    default=default=default=default:
    OPTIMIZE = -xO2 -w

    int=default=default=default:
    OPTIMIZE = -xO3 -w

    $ runspec –config=tmp | grep sjeng.c
    cc -c -o sjeng.o -DSPEC_CPU -DNDEBUG -xO4 -w sjeng.c

  2. 同名规则,使用最后一个规则

    458.sjeng=default=default=default:
    OPTIMIZE = -xO4

    400.perlbench=default:
    OPTIMIZE = -fast

    458.sjeng=default=default=default:
    OPTIMIZE = -xO3

    The ending value of OPTIMIZE for 458.sjeng is -xO3, not -xO4.

6.4.1.2 使用命名 benchmark作为 benchmark specifier(最高优先级)

$ cat tmp.cfg
runlist = sjeng
size = test
iterations = 1
tune = base
output_format = text
teeout = 1

default=default=default=default:
OPTIMIZE = -xO2 -w

int=default=default=default:
OPTIMIZE = -xO3 -w

458.sjeng=default=default=default: #使用这条规则
OPTIMIZE = -xO4 -w

$ runspec –config=tmp | grep sjeng.c
cc -c -o sjeng.o -DSPEC_CPU -DNDEBUG -xO4 -w sjeng.c
$

6.4.1.3 使用命名 suite作为 benchmark specifier
  • 打印特定语句
    $ cat tmp.cfg
    runlist = sjeng
    size = test
    iterations = 1
    tune = base
    output_format = text
    teeout = 1

    default=default=default=default:
    OPTIMIZE = -xO2 -w

    int=default=default=default: #这个优先级高,先执行
    OPTIMIZE = -xO3 -w

    $ runspec –config=tmp | grep sjeng.c
    cc -c -o sjeng.o -DSPEC_CPU -DNDEBUG -xO3 -w sjeng.c
    $

    结果:
    打印了二条语法

  • 运行所有的c/c++测试集
    all_c,all_cpp=default=default=default:
    OPTIMIZE = -xO3 -w
6.4.1.4 使用default作为 benchmark specifier

$ cat tmp.cfg
runlist = sjeng
size = test
iterations = 1
tune = base
output_format = text
teeout = 1

default=default=default=default:
OPTIMIZE = -xO1 -w

$ runspec –config=tmp | grep sjeng.c
cc -c -o sjeng.o -DSPEC_CPU -DNDEBUG -xO1 -w sjeng.c

结果:

  1. 仅仅运行一个benchmark, 458.sjeng
  2. 使用最小测试集
  3. 运行一次
  4. 使用base tuning
  5. 将编译信息打印到屏幕 teeout=1
6.4.2 tuning优先级

peak和base的优先级一样,都会执行
$ cat tmp.cfg
runlist = sjeng
size = test
iterations = 1
tune = base,peak
output_format = text
teeout = 1

default=default=default=default:
CC = /opt/SUNWspro/bin/cc -w

default=base=default=default: #执行
CC = /update1/bin/cc -w

default=peak=default=default: #执行
CC = /update2/bin/cc -w

$ runspec –config=tmp | grep sjeng.c
/update1/bin/cc -w -c -o sjeng.o -DSPEC_CPU -DNDEBUG sjeng.c
/update2/bin/cc -w -c -o sjeng.o -DSPEC_CPU -DNDEBUG sjeng.c

6.4.3 extension优先级

$ cat tmp.cfg
runlist = sjeng
size = test
iterations = 1
tune = base
output_format = text
teeout = 1

default=default=default:
LIBS = -lslowmalloc

default=default=myke:
LIBS = -lbsdmalloc

default=default=yusuf:
LIBS = -lthread -lmtmalloc
$
$ runspec –config=tmp –extension=myke | grep sjeng.o
cc -c -o sjeng.o -DSPEC_CPU -DNDEBUG sjeng.c
cc attacks.o book.o crazy.o draw.o ecache.o epd.o eval.o leval.o moves.o
neval.o partner.o proof.o rcfile.o search.o see.o seval.o sjeng.o ttable.o
utils.o -lbsdmalloc -o sjeng
$
$ runspec –config=tmp –extension=yusuf | grep sjeng.o
cc -c -o sjeng.o -DSPEC_CPU -DNDEBUG sjeng.c
cc attacks.o book.o crazy.o draw.o ecache.o epd.o eval.o leval.o moves.o
neval.o partner.o proof.o rcfile.o search.o see.o seval.o sjeng.o ttable.o
utils.o -lthread -lmtmalloc -o sjeng
$
$ cd $SPEC/benchspec/CPU2006/458.sjeng/exe
$ ls -lt | head -3
total 5888
-rwxrwxr-x 1 alan staff 244688 May 11 16:32 sjeng_base.yusuf
-rwxrwxr-x 1 alan staff 244628 May 11 16:31 sjeng_base.myke
$

6.4.4 machine优先级
6.4.5 benchmark、tuning、extension优先级

benchmark>suite>tuning>extension

6.4.6 组合上面这些优先级

$ cat tmp.cfg
runlist = sjeng
size = test
iterations = 1
tune = base
output_format = text
teeout = 1

default=default=default=default:
OPTIMIZE = -xO2 -w
CC = /opt/SUNWspro/bin/cc
LIBS = -lbsdmalloc

458.sjeng=default=default=default:
OPTIMIZE = -xO4 -w

default=peak=default=default:
CC = /update1/bin/cc

default=default=mt=default:
LIBS = -lthread -lmtmalloc

$ runspec –config=tmp –tune=peak –ext=mt | grep sjeng.o
/update1/bin/cc -c -o sjeng.o -DSPEC_CPU -DNDEBUG -xO4 -w sjeng.c
/update1/bin/cc -xO4 -w attacks.o book.o crazy.o draw.o ecache.o epd.o
eval.o leval.o moves.o neval.o partner.o proof.o rcfile.o search.o see.o
seval.o sjeng.o ttable.o utils.o -lthread -lmtmalloc -o sjeng
$

Notice above that all three sections applied: the section specifier for 458.sjeng, the specifier for peak tuning, and the specifier for extension mt.

6.5 删除垃圾文件

fdo_pre0 = mkdir /tmp/pb; rm -f /tmp/pb/${baseexe}*

6.6 打印shell变量

$ cat tmp.cfg
runlist = mcf
size = test
tune = base,peak
iterations = 1

output_format = asc
teeout = 1
expand_notes = 1
use_submit_for_speed = 1

default=peak=default=default:
submit = echo "home=$HOME; spec=$SPEC;" > /tmp/chan; $command

default=base=default=default:
submit = echo "home=\$HOME; spec=\$SPEC;" > /tmp/nui; $command
$ runspec –config=tmp > /dev/null
$ cat /tmp/chan
home=; spec=;
$ cat /tmp/nui
home=/home/chris; spec=/spec/cpu2006;
$

6.7 映射到多个核上执行

I.D.1.d Example: submit to multiple nodes, Tru64 Unix
I.D.1.e Example: bind to processors, SPEC TurboBlaster9000
I.D.2.b Example: submitting to multiple nodes, SGI Origin 2000
IV.C. Using submit

6.8 删除临时文件,释放磁盘空间

  1. 打开config文件
    ext=BobMemoryOpt
  2. 找打要删除的文件
    $ pwd
    /Users/bob/cpu2006/benchspec/CPU2006/401.bzip2/run
    $ ls
    list
    run_base_test_BobMemoryOpt.0001
    run_base_train_BobMemoryOpt.0001
    run_base_ref_BobMemoryOpt.0001
    run_peak_test_BobMemoryOpt.0001
    run_peak_train_BobMemoryOpt.0001
    run_peak_ref_BobMemoryOpt.0001
  3. 删除相关的临时文件
    rm -Rf $SPEC/benchspec/CPU2006/*/run/run*BobMemory*
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值