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

相关文章

C++使用栈实现括号匹配的代码详解

《C++使用栈实现括号匹配的代码详解》在编程中,括号匹配是一个常见问题,尤其是在处理数学表达式、编译器解析等任务时,栈是一种非常适合处理此类问题的数据结构,能够精确地管理括号的匹配问题,本文将通过C+... 目录引言问题描述代码讲解代码解析栈的状态表示测试总结引言在编程中,括号匹配是一个常见问题,尤其是在

Java中String字符串使用避坑指南

《Java中String字符串使用避坑指南》Java中的String字符串是我们日常编程中用得最多的类之一,看似简单的String使用,却隐藏着不少“坑”,如果不注意,可能会导致性能问题、意外的错误容... 目录8个避坑点如下:1. 字符串的不可变性:每次修改都创建新对象2. 使用 == 比较字符串,陷阱满

Python使用国内镜像加速pip安装的方法讲解

《Python使用国内镜像加速pip安装的方法讲解》在Python开发中,pip是一个非常重要的工具,用于安装和管理Python的第三方库,然而,在国内使用pip安装依赖时,往往会因为网络问题而导致速... 目录一、pip 工具简介1. 什么是 pip?2. 什么是 -i 参数?二、国内镜像源的选择三、如何

使用C++实现链表元素的反转

《使用C++实现链表元素的反转》反转链表是链表操作中一个经典的问题,也是面试中常见的考题,本文将从思路到实现一步步地讲解如何实现链表的反转,帮助初学者理解这一操作,我们将使用C++代码演示具体实现,同... 目录问题定义思路分析代码实现带头节点的链表代码讲解其他实现方式时间和空间复杂度分析总结问题定义给定

Linux使用nload监控网络流量的方法

《Linux使用nload监控网络流量的方法》Linux中的nload命令是一个用于实时监控网络流量的工具,它提供了传入和传出流量的可视化表示,帮助用户一目了然地了解网络活动,本文给大家介绍了Linu... 目录简介安装示例用法基础用法指定网络接口限制显示特定流量类型指定刷新率设置流量速率的显示单位监控多个

JavaScript中的reduce方法执行过程、使用场景及进阶用法

《JavaScript中的reduce方法执行过程、使用场景及进阶用法》:本文主要介绍JavaScript中的reduce方法执行过程、使用场景及进阶用法的相关资料,reduce是JavaScri... 目录1. 什么是reduce2. reduce语法2.1 语法2.2 参数说明3. reduce执行过程

如何使用Java实现请求deepseek

《如何使用Java实现请求deepseek》这篇文章主要为大家详细介绍了如何使用Java实现请求deepseek功能,文中的示例代码讲解详细,感兴趣的小伙伴可以跟随小编一起学习一下... 目录1.deepseek的api创建2.Java实现请求deepseek2.1 pom文件2.2 json转化文件2.2

python使用fastapi实现多语言国际化的操作指南

《python使用fastapi实现多语言国际化的操作指南》本文介绍了使用Python和FastAPI实现多语言国际化的操作指南,包括多语言架构技术栈、翻译管理、前端本地化、语言切换机制以及常见陷阱和... 目录多语言国际化实现指南项目多语言架构技术栈目录结构翻译工作流1. 翻译数据存储2. 翻译生成脚本

C++ Primer 多维数组的使用

《C++Primer多维数组的使用》本文主要介绍了多维数组在C++语言中的定义、初始化、下标引用以及使用范围for语句处理多维数组的方法,具有一定的参考价值,感兴趣的可以了解一下... 目录多维数组多维数组的初始化多维数组的下标引用使用范围for语句处理多维数组指针和多维数组多维数组严格来说,C++语言没

在 Spring Boot 中使用 @Autowired和 @Bean注解的示例详解

《在SpringBoot中使用@Autowired和@Bean注解的示例详解》本文通过一个示例演示了如何在SpringBoot中使用@Autowired和@Bean注解进行依赖注入和Bean... 目录在 Spring Boot 中使用 @Autowired 和 @Bean 注解示例背景1. 定义 Stud