SPEC benchmark 测试程序使用教程

2024-04-09 17:32

本文主要是介绍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.1 官方文档

SPEC CPU2006 Documentation
Readme 1st CPU2006
Requirements SPEC CPU2006
Unix Install SPEC CPU2006
runspec (CPU2006)
Rules SPEC CPU2006

SPEC Benchmarks

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的简介

SPEC CPU2006 Documentation

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 参考文档

Unix Install SPEC CPU2006

5 配置配置文件修改方法

5.1 参考资料

Config files - SPEC CPU2006
Rules SPEC CPU2006

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*

这篇关于SPEC benchmark 测试程序使用教程的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/888789

相关文章

使用Python创建一个功能完整的Windows风格计算器程序

《使用Python创建一个功能完整的Windows风格计算器程序》:本文主要介绍如何使用Python和Tkinter创建一个功能完整的Windows风格计算器程序,包括基本运算、高级科学计算(如三... 目录python实现Windows系统计算器程序(含高级功能)1. 使用Tkinter实现基础计算器2.

在.NET平台使用C#为PDF添加各种类型的表单域的方法

《在.NET平台使用C#为PDF添加各种类型的表单域的方法》在日常办公系统开发中,涉及PDF处理相关的开发时,生成可填写的PDF表单是一种常见需求,与静态PDF不同,带有**表单域的文档支持用户直接在... 目录引言使用 PdfTextBoxField 添加文本输入域使用 PdfComboBoxField

Git可视化管理工具(SourceTree)使用操作大全经典

《Git可视化管理工具(SourceTree)使用操作大全经典》本文详细介绍了SourceTree作为Git可视化管理工具的常用操作,包括连接远程仓库、添加SSH密钥、克隆仓库、设置默认项目目录、代码... 目录前言:连接Gitee or github,获取代码:在SourceTree中添加SSH密钥:Cl

Python中模块graphviz使用入门

《Python中模块graphviz使用入门》graphviz是一个用于创建和操作图形的Python库,本文主要介绍了Python中模块graphviz使用入门,具有一定的参考价值,感兴趣的可以了解一... 目录1.安装2. 基本用法2.1 输出图像格式2.2 图像style设置2.3 属性2.4 子图和聚

windows和Linux使用命令行计算文件的MD5值

《windows和Linux使用命令行计算文件的MD5值》在Windows和Linux系统中,您可以使用命令行(终端或命令提示符)来计算文件的MD5值,文章介绍了在Windows和Linux/macO... 目录在Windows上:在linux或MACOS上:总结在Windows上:可以使用certuti

CentOS和Ubuntu系统使用shell脚本创建用户和设置密码

《CentOS和Ubuntu系统使用shell脚本创建用户和设置密码》在Linux系统中,你可以使用useradd命令来创建新用户,使用echo和chpasswd命令来设置密码,本文写了一个shell... 在linux系统中,你可以使用useradd命令来创建新用户,使用echo和chpasswd命令来设

Python使用Matplotlib绘制3D曲面图详解

《Python使用Matplotlib绘制3D曲面图详解》:本文主要介绍Python使用Matplotlib绘制3D曲面图,在Python中,使用Matplotlib库绘制3D曲面图可以通过mpl... 目录准备工作绘制简单的 3D 曲面图绘制 3D 曲面图添加线框和透明度控制图形视角Matplotlib

Pandas中统计汇总可视化函数plot()的使用

《Pandas中统计汇总可视化函数plot()的使用》Pandas提供了许多强大的数据处理和分析功能,其中plot()函数就是其可视化功能的一个重要组成部分,本文主要介绍了Pandas中统计汇总可视化... 目录一、plot()函数简介二、plot()函数的基本用法三、plot()函数的参数详解四、使用pl

使用Python实现IP地址和端口状态检测与监控

《使用Python实现IP地址和端口状态检测与监控》在网络运维和服务器管理中,IP地址和端口的可用性监控是保障业务连续性的基础需求,本文将带你用Python从零打造一个高可用IP监控系统,感兴趣的小伙... 目录概述:为什么需要IP监控系统使用步骤说明1. 环境准备2. 系统部署3. 核心功能配置系统效果展

使用Java将各种数据写入Excel表格的操作示例

《使用Java将各种数据写入Excel表格的操作示例》在数据处理与管理领域,Excel凭借其强大的功能和广泛的应用,成为了数据存储与展示的重要工具,在Java开发过程中,常常需要将不同类型的数据,本文... 目录前言安装免费Java库1. 写入文本、或数值到 Excel单元格2. 写入数组到 Excel表格