diff --git a/docs/lite/docs/source_en/tools/benchmark_tool.md b/docs/lite/docs/source_en/tools/benchmark_tool.md index 39d5a4eca18e81efd59d5d4db28d92bbed1caca1..013b711bbf3db72c0ac73cdcd3fbaf4b228ac2b8 100644 --- a/docs/lite/docs/source_en/tools/benchmark_tool.md +++ b/docs/lite/docs/source_en/tools/benchmark_tool.md @@ -82,7 +82,7 @@ The following describes the parameters in detail. | `--cpuBindMode=` | Optional | Specifies the type of the CPU core bound to the model inference program. | Integer | 1 | 2: medium core
1: large core
0: not bound | | `--device=` | Optional | Specifies the type of the device on which the model inference program runs. | String | CPU | CPU or GPU or NPU or Ascend | | `--help` | Optional | Displays the help information about the `benchmark` command. | - | - | - | -| `--inDataFile=` | Optional | Specifies the file path of the input data of the tested model. If this parameter is not set, a random value will be used. | String | Null | - | +| `--inDataFile=` | Optional | Specifies the file path of the input data of the tested model, and for several file paths, use "," to segregate. If this parameter is not set, a random value will be used. | String | Null | - | | `--loopCount=` | Optional | Specifies the number of forward inference times of the tested model when the Benchmark tool is used for the benchmark testing. The value should be a positive integer. | Integer | 10 | - | | `--numThreads=` | Optional | Specifies the number of threads for running the model inference program. | Integer | 2 | - | | `--warmUpLoopCount=` | Optional | Specifies the number of preheating inference times of the tested model before multiple rounds of the benchmark test are executed. | Integer | 3 | - | @@ -181,6 +181,12 @@ To set specified input shapes (such as 1,32,32,1), use the command as follows: ./benchmark --modelFile=/path/to/model.ms --inDataFile=/path/to/input.bin --inputShapes=1,32,32,1 --device=CPU --accuracyThreshold=3 --benchmarkDataFile=/path/to/output.out ``` +To set multiple input data files (such as 2 files) and specified input shapes (such as 1,32,32,1), use the command as follows: + +```bash +./benchmark --modelFile=/path/to/model.ms --inDataFile=/path/to/input0.bin,/path/to/input1.bin --inputShapes=1,32,32,1 --device=CPU --accuracyThreshold=3 --benchmarkDataFile=/path/to/output.out +``` + #### CPU Performance Test The main test indicator of the CPU performance test performed by the Benchmark tool is the readings of CPU Performance Monitor Unit(PMU) of a single forward inference, including the number of CPU cycles and instructions, cache reference times and cache miss times, front-end stall cycles and back-end stall cycles. In a performance test, you do not need to set benchmark data parameters such as `benchmarkDataFile`. But you can set the parameter `perfProfiling` as True or False to decide whether to print the CPU performance data of the model at the network layer on a certain device, and set `perfEvent` as `CYCLE`/`CACHE`/`STALL` to decide what CPU performance data to measure. The default value of `perfProfiling` is False, the default value of `perfEvent` is `CYCLE`. Due to the fluctuation of PMU readings in multi-thread tests, `numThreads` is suggested to be set as `1`. For example: @@ -364,6 +370,12 @@ When using the Benchmark tool to perform benchmark testing on different MindSpor call benchmark.exe --modelFile=/path/to/model.ms --inDataFile=/path/to/input.bin --benchmarkDataFile=/path/to/output.out --inputShapes=1,32,32,1 ``` +- Set multiple input data files. + + ```bat + call benchmark.exe --modelFile=/path/to/model.ms --inDataFile=/path/to/input0.bin,/path/to/input1.bin --benchmarkDataFile=/path/to/output.out + ``` + ### Dump The usage of Dump function in the Windows environment is basically the same as that of in the [Linux environment](https://www.mindspore.cn/lite/docs/en/r2.7.0/tools/benchmark_tool.html#dump), and will not be repeated here. diff --git a/docs/lite/docs/source_zh_cn/tools/benchmark_tool.md b/docs/lite/docs/source_zh_cn/tools/benchmark_tool.md index 2eae5e874094006e018ee00bbe35413ad2ec0fe5..f0edab09780dd6b479be65972f1e0ac9b2062a1c 100644 --- a/docs/lite/docs/source_zh_cn/tools/benchmark_tool.md +++ b/docs/lite/docs/source_zh_cn/tools/benchmark_tool.md @@ -82,13 +82,13 @@ | `--cpuBindMode=` | 可选 | 指定模型推理程序运行时绑定的CPU核类型。 | Integer | 1 | 2:表示中核
1:表示大核
0:表示不绑定 | | `--device=` | 可选 | 指定模型推理程序运行的设备类型。 | String | CPU | CPU、GPU、NPU、Ascend | | `--help` | 可选 | 显示`benchmark`命令的帮助信息。 | - | - | - | -| `--inDataFile=` | 可选 | 指定测试模型输入数据的文件路径。如果未设置,则使用随机输入。 | String | null | - | +| `--inDataFile=` | 可选 | 指定测试模型输入数据的文件路径,多个输入数据文件用‘,’隔开。如果未设置,则使用随机输入。 | String | null | - | | `--loopCount=` | 可选 | 指定Benchmark工具进行基准测试时,测试模型的前向推理运行次数,其值为正整数。 | Integer | 10 | - | | `--numThreads=` | 可选 | 指定模型推理程序运行的线程数。 | Integer | 2 | - | | `--warmUpLoopCount=` | 可选 | 指定测试模型在执行基准测试运行轮数前进行的模型预热推理次数。 | Integer | 3 | - | | `--enableFp16=` | 可选 | 指定是否优先使用float16算子。 | Boolean | false | true, false | | `--timeProfiling=` | 可选 | 性能验证时生效,指定是否使用TimeProfiler打印每个算子的耗时。 | Boolean | false | true, false | -| `--inputShapes=` | 可选 | 指定输入维度,维度应该按照NHWC格式输入。维度值之间用‘,'隔开,多个输入的维度之间用‘:’隔开 | String | Null | - | +| `--inputShapes=` | 可选 | 指定输入维度,维度应该按照NHWC格式输入。维度值之间用‘,'隔开,多个输入的维度之间用‘:’隔开。 | String | Null | - | | `--perfProfiling=` | 可选 | CPU性能验证时生效,指定是否使用PerfProfiler打印每个算子的CPU性能,当timeProfiling为true时无效。目前仅支持aarch64 CPU。 | Boolean | false | true, false | | `--perfEvent=` | 可选 | CPU性能验证时生效,指定PerfProfiler打印的CPU性能参数的具体内容,指定为CYCLE时,会打印算子的CPU周期数和指令条数;指定为CACHE时,会打印算子的缓存读取次数和缓存未命中次数;指定为STALL时,会打印CPU前端等待周期数和后端等待周期数。 | String | CYCLE | CYCLE/CACHE/STALL | | `--decryptKey=` | 可选 | 用于解密文件的密钥,以十六进制字符表示。仅支持 AES-GCM,密钥长度仅支持16Byte。 | String | null | 注意密钥为十六进制表示的字符串,Linux平台用户可以使用`xxd`工具对字节表示的密钥进行十六进制表达转换。 | @@ -175,12 +175,18 @@ Mean bias of all nodes: 0% ======================================================= ``` -如果需要指定输入数据的维度(例如输入维度为1,32,32,1),使用如下命令: +如果模型输入是动态维度,需要指定输入数据的维度(例如输入维度为1,32,32,1),使用如下命令: ```bash ./benchmark --modelFile=/path/to/model.ms --inDataFile=/path/to/input.bin --inputShapes=1,32,32,1 --device=CPU --accuracyThreshold=3 --benchmarkDataFile=/path/to/output.out ``` +如果模型有多个输入数据文件(例如2个),且输入是动态维度(例如输入维度为1,32,32,1),使用如下命令: + +```bash +./benchmark --modelFile=/path/to/model.ms --inDataFile=/path/to/input0.bin,/path/to/input1.bin --inputShapes=1,32,32,1 --device=CPU --accuracyThreshold=3 --benchmarkDataFile=/path/to/output.out +``` + #### CPU性能测试 Benchmark工具进行的CPU性能测试主要的测试指标为模型单次前向推理CPU性能参数(目前只支持aarch64 CPU),包括周期数和指令数、缓存读取次数和缓存未命中次数、CPU前端和后端等待时间。在CPU性能测试任务中,不需要设置`benchmarkDataFile`等标杆数据参数。但是,可以设置`perfProfiling`与`perfEvent`选项参数,控制输出在某设备上模型网络层的哪些CPU性能参数,`perfProfiling`默认为false,`perfEvent`默认为`CYCLE`(CPU周期数和指令数)。由于多线程的读数波动较大,建议设置线程数为1。使用方法如下: @@ -364,6 +370,12 @@ call benchmark.exe [--modelFile=] [--accuracyThreshold=