SPEC CPU 2017 quick start

SPEC CPU 2017 quick start

我这里选择在 linux(ubuntu22.04.3) 上安装 SPEC CPU 2017,gcc、g++、gfortran 均使用 sudo apt install xxx 安装(其版本为11.4.0)

官方的 SPEC CPU 2017 在 Unix Systems 安装示例:

https://www.spec.org/cpu2017/Docs/install-guide-unix.html

1、首先要检查系统配置

以下是官方提供的系统需求:

在这里插入图片描述

我自己的配置:x86-64、Linux、32G内存、512G磁盘

2、验证下载

这部分我没有操作,官方提供示例为可选,我跳过了,可以参考官方的示例进行验证

3、挂在ISO镜像

根据自己的操作系统选择合适的方法装载镜像

我这里是 linux,nix Systems 安装示例:命令如下:

mount -t iso9660 -o ro,exec,loop cpu2017.iso /mnt

我在挂载的时候出现过无法挂载的情况,使用 sudo 权限得到了解决

4、进入挂载的目录
cd /mnt
5、使用install.sh
./install.sh

安装过程中可能需要选择安装的目录,一般安装在/home/xxx/cpu2017,其中xxx为用户名

随后确认,即可安装在指定的目录下

安装过程中会消耗一段时间来解压以及测试工具,测试完成后会提示installation successful

windows 上这一步使用 install.bat 安装时,出现 utf-8 相关的报错,没有在 windows 上成功安装,修改系统的默认编码为 utf-8 仍有问题,并没有找到合适的解决方案,遂放弃

6、设置路径、使用shrc或cshrc

使用如下命令查看shell是哪一种兼容

echo $SHELL

我这里是 bash,也就是 Bourne-shell 兼容的Bash shell,大多数应该是这种

所以应该使用的是 shrc

cd /home/xxx/cpu2017
source shrc

每次要执行 SPEC CPU 2017 时,要执行上述命令,在 cpu2017 目录下 source shrc !

7、选择配置未见并尝试构建一个基准测试
(1)查找配置文件

根据安装时的配置,其位于 /home/xxx/cpu2017/config,目录下的 Example* 即为安装的配置文件

官方提供了另一种方式:www.spec.org/cpu2017/results,查找当前系统类似的系统,单击 “配置” 链接

其中提供了很多公司提交的测试结果,并附上了其使用的配置

(2)命名

将选择的配置文件复制到配置目录中,并制定一个不使用空格的名称,最好该名称有有用的含义

$SPEC/config/JeffWantsYetAnotherTest.cfg

示例:

cp Example-gcc-linux-x86.cfg try1.cfg 

以下内容采用 vim 工具或其他文本编辑工具,对 try1.cfg 进行修改

(3)编辑标签

最好编辑并修改以下行

label=something

如果没有这样的行,就在顶部自己添加一行,标签是添加到二进制文件和目录中的任意标签,当需要查找运行目录、分析问题和清理磁盘空间时有用,最好使用有意义的名字,并且不允许有空格

示例:

%define label mytest
# 将上述内容修改成为如下内容
%define label firstrun
(4)其他编辑

下面几条为官方给的说明:

查找标记为 Edit 的位置并进行修改

查找路径并根据需要进行调整(例如编译器在/opt/bin但配置文件使用/usr/bin)

在配置文件中查找任何命令,并验证他们不会引起意外

SPEC CPU 配置文件可以执行任意 shell 命令,使用之前先阅读配置文件,不要以管理员身份运行

示例:

%define build_ncpus 8
# 比如修改成4,也可以在命令行中配置, runcpu --define build_ncpus=nn
%define build_ncpus 4
%define gcc_dir /SW/compilers/GCC/Linux/x86_64/gcc-6.3.0
# 这个根据实际情况修改成如下内容, gcc 地址看本地情况
%define gcc_dir /usr/bin/gcc

可以通过 diff 命令查看相较于 Example 修改了哪些内容

diff Example-gcc-linux-x86.cfg try1.cfg  | grep define
# 终端显示如下内容
< %define label mytest                # (2)      Use a label meaningful to *you*.
> %define label firstrun                # (2)      Use a label meaningful to *you*.
< %   define  build_ncpus 8      #      Or, you can set it on the command line: 
> %   define  build_ncpus 4      #      Or, you can set it on the command line: 
< %   define  gcc_dir        /SW/compilers/GCC/Linux/x86_64/gcc-6.3.0
> %   define  gcc_dir        /usr

注意:我这里的 gcc 使用 sudo apt 安装的,安装在 gcc 命令为 /usr/bin/gcc

之前配置 gcc_dir 为 /usr/bin/gcc(实际上是命令,而非地址),导致出现如下问题:

# 查看提示中的 "/home/jingyu/cpu2017/benchspec/CPU/505.mcf_r/build/build_base_firstrun-m64.0000/make.out" 有如下错误:
specmake: execvp: /usr/bin/gcc/bin/gcc: Not a directory
specmake: *** [/home/jingyu/cpu2017/benchspec/Makefile.defaults:347: mcf.o] Error 127

其中地址明显非本意,对于 sudo apt 安装的 gcc,gcc_dir 只需要填写 /usr 即可,会自动找到 bin/gcc,如果是手动编译的 gcc,则要使用为其创建的路径即可

(5)尝试建立一个单一的基准
# 前提:前面进行了 source shrc 的操作,否则可能找不到 runcpu 命令
runcpu --config=try1 --action=build 505.mcf_r

得到如下内容,则说明成功!

SPEC CPU(r) 2017 Benchmark Suites
Copyright 1995-2017 Standard Performance Evaluation Corporation (SPEC)

runcpu v5825
Using 'linux-x86_64' tools
Reading file manifests... read 32325 entries from 2 files in 0.07s (470161 files/s)
Loading runcpu modules.................
Locating benchmarks...found 47 benchmarks in 53 benchsets.
Reading config file '/home/jingyu/cpu2017/config/try1.cfg'
1 configuration selected:

Action   Benchmarks
------   ----------------------------------------------------------------------
build    505.mcf_r                                                             
-------------------------------------------------------------------------------

Setting up environment for running 505.mcf_r...
Starting runcpu for 505.mcf_r...部分
Running "specperl /home/jingyu/cpu2017/bin/sysinfo" to gather system information.
sysinfo: r5797 of 2017-06-14 (96c45e4568ad54c135fd618bcc091c0f)
sysinfo: Getting system information for Linux...
sysinfo: ...getting CPU info
sysinfo: ...getting info from numactl
sysinfo: ...getting memory info
sysinfo: ...getting OS info
sysinfo: ...getting disk info
sysinfo: ...trying to get DIMM info from dmidecode
Retrieving flags file (/home/jingyu/cpu2017/config/flags/gcc.xml)...
Benchmarks selected: 505.mcf_r
Compiling Binaries
  Building 505.mcf_r base firstrun-m64: (build_base_firstrun-m64.0000) [2024-01-15 17:05:50]

Build successes for intrate: 505.mcf_r(base)
Build errors for intrate: None

Build Complete
The log for this run is in /home/jingyu/cpu2017/result/CPU2017.005.log

runcpu finished at 2024-01-15 17:05:52; 2 total seconds elapsed
(5) 尝试编译一个完整的套件并测试负载

SPEC CPU 2017 包含 43 个benchmarks,它们被分成了 4 个套件:

  • int rate
  • int speed
  • fp rate
  • fp speed
# 示例
runcpu --config=try1 --size=test --copies=1 --noreportable --iterations=1 intrate

参数表示:选择最小的工作负载大小,确保仅运行一份副本,CPU 不应该进行完整的、可报告的运行,每个基准仅运行一次

遇到的相关问题采用如下方式解决:

  • 502.gcc_r 编译报错:部分

https://blog.csdn.net/yi_1973/article/details/83150183

在 OPTIMIZE 后添加了一个配置选项 fgnu89-inline

# EDIT if needed -- Older GCC might not support some of the optimization
#                   switches here.  See also 'About the -fno switches' below.
#
default=base:        # flags for all base 
   OPTIMIZE       = -g -O3 -march=native -fno-unsafe-math-optimizations  -fno-tree-loop-vectorize -fgnu89-inline

对于 502、602 这样的问题,GPT 4:在旧版本的GCC中,-fgnu89-inline 是默认的内联行为,新版本中可能已经发生改变,显示指定该内联行为

注意:该套件下部分测试需要使用g++、gfortran,也需要安装,我使用 sudo apt install g++ gfortran 将其安装在 /usr/bin 目录下

  • 520.omnetpp_r 执行报错如下:
...
520.omnetpp_r: copy 0 non-zero return code (exit code=1, signal=0)

****************************************
Contents of omnetpp.General-0.err
****************************************
<!> Error during startup: Register_Function() or cMathFunction: attempt to register function "SPEC_HYPOT" with wrong number of arguments 2, should be 3.
...

参考

https://www.codetds.com/article/16153919

https://github.com/ccelio/Speckle/issues/21

在 try1.cfg 里补充以下内容:

# Benchmark-specific portability (ordered by last 2 digits of bmark number)
...
520.omnetpp_r:
   CXXPORTABILITY  = -Wno-error=register --std=c++14
...

并未对原因进行分析,通过查阅资料的方式暂时解决了以上问题

最终的结果保存在/home/jingyu/cpu2017/result

可以通过浏览器查看 html 格式的结果(这里仅展示部分内容)

在这里插入图片描述

8、尝试执行一个可报告的run

上面一切正常,就可以尝试该部分

# 查看本机有几个物理核心
grep 'core id' /proc/cpuinfo | sort | uniq
# 查看本机有几个硬件线程	(超线程技术相关)
grep 'processor' /proc/cpuinfo | sort | uniq

以上信息也可以通过 lscpu 命令查看,并且会更仔细

我这里是 1 个物理CPU、包括 8 个核心、16 个硬件线程

对于个人电脑,一般为一个socket,即一个肉眼可以看得见的CPU插槽

一个 CPU 由多个核心组成,一个核心可以通过超线程技术执行多个硬件线程(一般为两个)

服务器等高性能计算机系统一般会有多个物理 CPU 插槽(socket)

SPECrate 和 SPECspeed 都可以测试多个芯片/核心/硬件线程

  • 对于 SPECrate 可以设置 copies 的数量
  • 对于 SPECspeed 可以设置 threads 的数量

示例:

# 修改 try1.cfg 文件
# 因为我是 8 个核心, 所以设置为了 8
intrate,fprate:
   copies           = 8   # EDIT to change number of copies (see above)

# 可以尝试匹配核心数量或者也可以根据 grep -c processor /proc/cpuinfo 来进行设置
# 以下是配置文件中对其的描述:
#		copies - This config file defaults to testing only 1 copy.   You might
#              try changing it to match the number of cores on your system, 
#              or perhaps the number of virtual CPUs as reported by:
#                     grep -c processor /proc/cpuinfo
#              Be sure you have enough memory.  See:
#              https://www.spec.org/cpu2017/Docs/system-requirements.html#memory

执行:

runcpu --config=try1 --reportable intrate

等待执行完成即可

挖个坑:分析以下 cfg 中需要配置的内容
  • 18
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值