问题描述:
【功能模块】
CANN AICPU自定义算子开发模块
【操作步骤&问题现象】
实现aicpu算子自定义开发samples中的reshape网络验证,通过python ctypes调用时报错:
undefined symbol:_ZTIN14ascend_private8protobuf7MessageE
CANN版本20.2,环境是Centos_aarch64 Atlas 800-9000。
环境变量配置:
export install_path=/usr/local/Ascend/nnae/latest
export LD_LIBRARY_PATH=/usr/local/gcc-7.3.0/lib64:${install_path}/fwkacllib/lib64:/usr/local/Ascend/driver/lib64:/usr/local/Ascend/nnae/latest/fwkacllib/lib64:/usr/local/Ascend/ascend-toolkit/latest/opp/op_impl/built-in/ai_core/tbe/op_tiling
export PYTHONPATH=installpath/fwkacllib/python/site−packages:installpath/fwkacllib/python/site−packages:{install_path}/fwkacllib/python/site-packages/auto_tune.egg/auto_tune:${install_path}/fwkacllib/python/site-packages/schedule_search.egg
export PATH=/usr/local/gcc-7.3.0/bin:/usr/bin:/usr/local/bin:/usr/sbin:installpath/fwkacllib/cceccompiler/bin:installpath/fwkacllib/cceccompiler/bin:{install_path}/fwkacllib/bin
#export PATH=/usr/local/gcc-7.3.0/bin:/usr/bin:/usr/local/bin:/usr/sbin:/usr/local/Ascend/ascend-toolkit/latest/arm64-linux/atc/ccec_compiler/bin:/usr/local/Ascend/ascend-toolkit/latest/arm64-linux/atc/bin
export PYTHONPATH=/usr/local/Ascend/tfplugin/latest/tfplugin/python/site-packages:/usr/local/python3.7.5/lib/python3.7/site-packages:$PYTHONPATH
export ASCEND_OPP_PATH=/usr/local/Ascend/ascend-toolkit/latest/opp
export ASCEND_AICPU_PATH=/usr/local/Ascend/ascend-toolkit/latest
export TBE_IMPL_PATH=/usr/local/Ascend/ascend-toolkit/latest/arm64-linux/opp/op_impl/built-in/ai_core/tbe
export OPENSSL_ROOT_DIR=/usr/local/openssl
export TOOLCHAIN_HOME=/usr/local/Ascend/ascend-toolkit/latest/arm64-linux/toolkit
在编译过程中试图链接libascend_protpbuf.so以解决报错的问题,但是解决后引入了新的问题:
试图分析问题的过程中发现,libcust_aicpu_kernel.so的编译依赖项中有/usr/localAscend/ascend-toolkit/20.2.rc1/arm64-linux/opp/op_impl/built-in/aicpu/aicpu_kernel/lib/libcpu_kernels_context.a,而该库中带有_ZNK14ascend_private8protobuf7Message11GetTypeNameB5cxx11Ev符号,猜测编译过程中将该符号引入,而与上图报错的_ZNK14ascend_private8protobuf7Message11GetTypeNameEv(libascend_protobuf.so所包含的符号)不同。
解决方案:
c++filt _ZNK14ascend_private8protobuf7Message11GetTypeNameEv
ascend_private::protobuf::Message::GetTypeName() const
环境或者版本问题,跟你写的代码没关系。使用MindSpore r1.2版本代码和与之相配套的run包再试试吧。