SPEC2006

https://www.spec.org/cpu2006/Docs/runspec.html
https://blog.csdn.net/wkl_venus/article/details/127688671: 报错参考

400.perlbench C PERL Programming Language
401.bzip2 C Compression
403.gcc C C Compiler
429.mcf C Combinatorial Optimization
445.gobmk C Artificial Intelligence: go
456.hmmer C Search Gene Sequence
458.sjeng C Artificial Intelligence: chess
462.libquantum C Physics: Quantum Computing
464.h264ref C Video Compression
471.omnetpp C++ Discrete Event Simulation
473.astar C++ Path-finding Algorithms
483.xalancbmk C++ XML Processing
410.bwaves Fortran Fluid Dynamics
416.gamess Fortran Quantum Chemistry
433.milc C Physics: Quantum Chromodynamics
434.zeusmp Fortran Physics/CFD
435.gromacs C/Fortran Biochemistry/Molecular Dynamics
436.cactusADM C/Fortran Physics/General Relativity
437.leslie3d Fortran Fluid Dynamics
444.namd C++ Biology/Molecular Dynamics
447.dealII C++ Finite Element Analysis
450.soplex C++ Linear Programming, Optimization
453.povray C++ Image Ray-tracing
454.calculix C/Fortran Structural Mechanics
459.GemsFDTD Fortran Computational Electromagnetics
465.tonto Fortran Quantum Chemistry
470.lbm C Fluid Dynamics
481.wrf C/Fortran Weather Prediction
482.sphinx3 C Speech recognition

一、安装与获取

二、环境配置

RISC-V 32

  • 获取写好的rv脚本:https://github.com/zhejianguk/SPEC06-RISCV-X64.git
  • 将其中的riscv.cfg复制到<spec_src>/config内,然后进行修改(==样本见附录==)

三、运行测试

部分参数

  • –action:可以是run、build、clean、onlyrun等等

    四、异常报告

通用问题

1. 环境污染导致无法编译

Compiling Binaries
  Building 400.perlbench ref base riscv default: (build_base_riscv.0000)

/data/spec2006/speccpu2006-v1.0.1/benchspec/CPU2006/400.perlbench/src/perl.h is corrupt!
ERROR: src directory for 400.perlbench contains corrupt files.
       Is your SPEC CPU2006 distribution corrupt, or have you changed any
       of the files listed above?

此时需要修改config文件在头部添加strict_rundir_verify = 0

2. 浮点库编译都是错误

可能是Fortran工具链问题,riscv-gnu不会默认编译gfortran。去riscv-gnu-toolchain中需要重新编译GCC。
嵌套的坑:主要不能在主目录设置支持的语言!要去riscv-gnu-toolchain/gcc中输入:./configure --prefix=/opt/riscv --target=riscv32-unknown-elf --with-arch=rv32imfdc --with-abi=ilp32d --enable-languages=c,c++,fortran

3. fortran缺库

400.perlbench

#include <arpa/inet.h> 丢失

修改benchspec/CPU2006/400.perlbench/src/perl.h的886行:注释掉
修改benchspec/CPU2006/400.perlbench/src/perl.h的1083行:注释掉

483.xalancbmk

#include <linux/limits .h >

需要修改为#include <limits.h>

附录A-RISC-V config

###################################################################
# RISC-V 32 Config file for SPEC CPU2006
# Last Update: 2024 June 29

# -------------------------------------------------------------

# This file is an agglomeration from the provided CPU2006 example configuration
# files (Example-simple.cfg and Example-linux64-amd64-gcc43+.cfg).

# Note: I make no promises as to its suitability for use in official
# submissions.
 
# Please see http://www.spec.org/cpu2006/Docs/config.html (also available in
# the Docs directory of your SPEC tree) for details on config file setup.  The
# config.html page has a list of all of the fields required for a full
# publication of results.

#######################################################################
# Tester Description
test_sponsor       = Test Sponsor (Optional, defaults to hw_vendor)
tester             = (Optional, defaults to hw_vendor)

# System Description
hw_model           = Unknown HW Model
hw_memory          = 256 GB
hw_disk            = 12 1TB Mystery Disk
hw_vendor          = Berkeley Architecture Research
hw_other           = None
hw_avail           = Dec-9999

# CPU description
# See http://www.spec.org/cpu2006/Docs/runrules.html#cpucount
# for a discussion of these fields

hw_cpu_name        = Unknown RISC-V CPU 
hw_cpu_char        =
hw_cpu_mhz         = 1000
hw_fpu             = Integrated
hw_nchips          = 1
hw_ncores          = number of cores enabled
hw_ncoresperchip   = number of cores manufactured into each chip
hw_nthreadspercore = number of threads enabled per core
hw_ncpuorder       = 1,2 chips

# Cache description

hw_pcache          = 9999 MB I + 9999 MB D on chip per chip
hw_scache          = 9999 MB I+D on chip per chip
hw_tcache          = 9999 MB I+D off chip per chip
hw_ocache          = None

# Tester description 

license_num     = 0

# Operating system, file system

sw_os           = RISC-V Proxy-Kernel Version Unknown
sw_file         = Unknown File System
sw_state        = Multi-user
sw_other        = None
 
## SW config
sw_compiler        = gcc, g++ 13.2.0
sw_avail           = 2024
sw_base_ptrsize    = 32-bit
sw_peak_ptrsize    = 32-bit
 
#######################################################################
# End of SUT section
# If this config file were to be applied to several SUTs, edits would
# be needed only ABOVE this point.
######################################################################

ignore_errors = yes
tune          = base
basepeak      = yes
ext           = riscv
output_format = asc,csv,html

# The publicly-accessible PathScale flags file at the URL below works
# with the settings in this file.  If you change compilers or compiler
# settings, you'll likely need to use a different flags file.
#flagsurl0     = $[top]/config/flags/riscv64-gcc-flags-revA.xml
#flagsurl1     = $[top]/config/flags/riscv64-linux-platform-revA.xml

reportable    = yes

default=default=default=default:
#####################################################################
#
# Compiler selection
#
#####################################################################

# below we assume that the binaries will be run on top of the riscv-pk, 
# which needs a static binary with the program loaded at 0x10000.  
# Ideally, we would use newlib (riscv64-unknown-elf-gcc) which uses 
# those settings by default, however some of the SPEC benchmarks require 
# glibc.

CC  = riscv32-unknown-elf-gcc -static -Wl,-Ttext-segment,0x10000
CXX = riscv32-unknown-elf-g++ -static -Wl,-Ttext-segment,0x10000
FC  = riscv32-unknown-elf-gfortran -static -Wl,-Ttext-segment,0x10000

#####################################################################
# Optimization
#####################################################################

default=base=default=default:
COPTIMIZE      = -O3 -fno-strict-aliasing 
CXXOPTIMIZE    = -O3 -fno-strict-aliasing
FOPTIMIZE      = -O3 -fno-strict-aliasing

#####################################################################
# 32/64 bit Portability Flags - all
#####################################################################

default=base=default=default:
PORTABILITY    = -DSPEC_CPU_ILP32

#####################################################################
# Portability Flags
#####################################################################

400.perlbench=default=default=default:
CPORTABILITY   = -DSPEC_CPU_LINUX -std=gnu89 

416.gamess=default=default=default:
CPORTABILITY   =  -funconstrained-commons

462.libquantum=default=default=default:
CPORTABILITY   =  -DSPEC_CPU_LINUX

464.h264ref=default=default=default:
CPORTABILITY   =  -fsigned-char

482.sphinx3=default=default=default:
CPORTABILITY   =  -fsigned-char

483.xalancbmk=default=default=default:
CXXPORTABILITY = -DSPEC_CPU_LINUX

481.wrf=default=default=default:
CPORTABILITY   = -DSPEC_CPU_CASE_FLAG -DSPEC_CPU_LINUX

附录 B-AMD64 config LLVM-19.1.0

####################################################################
# AMD64 (64-bit) config file
# Config file for CPU2006 with LLVM 19.1.0 base only
#####################################################################
ignore_errors = yes
tune          = base
ext           = llvm19.1.0-AMD64
output_format = asc, txt, Screen
reportable    = 1
teeout        = yes
teerunout     = yes
hw_avail = Dec-9999
license_num = 9999
test_sponsor = SKLP, ICT, CAS
prepared_by =
tester      = ylqh
test_date = Mar-2025
makeflags = -j 64
submit = /usr/bin/taskset -c 0 $command

default=default=default=default:
#####################################################################
#
# Compiler selection
#
#####################################################################
# LLVM_19_INSTALL_PATH=/home/bosc/yangz/llvm-project/build
LLVM_19_INSTALL_PATH=/home/yz/clean/llvm-project/build

CC           = $(LLVM_19_INSTALL_PATH)/bin/clang
CXX          = $(LLVM_19_INSTALL_PATH)/bin/clang++
FC           = $(LLVM_19_INSTALL_PATH)/bin/flang-new

# LLVM config
# cmake -G "Ninja" \
# -DLLVM_ENABLE_PROJECTS="clang;lld;flang" \
# -DLLVM_ENABLE_RUNTIMES="compiler-rt" \
# -DLLVM_TARGETS_TO_BUILD="host" \
# -DCMAKE_BUILD_TYPE=Release \
#  ../llvm

hw_model     = AMD Ryzen 9 9950X 16-Core Processor
hw_cpu_name  = AMD Ryzen 9 9950X 16-Core Processor
hw_cpu_char  = Family 26, Model 68, Stepping 0
hw_cpu_mhz   = 8180.000
hw_fpu       = Integrated
hw_nchips    = 1
hw_ncores    = 16
hw_ncoresperchip = 16
hw_nthreadspercore = 2
hw_ncpuorder = 1 chip
hw_pcache    = 32 KB I + 32 KB D per core (Total: 1 MB)
hw_scache    = 1 MB per core (Total: 16 MB)
hw_tcache    = None
hw_ocache    = 64 MB (Shared L3 Cache)
hw_memory    = 32 GB DDR5 (2x16GB)
hw_disk      = NVMe SSD / SATA SSD (fill with actual device)
hw_vendor    = AMD

sw_os        = Ubuntu 22.04.4 LTS (Jammy) (Linux Kernel 6.5.0-18-generic)
sw_file      = ext4
sw_state     = runlevel 5
sw_compiler  = Clang 19.0.0 (LLVM 19), libc++ 19, Flang 19.0.0
sw_avail     = Mar-2025
sw_other     = None
sw_auto_parallel = No
sw_base_ptrsize = 64-bit
sw_peak_ptrsize = 64-bit

#####################################################################
# Optimization
#####################################################################

default=default=default=default:
# Note 1: Don't use -ffast-math for 453.povray !
# Note 2: Use commmand `ulimit -s unlimited` at beginning ! 
#  Otherwise 410.bwaves and 481.wrf will report core dumped when running !

COPTIMIZE   = -O3
CXXOPTIMIZE = -O3
FOPTIMIZE   = -O3

EXTRA_FLIBS = -lm
LDOPTIMIZE = -z muldefs
EXTRA_LDFLAGS = -fuse-ld=lld
EXTRA_LIBS = -ldl -lrt
EXTRA_CPORTABILITY = -DSPEC_LP64 -Wno-int-conversion
EXTRA_CXXPORTABILITY = -DSPEC_LP64 -Wno-int-conversion
EXTRA_FPORTABILITY = -DSPEC_LP64

#####################################################################
# 32/64 bit Portability Flags - all
#####################################################################

default=base=default=default:
notes25= PORTABILITY=-DSPEC_CPU_LP64 is applied to all benchmarks in base.
PORTABILITY = -DSPEC_CPU_LP64

#####################################################################
# Portability Flags - INT
#####################################################################

400.perlbench=default=default=default:
# Pick one of the defines below, or the other
notes35    = 400.perlbench: -DSPEC_CPU_LINUX_X64
CPORTABILITY = -DSPEC_CPU_LINUX_X64 -ansi -DSPEC_CPU_NO_HAS_SIGSETJMP

453.povray=default=default=default:
CXXPORTABILITY = -std=c++11

462.libquantum=default=default=default:
notes60= 462.libquantum: -DSPEC_CPU_LINUX
CPORTABILITY=  -DSPEC_CPU_LINUX

483.xalancbmk=default=default=default:
CXXPORTABILITY= -DSPEC_CPU_LINUX -include cstring -Wno-c++11-narrowing -fdelayed-template-parsing

#####################################################################
# Portability Flags - FP
#####################################################################
410.bwaves=default=default=default:

416.gamess=default=default=default:

435.gromacs=default=default=default:
FPORTABILITY   = -static

436.cactusADM=default=default=default:
CPORTABILITY = -std=gnu89
FPORTABILITY   = -static

444.namd=default=default=default:
CXXPORTABILITY = -Wno-register

447.dealII=default=default=default:
CXXPORTABILITY = -fpermissive -include cstring -include stddef.h -include cstdlib -std=c++98

450.soplex=default=default=default:
CXXPORTABILITY = -std=c++98

454.calculix=default=default=default:
FPORTABILITY   = -static

456.hmmer=default=default=default:
CPORTABILITY = -Wno-implicit-function-declaration

465.tonto=default=default=default:
FPORTABILITY = -std=f2018

473.astar=default=default=default:
CXXPORTABILITY = -Wno-reserved-user-defined-literal

481.wrf=default=default=default:
CPORTABILITY = -DSPEC_CPU_CASE_FLAG -DSPEC_CPU_LINUX -Wno-implicit-int -Wno-implicit-function-declaration
FPORTABILITY = -std=f2018

附录 C-AMD64-7950X LLVM-20.

####################################################################
# AMD64 (64-bit) config file
# Config file for CPU2006 with LLVM 19.1.0 base only
#####################################################################
ignore_errors = yes
tune          = base
ext           = llvm19.1.0-AMD64
output_format = asc, txt, Screen
reportable    = 1
teeout        = yes
teerunout     = yes
hw_avail = Dec-9999
license_num = 9999
test_sponsor = SKLP, ICT, CAS
prepared_by =
tester      = ylqh
test_date = Mar-2025
makeflags = -j 64
submit = /usr/bin/taskset -c 0 $command

default=default=default=default:
#####################################################################
#
# Compiler selection
#
#####################################################################
LLVM_19_INSTALL_PATH=/home/yz/clean/llvm-project/build

CC           = $(LLVM_19_INSTALL_PATH)/bin/clang
CXX          = $(LLVM_19_INSTALL_PATH)/bin/clang++
FC           = $(LLVM_19_INSTALL_PATH)/bin/flang-new

# LLVM config
# cmake -G "Ninja" \
# -DLLVM_ENABLE_PROJECTS="clang;lld;flang" \
# -DLLVM_ENABLE_RUNTIMES="compiler-rt" \
# -DLLVM_TARGETS_TO_BUILD="host" \
# -DCMAKE_BUILD_TYPE=Release \
#  ../llvm

hw_model     = AMD Ryzen 9 7950X 16-Core Processor
hw_cpu_name  = AMD Ryzen 9 7950X 16-Core Processor
hw_cpu_char  = Family 25, Model 97, Stepping 2
hw_cpu_mhz   = 5881.000
hw_fpu       = Integrated
hw_nchips    = 1
hw_ncores    = 16
hw_ncoresperchip = 16
hw_nthreadspercore = 2
hw_ncpuorder = 1 chip
hw_pcache    = 32 KB I + 32 KB D per core (Total: 1 MB)
hw_scache    = 1 MB per core (Total: 16 MB)
hw_tcache    = 64 MB (Shared L3 Cache, 2 instances)
hw_ocache    = None
hw_memory    = 32 GB DDR5 (2x16GB)
hw_disk      = NVMe SSD / SATA SSD
hw_vendor    = AMD
hw_arch      = x86_64
hw_virtualization = AMD-V
hw_numa_nodes = 1

sw_os        = Ubuntu 22.04.4 LTS (Jammy) (Linux Kernel 6.5.0-18-generic)
sw_file      = ext4
sw_state     = runlevel 5
sw_compiler  = Clang 19.0.0 (LLVM 19), libc++ 19, Flang 19.0.0
sw_avail     = Mar-2025
sw_other     = None
sw_auto_parallel = No
sw_base_ptrsize = 64-bit
sw_peak_ptrsize = 64-bit
sw_virtualization = KVM/QEMU (if applicable)
sw_security  = Spectre v1/v2 mitigations, Meltdown mitigated, Retbleed mitigated

#####################################################################
# Optimization
#####################################################################

default=default=default=default:
# Note 1: Don't use -ffast-math for 453.povray !
# Note 2: Use commmand `ulimit -s unlimited` at beginning ! 
#  Otherwise 410.bwaves and 481.wrf will report core dumped when running !

COPTIMIZE   = -O3
CXXOPTIMIZE = -O3
FOPTIMIZE   = -O3

EXTRA_FLIBS = -lm
LDOPTIMIZE = -z muldefs
EXTRA_LDFLAGS = -fuse-ld=lld
EXTRA_LIBS = -ldl -lrt 
EXTRA_CPORTABILITY = -DSPEC_LP64 -Wno-int-conversion
EXTRA_CXXPORTABILITY = -DSPEC_LP64 -Wno-int-conversion
EXTRA_FPORTABILITY = -DSPEC_LP64

#####################################################################
# 32/64 bit Portability Flags - all
#####################################################################

default=base=default=default:
notes25= PORTABILITY=-DSPEC_CPU_LP64 is applied to all benchmarks in base.
PORTABILITY = -DSPEC_CPU_LP64

#####################################################################
# Portability Flags - INT
#####################################################################

400.perlbench=default=default=default:
# Pick one of the defines below, or the other
notes35    = 400.perlbench: -DSPEC_CPU_LINUX_X64
CPORTABILITY = -DSPEC_CPU_LINUX_X64 -ansi -DSPEC_CPU_NO_HAS_SIGSETJMP

453.povray=default=default=default:
CXXPORTABILITY = -std=c++11

462.libquantum=default=default=default:
notes60= 462.libquantum: -DSPEC_CPU_LINUX
CPORTABILITY=  -DSPEC_CPU_LINUX

483.xalancbmk=default=default=default:
CXXPORTABILITY= -DSPEC_CPU_LINUX -include cstring -Wno-c++11-narrowing -fdelayed-template-parsing

#####################################################################
# Portability Flags - FP
#####################################################################
410.bwaves=default=default=default:

416.gamess=default=default=default:

435.gromacs=default=default=default:
FPORTABILITY   = -static

436.cactusADM=default=default=default:
CPORTABILITY = -std=gnu89
FPORTABILITY   = -static

444.namd=default=default=default:
CXXPORTABILITY = -Wno-register

447.dealII=default=default=default:
CXXPORTABILITY = -fpermissive -include cstring -include stddef.h -include cstdlib -std=c++98

450.soplex=default=default=default:
CXXPORTABILITY = -std=c++98

454.calculix=default=default=default:
FPORTABILITY   = -static

456.hmmer=default=default=default:
CPORTABILITY = -Wno-implicit-function-declaration

465.tonto=default=default=default:
FPORTABILITY = -std=f2018

473.astar=default=default=default:
CXXPORTABILITY = -Wno-reserved-user-defined-literal

481.wrf=default=default=default:
CPORTABILITY = -DSPEC_CPU_CASE_FLAG -DSPEC_CPU_LINUX -Wno-implicit-int -Wno-implicit-function-declaration
FPORTABILITY = -std=f2018