当前位置: 首页 > news >正文

Ascendc msOpST测试报错问题

本文主要是验证基于自定义算子工程的算子开发的流程,发现了一些坑,在此记录一下。

背景

具体内容可以参考
基于自定义算子工程的算子开发

从算子工程编译部署下遇到一些问题,具体看“自定义算子包安装部署”。

在自定义算子包所在路径下,执行如下命令,安装自定义算子包。
./custom_opp_<target os>_<target architecture>.run
命令执行成功后,自定义算子包中的相关文件将部署至当前环境的OPP算子库的vendors/customize目录中,如果用户部署多个自定义算子包,可通过如下命令指定路径安装:
./custom_opp_<target os>_<target architecture>.run --install-path=<path>
说明:如果部署算子包时通过配置–install-path参数指定了算子包的安装目录,则在使用自定义算子前,需要执行source <path>/vendors/<vendor_name>/bin/set_env.bash命令,set_env.bash脚本中将自定义算子包的安装路径追加到环境变量ASCEND_CUSTOM_OPP_PATH中,使自定义算子在当前环境中生效。

问题

1、ASCEND_CUSTOM_OPP_PATH变量设置

在执行 ./custom_opp_<target os>_<target architecture>.run时,一定要注意ASCEND_CUSTOM_OPP_PATH变量的设置问题。先看问题,

root@hostname-bnq0f:/usr/local/Ascend/ascend-toolkit/latest/python/site-packages/bin# ./msopst run -i /home/ascendc/samples/operator/ascendc/0_introduction/1_add_frameworklaunch/AddCustom/test.json -soc Ascend910B3 -out /home/ascendc/samples/operator/ascendc/0_introduction/1_add_frameworklaunch/AddCustom/test_out
2025-07-23 16:59:05 (10109) - [INFO] [STEP1] [case_design.py] Start to parser testcase json.
2025-07-23 16:59:05 (10109) - [INFO] Start to create sub test cases for /home/ascendc/samples/operator/ascendc/0_introduction/1_add_frameworklaunch/AddCustom/test.json.
2025-07-23 16:59:05 (10109) - [WARNING] There is no expect output function in the case json, if no need to compare output data, ignore.
2025-07-23 16:59:05 (10109) - [INFO] Create 1 sub test cases for Test_AddCustom_001.
2025-07-23 16:59:05 (10109) - [INFO] [STEP2] [atc_transform_om.py] Generate acl_op.json for atc tools.
2025-07-23 16:59:05 (10109) - [INFO] File /home/ascendc/samples/operator/ascendc/0_introduction/1_add_frameworklaunch/AddCustom/test_out/20250723165904/AddCustom/run/out/test_data/config/acl_op.json generated successfully.
2025-07-23 16:59:05 (10109) - [INFO] [STEP3] [atc_transform_om.py] Start to convert single op to om model.
2025-07-23 16:59:05 (10109) - [INFO] ATC command line: cd /home/ascendc/samples/operator/ascendc/0_introduction/1_add_frameworklaunch/AddCustom/test_out/20250723165904/AddCustom/run/out && atc --singleop=test_data/config/acl_op.json --soc_version=Ascend910B3 --output=op_models 
2025-07-23 16:59:05 (10109) - [INFO] Execute command: atc --singleop=test_data/config/acl_op.json --soc_version=Ascend910B3 --output=op_models
b'ATC start working now, please wait for a moment.'
b'...'
b"ATC run failed, Please check the detail log, Try 'atc --help' for more information"
b'EZ3003: [PID: 10178] 2025-07-23-16:59:10.249.679 No supported Ops kernel and engine are found for [AddCustom], optype [AddCustom].'
b'Possible Cause: The operator is not supported by the system. Therefore, no hit is found in any operator information library.'
b'Solution: 1. Check that the OPP component is installed properly. 2. Submit an issue to request for the support of this operator type.'
b'TraceBack (most recent call last):'
b'Assert ((SelectEngine(node_ptr, exclude_engines, is_check_support_success, op_info)) == ge::SUCCESS) failed[FUNC:operator()][FILE:engine_place.cc][LINE:148]'
b'RunAllSubgraphs failed, graph=op_models/0_AddCustom_1_2_8_2048_1_2_8_2048_1_2_8_2048.om.[FUNC:RunAllSubgraphs][FILE:engine_place.cc][LINE:122]'
b'build graph failed, graph id:0, ret:4294967295[FUNC:BuildModelWithGraphId][FILE:ge_generator.cc][LINE:1623]'
2025-07-23 16:59:12 (10109) - [ERROR] Failed to execute command: atc --singleop=test_data/config/acl_op.json --soc_version=Ascend910B3 --output=op_models
========================================================================
run command: ./msopst run -i /home/ascendc/samples/operator/ascendc/0_introduction/1_add_frameworklaunch/AddCustom/test.json -soc Ascend910B3 -out /home/ascendc/samples/operator/ascendc/0_introduction/1_add_frameworklaunch/AddCustom/test_out
------------------------------------------------------------------------
- test case count: 1
- success count: 0
- failed count: 1
------------------------------------------------------------------------
========================================================================

case执行失败,问题报错如下:

b'EZ3003: [PID: 10178] 2025-07-23-16:59:10.249.679 No supported Ops kernel and engine are found for [AddCustom], optype [AddCustom].'

猜测是算子的注册不对。然后查看ASCEND_CUSTOM_OPP_PATH问题,如下:

root@hostname-bnq0f:/usr/local/Ascend/ascend-toolkit/latest/python/site-packages/bin# echo $ASCEND_CUSTOM_OPP_PATH
/usr/local/Ascend/mindie/latest/mindie-rt/ops/vendors/aie_ascendc:/usr/local/Ascend/mindie/latest/mindie-rt/ops/vendors/customize:

发现ASCEND_CUSTOM_OPP_PATH除自定义算子的路径外,还有一个是/usr/local/Ascend/mindie/latest/mindie-rt/ops/vendors/aie_ascendc路径。这里做一个猜测,自定义的算子并没有安装在/usr/local/ascend下面话,可能找不到算子

接下来做个实验,将ASCEND_CUSTOM_OPP_PATH设置为/usr/local下的路径。

step1:

export ASCEND_CUSTOM_OPP_PATH=/usr/local/Ascend/ascend-tool-kit/latest/opp

step2:
再次安装自定义算子的run包

root@hostname-bnq0f:/home/ascendc/samples/operator/ascendc/0_introduction/1_add_frameworklaunch/AddCustom/test# ./build_out/custom_opp_openEuler_aarch64.run 
Verifying archive integrity...  100%   SHA256 checksums are OK. All good.
Uncompressing version:1.0  100%  
[ops_custom] [2025-07-23 17:21:14] [INFO] copy uninstall sh success
[ops_custom] [2025-07-23 17:21:14] [INFO] upgrade framework
[ops_custom] [2025-07-23 17:21:14] [INFO] create /usr/local/Ascend/ascend-toolkit/latest/opp/vendors/customize/framework.
[ops_custom] [2025-07-23 17:21:14] copy new ops framework files ......
[ops_custom] [2025-07-23 17:21:14] [INFO] upgrade op proto
[ops_custom] [2025-07-23 17:21:14] [INFO] create /usr/local/Ascend/ascend-toolkit/latest/opp/vendors/customize/op_proto.
[ops_custom] [2025-07-23 17:21:14] copy new ops op_proto files ......
[ops_custom] [2025-07-23 17:21:14] [INFO] upgrade op impl
[ops_custom] [2025-07-23 17:21:14] [INFO] create /usr/local/Ascend/ascend-toolkit/latest/opp/vendors/customize/op_impl.
[ops_custom] [2025-07-23 17:21:14] copy new ops op_impl files ......
[ops_custom] [2025-07-23 17:21:14] [INFO] upgrade op api
[ops_custom] [2025-07-23 17:21:14] [INFO] create /usr/local/Ascend/ascend-toolkit/latest/opp/vendors/customize/op_api.
[ops_custom] [2025-07-23 17:21:14] copy new ops op_api files ......
[ops_custom] [2025-07-23 17:21:14] [INFO] upgrade version.info
[ops_custom] [2025-07-23 17:21:14] copy new version.info files ......
[ops_custom] [2025-07-23 17:21:14] [INFO] no need to upgrade custom.proto files
[ops_custom] [2025-07-23 17:21:14] [INFO] using requirements: when custom module install finished or before you run the custom module, execute the command [ export LD_LIBRARY_PATH=/usr/local/Ascend/ascend-toolkit/latest/opp/vendors/customize/op_api/lib/:${LD_LIBRARY_PATH} ] to set the environment path
SUCCESS

发现算子包已经准确安装在了/usr/local下面:/usr/local/Ascend/ascend-toolkit/latest/opp/vendors/customize/

step3:再次执行用例

root@hostname-bnq0f:/usr/local/Ascend/ascend-toolkit/latest/python/site-packages/bin# ./msopst run -i /home/ascendc/samples/operator/ascendc/0_introduction/1_add_frameworklaunch/AddCustom/test.json -soc Ascend910B3 -out /home/ascendc/samples/operator/ascendc/0_introduction/1_add_frameworklaunch/AddCustom/test_out
2025-07-23 17:22:32 (10918) - [INFO] [STEP1] [case_design.py] Start to parser testcase json.
2025-07-23 17:22:32 (10918) - [INFO] Start to create sub test cases for /home/ascendc/samples/operator/ascendc/0_introduction/1_add_frameworklaunch/AddCustom/test.json.
2025-07-23 17:22:32 (10918) - [WARNING] There is no expect output function in the case json, if no need to compare output data, ignore.
2025-07-23 17:22:32 (10918) - [INFO] Create 1 sub test cases for Test_AddCustom_001.
2025-07-23 17:22:32 (10918) - [INFO] [STEP2] [atc_transform_om.py] Generate acl_op.json for atc tools.
2025-07-23 17:22:32 (10918) - [INFO] File /home/ascendc/samples/operator/ascendc/0_introduction/1_add_frameworklaunch/AddCustom/test_out/20250723172232/AddCustom/run/out/test_data/config/acl_op.json generated successfully.
2025-07-23 17:22:32 (10918) - [INFO] [STEP3] [atc_transform_om.py] Start to convert single op to om model.
2025-07-23 17:22:32 (10918) - [INFO] ATC command line: cd /home/ascendc/samples/operator/ascendc/0_introduction/1_add_frameworklaunch/AddCustom/test_out/20250723172232/AddCustom/run/out && atc --singleop=test_data/config/acl_op.json --soc_version=Ascend910B3 --output=op_models 
2025-07-23 17:22:32 (10918) - [ERROR] The path /usr/local/Ascend/ascend-toolkit/latest/opp is soft link. Not support
========================================================================
run command: ./msopst run -i /home/ascendc/samples/operator/ascendc/0_introduction/1_add_frameworklaunch/AddCustom/test.json -soc Ascend910B3 -out /home/ascendc/samples/operator/ascendc/0_introduction/1_add_frameworklaunch/AddCustom/test_out
------------------------------------------------------------------------
- test case count: 1
- success count: 0
- failed count: 1
------------------------------------------------------------------------
========================================================================

从报错来看,是[ERROR] The path /usr/local/Ascend/ascend-toolkit/latest/opp is soft link. Not support,也就是说路径中有软链接,不支持。
设置为绝对真实路径。注意:从实验上看,路径上不能有任何软链接路径,否则都会失败

export ASCEND_CUSTOM_OPP_PATH=/usr/local/Ascend/ascend-toolkit/8.1.RC1/opp

再次执行,然后测试通过了

...
b'[INFO]  Write output[0] success. output file = /home/ascendc/samples/operator/ascendc/0_introduction/1_add_frameworklaunch/AddCustom/test_out/20250723172557/AddCustom/run/out/result_files/Test_AddCustom_001_case_001_ND_float16_output_0.bin'
b'[INFO]  Run op success'
b'Result file append successfully.'
b'[      OK ] AddCustom.Test_AddCustom_001_case_001_ND_float16 ( 1104.48 ms )'
b'[=========] Ran 1 tests. ( 1104.54 ms total )'
b'[PASSED] 1 tests.'
b'[FAILED] 0 tests.'
2025-07-23 17:26:25 (11185) - [INFO] Testcase execute in Ascend910B3, cost time: 3.879441 s.
2025-07-23 17:26:25 (11185) - [INFO] Finish to run /home/ascendc/samples/operator/ascendc/0_introduction/1_add_frameworklaunch/AddCustom/test_out/20250723172557/AddCustom/run/out/main.
2025-07-23 17:26:25 (11185) - [INFO] Step:------>>>>>> Start to get result <<<<<<------ 
2025-07-23 17:26:25 (11185) - [INFO] Find result.txt in /home/ascendc/samples/operator/ascendc/0_introduction/1_add_frameworklaunch/AddCustom/test_out/20250723172557/AddCustom/run/out/result_files/result.txt.
2025-07-23 17:26:25 (11185) - [INFO] Case 'Test_AddCustom_001_case_001_ND_float16' run successfully.
2025-07-23 17:26:25 (11185) - [INFO] Get result data in AiHost execute time: 0.000312 s
========================================================================
run command: ./msopst run -i /home/ascendc/samples/operator/ascendc/0_introduction/1_add_frameworklaunch/AddCustom/test.json -soc Ascend910B3 -out /home/ascendc/samples/operator/ascendc/0_introduction/1_add_frameworklaunch/AddCustom/test_out
------------------------------------------------------------------------
- test case count: 1
- success count: 1
- failed count: 0
------------------------------------------------------------------------
========================================================================2025-07-23 17:26:25 (11185) - [INFO] Process finished!
2025-07-23 17:26:25 (11185) - [INFO] The st report saved in: /home/ascendc/samples/operator/ascendc/0_introduction/1_add_frameworklaunch/AddCustom/test_out/20250723172557/st_report.json.

难道一定要这样才能解决么?官网的资料那岂不是没说清楚?带着这些疑问,再次展开探索。

2、ASCEND_CUSTOM_OPP_PATH变量一定的这样设置吗?

首先,注意到算子自定义run包安装的时候,有提供自定义安装的路径,如下:

如果用户部署多个自定义算子包,可通过如下命令指定路径安装:
./custom_opp_<target os>_<target architecture>.run --install-path=<path>
说明:如果部署算子包时通过配置–install-path参数指定了算子包的安装目录,则在使用自定义算子前,需要执行source <path>/vendors/<vendor_name>/bin/set_env.bash命令,set_env.bash脚本中将自定义算子包的安装路径追加到环境变量ASCEND_CUSTOM_OPP_PATH中,使自定义算子在当前环境中生效。

那么通过这种方式是否能执行成功呢?/home/add_custom_test/是自定义的路径。

root@hostname-bnq0f:/home/ascendc/samples/operator/ascendc/0_introduction/1_add_frameworklaunch/AddCustom/test# ./build_out/custom_opp_openEuler_aarch64.run --install-path=/home/add_custom_test
grep: warning: stray \ before -
Verifying archive integrity...  100%   SHA256 checksums are OK. All good.
Uncompressing version:1.0  100%  
[ops_custom] [2025-07-24 09:17:21] [INFO] copy uninstall sh success
[ops_custom] [2025-07-24 09:17:21] [INFO] create /home/add_custom_test/vendors.
[ops_custom] [2025-07-24 09:17:21] [INFO] upgrade framework
[ops_custom] [2025-07-24 09:17:21] [INFO] create /home/add_custom_test/vendors/customize/framework.
[ops_custom] [2025-07-24 09:17:21] copy new ops framework files ......
[ops_custom] [2025-07-24 09:17:21] [INFO] upgrade op proto
[ops_custom] [2025-07-24 09:17:21] [INFO] create /home/add_custom_test/vendors/customize/op_proto.
[ops_custom] [2025-07-24 09:17:21] copy new ops op_proto files ......
[ops_custom] [2025-07-24 09:17:21] [INFO] upgrade op impl
[ops_custom] [2025-07-24 09:17:21] [INFO] create /home/add_custom_test/vendors/customize/op_impl.
[ops_custom] [2025-07-24 09:17:21] copy new ops op_impl files ......
[ops_custom] [2025-07-24 09:17:21] [INFO] upgrade op api
[ops_custom] [2025-07-24 09:17:21] [INFO] create /home/add_custom_test/vendors/customize/op_api.
[ops_custom] [2025-07-24 09:17:21] copy new ops op_api files ......
[ops_custom] [2025-07-24 09:17:21] [INFO] upgrade version.info
[ops_custom] [2025-07-24 09:17:21] copy new version.info files ......
[ops_custom] [2025-07-24 09:17:21] [INFO] no need to upgrade custom.proto files
[ops_custom] [2025-07-24 09:17:21] [INFO] using requirements: when custom module install finished or before you run the custom module, execute the command [ source /home/add_custom_test/vendors/customize/bin/set_env.bash ] to set the environment path
SUCCESS

按照资料中的提示,算子安装完成后,需要执行source /home/add_custom_test/vendors/customize/bin/set_env.bash
执行上述的source命令后,继续进行测试,发现一个问题:

root@hostname-bnq0f:/home/ascendc/samples/operator/ascendc/0_introduction/1_add_frameworklaunch/AddCustom/test# source /home/add_custom_test/vendors/customize/bin/set_env.bash 
root@hostname-bnq0f:/home/ascendc/samples/operator/ascendc/0_introduction/1_add_frameworklaunch/AddCustom/test# cd /usr/local//Ascend/ascend-toolkit/latest/python/site-packages/bin
root@hostname-bnq0f:/usr/local/Ascend/ascend-toolkit/latest/python/site-packages/bin# ./msopst run -i /home/ascendc/samples/operator/ascendc/0_introduction/1_add_frameworklaunch/AddCustom/test.json -soc Ascend910B3 -out /home/ascendc/samples/operator/ascendc/0_introduction/1_add_frameworklaunch/AddCustom/test_out
2025-07-24 09:18:36 (12608) - [INFO] [STEP1] [case_design.py] Start to parser testcase json.
2025-07-24 09:18:36 (12608) - [INFO] Start to create sub test cases for /home/ascendc/samples/operator/ascendc/0_introduction/1_add_frameworklaunch/AddCustom/test.json.
2025-07-24 09:18:36 (12608) - [WARNING] There is no expect output function in the case json, if no need to compare output data, ignore.
2025-07-24 09:18:36 (12608) - [INFO] Create 1 sub test cases for Test_AddCustom_001.
2025-07-24 09:18:36 (12608) - [INFO] [STEP2] [atc_transform_om.py] Generate acl_op.json for atc tools.
2025-07-24 09:18:36 (12608) - [INFO] File /home/ascendc/samples/operator/ascendc/0_introduction/1_add_frameworklaunch/AddCustom/test_out/20250724091836/AddCustom/run/out/test_data/config/acl_op.json generated successfully.
2025-07-24 09:18:36 (12608) - [INFO] [STEP3] [atc_transform_om.py] Start to convert single op to om model.
2025-07-24 09:18:36 (12608) - [INFO] ATC command line: cd /home/ascendc/samples/operator/ascendc/0_introduction/1_add_frameworklaunch/AddCustom/test_out/20250724091836/AddCustom/run/out && atc --singleop=test_data/config/acl_op.json --soc_version=Ascend910B3 --output=op_models 
2025-07-24 09:18:36 (12608) - [INFO] Execute command: atc --singleop=test_data/config/acl_op.json --soc_version=Ascend910B3 --output=op_models
b'ATC start working now, please wait for a moment.'
b'...'
b"ATC run failed, Please check the detail log, Try 'atc --help' for more information"
b'E40021: [PID: 12677] 2025-07-24-09:18:45.054.741 Failed to compile Op [AddCustom]. (oppath: [Compile /home/add_custom_test/vendors/customize/op_impl/ai_core/tbe/customize_impl/dynamic/add_custom.py failed with errormsg/stack: File "/usr/local/Ascend/ascend-toolkit/latest/python/site-packages/tbe/tikcpp/ascendc_common_utility.py", line 480, in dump_build_log'
b'raise Exception("An error occurred during compile phases of {}, msg is {}".\\'
b'Exception: An error occurred during compile phases of CompileStage.PRECOMPILE, msg is In file included from /home/add_custom_test/vendors/customize/op_impl/ai_core/tbe/customize_impl/dynamic/add_custom.cpp:10:'
b'In file included from /usr/local/Ascend/ascend-toolkit/8.1.RC1/aarch64-linux/tikcpp/tikcfw/kernel_operator.h:24:'
b'In file included from /usr/local/Ascend/ascend-toolkit/8.1.RC1/aarch64-linux/tikcpp/tikcfw/impl/kernel_tpipe_impl.h:23:'
b'In file included from /usr/local/Ascend/ascend-toolkit/8.1.RC1/aarch64-linux/tikcpp/tikcfw/interface/kernel_tpipe.h:23:'
b'In file included from /usr/local/Ascend/ascend-toolkit/8.1.RC1/aarch64-linux/tikcpp/tikcfw/impl/kernel_tpipe_base.h:23:'
b'In file included from /usr/local/Ascend/ascend-toolkit/8.1.RC1/aarch64-linux/tikcpp/tikcfw/impl/kernel_tensor_impl.h:23:'
b'In file included from /usr/local/Ascend/ascend-toolkit/8.1.RC1/aarch64-linux/tikcpp/tikcfw/interface/kernel_tensor.h:24:'
b'In file included from /usr/local/Ascend/ascend-toolkit/8.1.RC1/aarch64-linux/tikcpp/tikcfw/impl/kernel_utils.h:23:'
b'In file included from /usr/local/Ascend/ascend-toolkit/8.1.RC1/aarch64-linux/tikcpp/tikcfw/impl/utils/kernel_utils_macros.h:33:'
b"/usr/local/Ascend/ascend-toolkit/8.1.RC1/aarch64-linux/tikcpp/tikcfw/impl/kernel_macros.h:24:10: fatal error: 'cstdint' file not found"
b'#include <cstdint>'
b'^~~~~~~~~'
b'1 error generated.'
b'], optype: [AddCustom])'
b'Solution: See the host log for details, and then check the Python stack where the error log is reported.'
b'TraceBack (most recent call last):'
b"Compile op[AddCustom] failed, oppath[/home/add_custom_test/vendors/customize/op_impl/ai_core/tbe/customize_impl/dynamic/add_custom.py], optype[AddCustom], taskID[2]. Please check op's compilation error message.[FUNC:ReportBuildErrMessage][FILE:fusion_manager.cc][LINE:368]"
b'[SubGraphOpt][Compile][ProcFailedCompTask] Thread[281470429670784] recompile single op[AddCustom] failed[FUNC:ProcessAllFailedCompileTasks][FILE:tbe_op_store_adapter.cc][LINE:1137]'

算子编译失败,主要是因为fatal error: 'cstdint' file not found",这里请参考文章:Ascendc helloworld编译问题,需要设置CPLUS_INCLUDE_PATH环境变量,如下:

export CPLUS_INCLUDE_PATH=/usr/include/c++/12:/usr/include/c++/12/aarch64-openEuler-linux

然后再次执行./msopst测试,执行成功。

2025-07-24 09:20:25 (12985) - [INFO] Step:------>>>>>> Start to get result <<<<<<------ 
2025-07-24 09:20:25 (12985) - [INFO] Find result.txt in /home/ascendc/samples/operator/ascendc/0_introduction/1_add_frameworklaunch/AddCustom/test_out/20250724091958/AddCustom/run/out/result_files/result.txt.
2025-07-24 09:20:25 (12985) - [INFO] Case 'Test_AddCustom_001_case_001_ND_float16' run successfully.
2025-07-24 09:20:25 (12985) - [INFO] Get result data in AiHost execute time: 0.000287 s
========================================================================
run command: ./msopst run -i /home/ascendc/samples/operator/ascendc/0_introduction/1_add_frameworklaunch/AddCustom/test.json -soc Ascend910B3 -out /home/ascendc/samples/operator/ascendc/0_introduction/1_add_frameworklaunch/AddCustom/test_out
------------------------------------------------------------------------
- test case count: 1
- success count: 1
- failed count: 0
------------------------------------------------------------------------
========================================================================2025-07-24 09:20:25 (12985) - [INFO] Process finished!
2025-07-24 09:20:25 (12985) - [INFO] The st report saved in: /home/ascendc/samples/operator/ascendc/0_introduction/1_add_frameworklaunch/AddCustom/test_out/20250724091958/st_report.json.

那为什么使用默认ASCEND_CUSTOM_OPP_PATH(带mindie)不行,而指定路径行呢?
安装算子run包中,注意到描述:

需要执行source /home/add_custom_test/vendors/customize/bin/set_env.bash

这个脚本里面又是什么内容?查看/home/add_custom_test/vendors/customize/bin/set_env.bash,内容如下

#!/bin/bash
export ASCEND_CUSTOM_OPP_PATH=/home/add_custom_test/vendors/customize:${ASCEND_CUSTOM_OPP_PATH}
export LD_LIBRARY_PATH=/home/add_custom_test/vendors/customize/op_api/lib/:${LD_LIBRARY_PATH}

也就是添加了customize路径到ASCEND_CUSTOM_OPP_PATH,添加二进制文件到LD_LIBRARY_PATH
也就是说只需要修改这2个环境变量的内容,即可让算子执行成功。
那为什么MindIE的默认环境变量下没有执行成功?默认环境变量ASCEND_CUSTOM_OPP_PATH在安装完算子后内容如下:

/usr/local/Ascend/mindie/latest/mindie-rt/ops/vendors/aie_ascendc:/usr/local/Ascend/mindie/latest/mindie-rt/ops/vendors/customize:

ASCEND_CUSTOM_OPP_PATH没有问题。那么问题出现在LD_LIBRARY_PATH这个环境变量。观察LD_LIBRARY_PATH需要设置的内容是customize/op_api/lib/路径,查看/usr/local/Ascend/mindie/latest/mindie-rt/ops/vendors/customize下的/op_api/lib/路径,发现根本就没有这个路径:

root@hostname-bnq0f:/usr/local/Ascend/ascend-toolkit/latest/python/site-packages/bin# ll /usr/local/Ascend/mindie/latest/mindie-rt/ops/vendors/customize/
total 12
dr-xr-x--- 4 root root 4096 May 23 10:50 framework
dr-xr-x--- 5 root root 4096 May 23 10:50 op_impl
dr-xr-x--- 2 root root 4096 May 23 10:50 op_proto

问题到这里差不多知道原因了,是算子的二进制lib文件路径并没有准确的设置到LD_LIBRARY_PATH
那么默认路径下,为什么没有生成op_api?这里肯定是个bug(该页面提个issue去解决)。

补充:
经过与ascendc小伙伴沟通,最终的原因是ASCEND_CUSTOM_OPP_PATH路径只能有一个,使用冒号不能区分,如下这种:

/usr/local/Ascend/mindie/latest/mindie-rt/ops/vendors/aie_ascendc:/usr/local/Ascend/mindie/latest/mindie-rt/ops/vendors/customize:

而如果ASCEND_CUSTOM_OPP_PATH是单个路径:

/usr/local/Ascend/mindie/latest/mindie-rt/ops/vendors/aie_ascendc

该问题就能解决。

总结

总结一句话就是,自定义算子测试要准确的设置ASCEND_CUSTOM_OPP_PATHLD_LIBRARY_PATH这2个环境变量,否则会执行失败。

http://www.lryc.cn/news/598380.html

相关文章:

  • 【Unity开发】数据存储——XML
  • MySQL的命令行客户端
  • Code Composer Studio:CCS 设置代码折叠
  • MySQL零基础教程增删改查实战
  • [语言模型训练]基于 PyTorch 的双向 LSTM 文本分类器实现:基于旅店的评论分类语言模型
  • 与deepseek的问答:dot net与Borland VCL的关系
  • OSPF多区域介绍
  • 【Spring Cloud Gateway 实战系列】高级篇:服务网格集成、安全增强与全链路压测
  • 开源链动2+1模式AI智能名片S2B2C商城小程序的场景体验分析
  • 从零用java实现 小红书 springboot vue uniapp(15) 集成minio存储 支持本地和minio切换
  • 开源中国:以国产开源生态筑基,赋能智能研发全栈升级
  • 谈谈ArrayList与Vector的理解?
  • DiffServ服务模型与DS码点详解
  • 数据库第三章练习题(大雪圣期末复习参考)
  • [硬件电路-81]:学习和分析一个电子元器件的思维框架
  • 2.7 PNIO-AL
  • MySQL---索引、事务
  • 借助 Amazon Redshift 为具有强大抗风险能力的使用案例提供支持
  • Concert Tickets 二分+并查集
  • Visual Studio 2010-.Net Framework 4.0-DevExpress安装
  • 使用adb 发送广播 动态改变app内的值
  • Lua(文件I/O)
  • VB解除excel保护工作表
  • 【docker】将已有mysql脚本导入镜像内使用
  • API安全监测工具:数字经济的免疫哨兵
  • Linux服务器安全自动化审计实战:一键扫描账户/网络/进程/计划任务风险(附开源脚本)
  • 项目——在线五子棋对战
  • pyarmor加密源代码
  • 闲庭信步使用图像验证平台加速FPGA的开发:第三十三课——车牌识别的FPGA实现(5)车牌字符的识别
  • OpenCV —— contours_matrix_()_[]