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实现可恢复式多线程下载器

《使用Python实现可恢复式多线程下载器》在数字时代,大文件下载已成为日常操作,本文将手把手教你用Python打造专业级下载器,实现断点续传,多线程加速,速度限制等功能,感兴趣的小伙伴可以了解下... 目录一、智能续传:从崩溃边缘抢救进度二、多线程加速:榨干网络带宽三、速度控制:做网络的好邻居四、终端交互

Python中注释使用方法举例详解

《Python中注释使用方法举例详解》在Python编程语言中注释是必不可少的一部分,它有助于提高代码的可读性和维护性,:本文主要介绍Python中注释使用方法的相关资料,需要的朋友可以参考下... 目录一、前言二、什么是注释?示例:三、单行注释语法:以 China编程# 开头,后面的内容为注释内容示例:示例:四

Go语言数据库编程GORM 的基本使用详解

《Go语言数据库编程GORM的基本使用详解》GORM是Go语言流行的ORM框架,封装database/sql,支持自动迁移、关联、事务等,提供CRUD、条件查询、钩子函数、日志等功能,简化数据库操作... 目录一、安装与初始化1. 安装 GORM 及数据库驱动2. 建立数据库连接二、定义模型结构体三、自动迁

ModelMapper基本使用和常见场景示例详解

《ModelMapper基本使用和常见场景示例详解》ModelMapper是Java对象映射库,支持自动映射、自定义规则、集合转换及高级配置(如匹配策略、转换器),可集成SpringBoot,减少样板... 目录1. 添加依赖2. 基本用法示例:简单对象映射3. 自定义映射规则4. 集合映射5. 高级配置匹

Spring 框架之Springfox使用详解

《Spring框架之Springfox使用详解》Springfox是Spring框架的API文档工具,集成Swagger规范,自动生成文档并支持多语言/版本,模块化设计便于扩展,但存在版本兼容性、性... 目录核心功能工作原理模块化设计使用示例注意事项优缺点优点缺点总结适用场景建议总结Springfox 是

嵌入式数据库SQLite 3配置使用讲解

《嵌入式数据库SQLite3配置使用讲解》本文强调嵌入式项目中SQLite3数据库的重要性,因其零配置、轻量级、跨平台及事务处理特性,可保障数据溯源与责任明确,详细讲解安装配置、基础语法及SQLit... 目录0、惨痛教训1、SQLite3环境配置(1)、下载安装SQLite库(2)、解压下载的文件(3)、

使用Python绘制3D堆叠条形图全解析

《使用Python绘制3D堆叠条形图全解析》在数据可视化的工具箱里,3D图表总能带来眼前一亮的效果,本文就来和大家聊聊如何使用Python实现绘制3D堆叠条形图,感兴趣的小伙伴可以了解下... 目录为什么选择 3D 堆叠条形图代码实现:从数据到 3D 世界的搭建核心代码逐行解析细节优化应用场景:3D 堆叠图

Springboot如何正确使用AOP问题

《Springboot如何正确使用AOP问题》:本文主要介绍Springboot如何正确使用AOP问题,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录​一、AOP概念二、切点表达式​execution表达式案例三、AOP通知四、springboot中使用AOP导出

Navicat数据表的数据添加,删除及使用sql完成数据的添加过程

《Navicat数据表的数据添加,删除及使用sql完成数据的添加过程》:本文主要介绍Navicat数据表的数据添加,删除及使用sql完成数据的添加过程,具有很好的参考价值,希望对大家有所帮助,如有... 目录Navicat数据表数据添加,删除及使用sql完成数据添加选中操作的表则出现如下界面,查看左下角从左

深度解析Spring AOP @Aspect 原理、实战与最佳实践教程

《深度解析SpringAOP@Aspect原理、实战与最佳实践教程》文章系统讲解了SpringAOP核心概念、实现方式及原理,涵盖横切关注点分离、代理机制(JDK/CGLIB)、切入点类型、性能... 目录1. @ASPect 核心概念1.1 AOP 编程范式1.2 @Aspect 关键特性2. 完整代码实