# ov-bench **Repository Path**: zeasa/ov-bench ## Basic Information - **Project Name**: ov-bench - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-02-26 - **Last Updated**: 2026-03-02 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # ov-bench OpenVINO CPU 推理基准测试与 Pinball/BBV 微架构分析工具集。 ## 功能概览 - **性能基准测试**:在 CPU 上运行多种 OpenVINO 模型,测量延迟、吞吐量、IPC 等指标 - **多精度支持**:FP32、BF16、INT8 推理精度 - **Pinball 追踪**:通过 Intel SDE(Software Development Emulator)生成 Pinball 追踪,用于 CPU 微架构分析 - **硬件性能分析**:使用 `perf` 采集 IPC、分支、缓存、TLB、TMA 等指标 - **BBV 分析**:基于 Pinball 生成 Basic Block Vectors,用于模拟器(如 Sniper) ## 支持模型 | 模型 | 说明 | |------|------| | 3dunet | 3D U-Net 医学图像分割 | | mobilenet-v2 | MobileNet-V2 分类 | | resnet50 | ResNet-50 分类 | | vgg16 | VGG-16 分类 | | vit-b-16 | Vision Transformer | | yolov8n | YOLOv8 Nano 目标检测 | ## 环境要求 - **Python**:3.8+ - **依赖框架**:OpenVINO 2026.0、PyTorch、NNCF(量化) - **外部工具**(可选): - **Intel SDE**:用于 Pinball 追踪 - **perf**:Linux 性能采集 - **numactl**:CPU 绑定 ## 安装 ```bash # 克隆仓库 git clone cd ov-bench # 安装 Python 依赖 pip install -r requirements.txt ``` ## 快速开始 ### 1. 模型准备 将 PyTorch 模型转换为 OpenVINO 格式(FP32 与 INT8): ```bash ./do_modelprepare.sh ``` 输出目录:`model_zoo//fp32|int8/` ### 2. 单模型基准测试 ```bash # 在 cases 目录下运行 cd cases/mobilenet-v2 python run_benchmark.py -m f32 -n 1 -i 100 -t 1 ``` **参数说明**: | 参数 | 说明 | 示例 | |------|------|------| | `-m` / `--mode` | 精度:`f32`、`b16`、`i8`、`all` | `f32` | | `-n` / `--batch` | 批次大小 | `1` | | `-i` / `--iters` | 迭代次数 | `100` | | `-t` / `--threads` | 线程数 | `1` | | `-d` / `--debug-trace` | 启用 Pinball 追踪 | - | ### 3. Pinball 生成(需 Intel SDE) 编辑 `do_pinball.sh`,启用要测试的模型配置,然后执行: ```bash ./do_pinball.sh ``` 配置格式:`__bs`,例如: - `mobilenet-v2_i8_bs1` - `resnet50_b16_bs16` - `3dunet_f32_bs8` ### 4. Replay 与全流程 ```bash # 仅 Replay ./do_replay.sh # Pinball + Replay 全流程 ./do_all.sh ``` ### 5. 性能基准(perf) ```bash ./do_perf_benchmark.sh -a z5 -c 8 # 架构:z4|z5|spr|cd ./do_perf_report.sh -m z5 ``` ### 6. 简单 IPC/时间 benchmark ```bash ./do_timeit_benchmark.sh # 输出到 output.bench/output.txt ``` ## 目录结构 ``` ov-bench/ ├── cases/ # 各模型基准测试用例 │ ├── common.py # 通用基准逻辑 │ └── / # 各模型 run_benchmark.py ├── model_prepare/ # PyTorch → OpenVINO 转换与量化 ├── trace_symbol/ # Pinball 追踪符号库 ├── traces/ # Pinball/Replay 输出(运行时生成) ├── model_zoo/ # 转换后的 OpenVINO 模型(运行时生成) ├── run_pinball.py # Pinball 生成入口 ├── run_replay.py # Replay 入口 ├── run_bbv.py # BBV 生成入口 ├── do_pinball.sh # Pinball 批量脚本 ├── do_replay.sh # Replay 脚本 ├── do_all.sh # Pinball → Replay 全流程 ├── do_modelprepare.sh # 模型准备 ├── do_perf_benchmark.sh # perf 性能基准 ├── do_timeit_benchmark.sh ├── do_perf_report.sh ├── do_result_process.sh └── requirements.txt ``` ## 脚本说明 | 脚本 | 功能 | |------|------| | `do_modelprepare.sh` | 批量转换/量化模型 | | `do_pinball.sh` | 批量生成 Pinball 追踪 | | `do_replay.sh` | Pinball 回放 | | `do_bbv.sh` | 生成 BBV 文件 | | `do_all.sh` | Pinball → Replay 一键执行 | | `do_perf_benchmark.sh` | perf 性能采集 | | `do_perf_report.sh` | 解析 perf 输出为 metric 报告 | | `do_timeit_benchmark.sh` | 简单 IPC/延迟 benchmark | | `do_result_process.sh` | 将 benchmark 结果整理为 Markdown 表 | ## 注意事项 1. **SDE 路径**:`run_pinball.py` 中硬编码了 Intel SDE 路径,需根据本地安装路径修改: ``` /home/zhangw/download/sde-external-9.48.0-2024-11-25-lin/sde64 ``` 2. **Conda 环境**:Pinball 脚本依赖 `pytorch-gpu` conda 环境,可按需调整。 3. **LD_PRELOAD**:`do_timeit_benchmark.sh` 中如使用了 `hg-mkl` 等库,若缺失需注释相关行。 4. **输出目录**:`traces/`、`model_zoo/` 为运行时生成,建议加入 `.gitignore`。 ## License 请参考项目根目录中的 LICENSE 文件。