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

相关文章

postgresql使用UUID函数的方法

《postgresql使用UUID函数的方法》本文给大家介绍postgresql使用UUID函数的方法,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友参考下吧... 目录PostgreSQL有两种生成uuid的方法。可以先通过sql查看是否已安装扩展函数,和可以安装的扩展函数

如何使用Lombok进行spring 注入

《如何使用Lombok进行spring注入》本文介绍如何用Lombok简化Spring注入,推荐优先使用setter注入,通过注解自动生成getter/setter及构造器,减少冗余代码,提升开发效... Lombok为了开发环境简化代码,好处不用多说。spring 注入方式为2种,构造器注入和setter

MySQL中比较运算符的具体使用

《MySQL中比较运算符的具体使用》本文介绍了SQL中常用的符号类型和非符号类型运算符,符号类型运算符包括等于(=)、安全等于(=)、不等于(/!=)、大小比较(,=,,=)等,感兴趣的可以了解一下... 目录符号类型运算符1. 等于运算符=2. 安全等于运算符<=>3. 不等于运算符<>或!=4. 小于运

使用zip4j实现Java中的ZIP文件加密压缩的操作方法

《使用zip4j实现Java中的ZIP文件加密压缩的操作方法》本文介绍如何通过Maven集成zip4j1.3.2库创建带密码保护的ZIP文件,涵盖依赖配置、代码示例及加密原理,确保数据安全性,感兴趣的... 目录1. zip4j库介绍和版本1.1 zip4j库概述1.2 zip4j的版本演变1.3 zip4

Python 字典 (Dictionary)使用详解

《Python字典(Dictionary)使用详解》字典是python中最重要,最常用的数据结构之一,它提供了高效的键值对存储和查找能力,:本文主要介绍Python字典(Dictionary)... 目录字典1.基本特性2.创建字典3.访问元素4.修改字典5.删除元素6.字典遍历7.字典的高级特性默认字典

使用Python构建一个高效的日志处理系统

《使用Python构建一个高效的日志处理系统》这篇文章主要为大家详细讲解了如何使用Python开发一个专业的日志分析工具,能够自动化处理、分析和可视化各类日志文件,大幅提升运维效率,需要的可以了解下... 目录环境准备工具功能概述完整代码实现代码深度解析1. 类设计与初始化2. 日志解析核心逻辑3. 文件处

一文详解如何使用Java获取PDF页面信息

《一文详解如何使用Java获取PDF页面信息》了解PDF页面属性是我们在处理文档、内容提取、打印设置或页面重组等任务时不可或缺的一环,下面我们就来看看如何使用Java语言获取这些信息吧... 目录引言一、安装和引入PDF处理库引入依赖二、获取 PDF 页数三、获取页面尺寸(宽高)四、获取页面旋转角度五、判断

Windows环境下解决Matplotlib中文字体显示问题的详细教程

《Windows环境下解决Matplotlib中文字体显示问题的详细教程》本文详细介绍了在Windows下解决Matplotlib中文显示问题的方法,包括安装字体、更新缓存、配置文件设置及编码調整,并... 目录引言问题分析解决方案详解1. 检查系统已安装字体2. 手动添加中文字体(以SimHei为例)步骤

C++中assign函数的使用

《C++中assign函数的使用》在C++标准模板库中,std::list等容器都提供了assign成员函数,它比操作符更灵活,支持多种初始化方式,下面就来介绍一下assign的用法,具有一定的参考价... 目录​1.assign的基本功能​​语法​2. 具体用法示例​​​(1) 填充n个相同值​​(2)

Spring StateMachine实现状态机使用示例详解

《SpringStateMachine实现状态机使用示例详解》本文介绍SpringStateMachine实现状态机的步骤,包括依赖导入、枚举定义、状态转移规则配置、上下文管理及服务调用示例,重点解... 目录什么是状态机使用示例什么是状态机状态机是计算机科学中的​​核心建模工具​​,用于描述对象在其生命