指导用户根据算子测试用例定义文件生成ST测试数据及测试用例执行代码,在硬件环境上执行算子测试用例。
export DDK_PATH=${INSTALL_DIR} export NPU_HOST_LIB=${INSTALL_DIR}/{arch-os}/devlib
msopst run -i {**.json} -soc {Soc Version} -out {output path} -c {case name} -d {device id} -conf {msopst.ini path} -err_thr "[threshold1,threshold2]"
参数 |
值 |
说明 |
---|---|---|
only_gen_without_run |
|
msOpST工具运行模式。 详情请参见表2。 |
only_run_without_gen |
|
|
performance_mode |
|
获取算子性能模式。若设置为True,运行成功后在run/out/prof/JOBxxx/summary目录下生成一系列性能结果文件,用户只需查看op_summary_0_1.csv即可。
该功能需要配置CANN包安装环境变量,请根据实际安装路径修改。
export install_path=${INSTALL_DIR}
|
ASCEND_GLOBAL_LOG_LEVEL |
|
设置host日志级别环境变量。 |
ASCEND_SLOG_PRINT_TO_STDOUT |
|
日志屏幕打印控制。 |
atc_singleop_advance_option |
--log参数取值:
--precision_mode参数取值:
--host_env_os参数取值: linux: 表示设置操作系统类型为linux
--host_env_cpu参数取值:
示例: atc_singleop_advance_option="--log=info --host_env_os=linux --host_env_cpu=aarch64 --precision_mode=force_fp16" |
设置单算子模型转换高级选项。 若模型编译环境的操作系统及其架构与模型运行环境不一致时,则需使用--host_env_os和--host_env_cpu参数设置模型运行环境的操作系统类型。如果不设置,则默认取模型编译环境的操作系统架构,即atc所在环境的操作系统架构。 |
HOST_ARCH |
示例: HOST_ARCH="aarch64" |
执行机器的架构。 一般在分设场景下配置该参数。 |
TOOL_CHAIN |
g++ path:g++工具链路径 示例: TOOL_CHAIN="/usr/bin/g++" |
c++编译器路径,配置时以g++结尾。 一般在分设场景下配置该参数。 |
msopst run -i xx/AddCustom_case_timestamp.json -soc {Soc Version} -out ./output
vim ${INSTALL_DIR}/python/site-packages/bin/msopst.ini
将msOpST运行模式修改为模式2,按照表2修改“only_gen_without_run”和“only_run_without_gen” 参数的取值。只生成ST测试代码,不运行ST测试代码。
msopst run -i xx/AddCustom_case_timestamp.json -soc {Soc Version} -out ./output -conf xx/msopst.ini
-conf参数请修改为msopst.ini配置文件的实际路径。
ST测试用例生成后,用户可根据需要自行修改ST测试用例代码。
vim ${INSTALL_DIR}/python/site-packages/bin/msopst.ini
将msOpST运行模式修改为模式3,按照表2修改“only_gen_without_run”和“only_run_without_gen” 参数的取值。不生成ST测试代码,只运行ST测试代码。
msopst run -i xx/AddCustom_case_timestamp.json -soc {Soc Version} -out ./output -conf xx/msopst.ini
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
{time_stamp} │ ├── OpType │ │ ├── CMakeLists.txt // 编译规则文件 │ │ ├── inc // 测试用例代码所用头文件 │ │ │ └── common.h │ │ │ └── op_execute.h │ │ │ └── op_runner.h │ │ │ └── op_test_desc.h │ │ │ └── op_test.h │ │ ├── run // 测试用例执行相关文件存储目录 │ │ │ └── out │ │ │ └── test_data │ │ │ └── config │ │ │ └── acl.json //用于进行acl初始化,请勿修改此文件 │ │ │ └── acl_op.json // 用于构造单算子模型文件的算子描述文件 │ │ │ └── data │ │ │ └── expect │ │ │ └── Test_xxx.bin │ │ ├── src │ │ │ └── CMakeLists.txt // 编译规则文件 │ │ │ └── common.cpp // 公共函数,读取二进制文件函数的实现文件 │ │ │ └── main.cpp // 初始化算子测试用例并执行用例 │ │ │ └── op_execute.cpp //针对单算子调用的AscendCL接口进行了封装 │ │ │ └── op_runner.cpp //加载单算子模型文件进行执行的接口进行了封装 │ │ │ └── op_test.cpp //定义了算子的测试类 │ │ │ └── op_test_desc.cpp //对算子测试用例信息的加载和读入 │ │ │ └── testcase.cpp //测试用例的定义文件 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
{time_stamp} │ ├── OpType │ │ ├── build │ │ │ └── intermediates //编译产生中间文件 │ │ │ └── xxx │ │ ├── CMakeLists.txt // 编译规则文件 │ │ ├── inc │ │ │ ├── common.h │ │ │ ├── op_execute.h │ │ │ ├── op_runner.h │ │ │ ├── op_test_desc.h │ │ │ └── op_test.h │ │ ├── run // 测试用例执行相关文件存储目录 │ │ │ └── out │ │ │ ├── fusion_result.json │ │ │ ├── main // 算子测试用例执行的可执行文件 │ │ │ ├── op_models // 单算子的离线模型文件 │ │ │ ├── xx.om │ │ │ ├── result_files │ │ │ ├── result.txt │ │ │ ├── Test_xxx_output_x.bin // 运行测试用例生成的结果数据的二进制文件 │ │ │ └── test_data //测试数据相关文件存储目录 │ │ │ ├── config │ │ │ ├── acl_op.json // 用于构造单算子模型文件的算子描述文件 │ │ │ ├── acl.json //用于进行acl初始化,请勿修改此文件 │ │ │ ├── data //构造的测试数据 │ │ │ ├──expect │ │ │ ├──Test_xxxx.bin //期望的输出结果的二进制文件 │ │ │ ├──st_error_reports │ │ │ ├──Test_xxxx.csv //用于保存比对结果不一致的数据 │ │ │ ├──Test_xxxx.bin //测试数据的二进制文件 │ │ └── src │ │ ├── CMakeLists.txt // 编译规则文件 │ │ ├── common.cpp // 公共函数,读取二进制文件函数的实现文件 │ │ ├── main.cpp // 初始化算子测试用例并执行用例 │ │ ├── op_execute.cpp //针对单算子调用的AscendCL接口进行了封装 │ │ ├── op_runner.cpp //加载单算子模型文件进行执行的接口进行了封装 │ │ ├── op_test.cpp //定义了算子的测试类 │ │ ├── op_test_desc.cpp //对算子测试用例信息的加载和读入 │ │ └── testcase.cpp //测试用例的定义文件 │ └── st_report.json //运行报表 |
字段 |
说明 |
||
---|---|---|---|
run_cmd |
- |
- |
命令行命令。 |
report_list |
- |
- |
报告列表,该列表中可包含多个测试用例的报告。 |
trace_detail |
- |
运行细节。 |
|
st_case_info |
测试信息,包含如下内容。
|
||
stage_result |
运行各阶段结果信息,包含如下内容。
|
||
case_name |
- |
测试名称。 |
|
status |
- |
测试结果状态,表示运行成功或者失败。 |
|
expect |
- |
期望的测试结果状态,表示期望运行成功或者失败。 |
|
summary |
- |
- |
统计测试用例的结果状态与期望结果状态对比的结果。 |
test case count |
- |
测试用例的个数。 |
|
success count |
- |
测试用例的结果状态与期望结果状态一致的个数。 |
|
failed count |
- |
测试用例的结果状态与期望结果状态不一致的个数。 |
export DDK_PATH=${INSTALL_DIR} export NPU_HOST_LIB=${INSTALL_DIR}/{arch-os}/devlib
export DDK_PATH=${INSTALL_DIR}/{arch-os} export NPU_HOST_LIB=${INSTALL_DIR}/{arch-os}/devlib
vim ${INSTALL_DIR}/python/site-packages/bin/msopst.ini
msopst run -i xx/AddCustom_case_timestamp.json -soc {Soc Version} -out {output path} -conf xx/msopst.ini
-conf参数请修改为msopst.ini配置文件的实际路径。
ST测试用例生成后,用户可根据需要自行修改ST测试用例代码。
执行完成后,屏显信息显示此次用例运行的情况,如图2所示。