refactor(config): 重构配置文件并添加枚举类定义 重构配置文件以改善代码结构和可读性,新增多个枚举类用于定义SPEC基准测试的不同类型和阶段
refactor(config): 重构配置文件并添加枚举类定义
重构配置文件以改善代码结构和可读性,新增多个枚举类用于定义SPEC基准测试的不同类型和阶段
PackSPEC 是一个用于自动化打包和管理SPEC CPU基准测试文件的工具,支持SPEC2006和SPEC2017版本。
SPECName
TuneType
InputType
SPECSubBench
ActionType
安装依赖:
pip install -r requirements.txt
配置项目: 将 config.py.example 复制为 config.py 并编辑配置文件, 将 main.py.example 复制为 main.py:
config.py.example
config.py
main.py.example
main.py
cp config.py.example config.py cp main.py.example main.py
编辑config.py文件配置以下信息:
SPEC2006_PATH
SPEC2017_PATH
BOSC_API_KEY
BOSC_AT_USER
python main.py
iterations
test_core_num
PackSPEC( spec_name: SPECName, # SPEC版本(spec2006/spec2017) spec_benches: str, # 基准测试子集("all"/"int"/"fp") tune_type: TuneType, # 优化级别(base/peak/all) input_type: InputType, # 输入类型(test/train/ref/all) iterations: int = 3, # 测试迭代次数(默认3) test_core_num: int = 4, # 测试核心数(默认4) rebuild: bool = True # 是否重新构建(默认True) )
参数说明:
spec_name
spec_benches
tune_type
input_type
rebuild
analyze_spec_config(spec_cfg: str) -> str: 分析SPEC配置文件获取构建标签
analyze_spec_config(spec_cfg: str) -> str
run_setup_spec(spec_cfg: str, tune_type: TuneType, input_type: InputType, rebuild: bool = True) -> str: 设置并编译SPEC环境
run_setup_spec(spec_cfg: str, tune_type: TuneType, input_type: InputType, rebuild: bool = True) -> str
get_bench_path(label: str, action_type: ActionType, tune_type: TuneType, input_type: InputType) -> list: 获取基准测试路径
get_bench_path(label: str, action_type: ActionType, tune_type: TuneType, input_type: InputType) -> list
copy_binarys(label: str, tune_type: TuneType, input_type: InputType, dest_binary_dir: str = "") -> str: 复制二进制文件
copy_binarys(label: str, tune_type: TuneType, input_type: InputType, dest_binary_dir: str = "") -> str
copy_benches(label: str, tune_type: TuneType, input_type: InputType, with_build: bool = False, dest_bench_dir: str = "") -> list: 复制完整测试环境
copy_benches(label: str, tune_type: TuneType, input_type: InputType, with_build: bool = False, dest_bench_dir: str = "") -> list
pack_binarys_cfg(spec_cfg: str): 打包二进制文件及相关配置文件
pack_binarys_cfg(spec_cfg: str)
spec_cfg
packer.pack_binarys_cfg("my_config.cfg")
pack_benches_cfg(spec_cfg: str, with_build=False): 打包完整测试环境及相关配置文件
pack_benches_cfg(spec_cfg: str, with_build=False)
with_build
packer.pack_benches_cfg("my_config.cfg", with_build=True)
from pack_spec import * # 创建SPEC2006整数基准测试打包实例 packer = PackSPEC( spec_name=SPECName.spec2006, spec_benches="int", tune_type=TuneType.base, input_type=InputType.ref, iterations=3, test_core_num=4, rebuild=True ) # 分析SPEC配置文件获取标签 label = packer.analyze_spec_config("my_config.cfg") # 设置并编译SPEC环境 packer.run_setup_spec("my_config.cfg", TuneType.base, InputType.ref) # 打包二进制文件 binary_dir = packer.copy_binarys(label, TuneType.base, InputType.ref) # 打包完整测试环境 bench_dirs = packer.copy_benches(label, TuneType.base, InputType.ref, with_build=True)
# 创建SPEC2017完整基准测试打包实例 packer = PackSPEC( spec_name=SPECName.spec2017, spec_benches="all", tune_type=TuneType.all, input_type=InputType.all, iterations=5, test_core_num=8 ) # 设置并编译SPEC环境 packer.setup_spec("advanced_config.cfg") # 打包所有内容 label = packer.analyze_spec_config("advanced_config.cfg") packer.pack_binarys(label) packer.pack_benches(label)
©Copyright 2023 CCF 开源发展委员会 Powered by Trustie& IntelliDE 京ICP备13000930号
PackSPEC 项目
项目简介
PackSPEC 是一个用于自动化打包和管理SPEC CPU基准测试文件的工具,支持SPEC2006和SPEC2017版本。
主要功能
枚举类说明
SPECName
: 指定SPEC版本(spec2006/spec2017)TuneType
: 优化级别(base/peak/all)InputType
: 输入类型(test/train/ref/all)SPECSubBench
: 基准测试子集(all/int/fp)ActionType
: 操作类型(build/run)安装步骤
安装依赖:
配置项目: 将
config.py.example
复制为config.py
并编辑配置文件, 将main.py.example
复制为main.py
:编辑config.py文件配置以下信息:
SPEC2006_PATH
: SPEC2006安装目录路径SPEC2017_PATH
: SPEC2017安装目录路径BOSC_API_KEY
: (可选)钉钉机器人API密钥BOSC_AT_USER
: (可选)钉钉通知手机号使用说明
基本用法
高级功能
iterations
参数设置test_core_num
参数设置示例
PackSPEC类初始化参数
参数说明:
spec_name
: 指定SPEC版本(spec2006或spec2017)spec_benches
: 基准测试子集,可以是”all”(全部)、”int”(整数)或”fp”(浮点),也可以是具体基准测试名称tune_type
: 优化级别,base(基础优化)、peak(峰值优化)或all(两者)input_type
: 输入数据集类型,test(测试)、train(训练)、ref(参考)或all(全部)iterations
: 测试运行迭代次数,默认为3test_core_num
: 测试绑定的CPU核心编号,默认为4rebuild
: 是否重新构建测试环境,默认为True主要方法
analyze_spec_config(spec_cfg: str) -> str
: 分析SPEC配置文件获取构建标签run_setup_spec(spec_cfg: str, tune_type: TuneType, input_type: InputType, rebuild: bool = True) -> str
: 设置并编译SPEC环境get_bench_path(label: str, action_type: ActionType, tune_type: TuneType, input_type: InputType) -> list
: 获取基准测试路径copy_binarys(label: str, tune_type: TuneType, input_type: InputType, dest_binary_dir: str = "") -> str
: 复制二进制文件copy_benches(label: str, tune_type: TuneType, input_type: InputType, with_build: bool = False, dest_bench_dir: str = "") -> list
: 复制完整测试环境pack_binarys_cfg(spec_cfg: str)
: 打包二进制文件及相关配置文件spec_cfg
: SPEC配置文件名packer.pack_binarys_cfg("my_config.cfg")
pack_benches_cfg(spec_cfg: str, with_build=False)
: 打包完整测试环境及相关配置文件spec_cfg
: SPEC配置文件名with_build
: 是否包含构建目录(默认False)packer.pack_benches_cfg("my_config.cfg", with_build=True)
基本示例
高级示例