主页 > 软件开发  > 

tvmandroid_rpc_test.py执行报错解决

tvmandroid_rpc_test.py执行报错解决

执行 python3 tests/android_rpc_test.py

报错:

Run CPU test ... Traceback (most recent call last):   File "tests/android_rpc_test.py", line 129, in <module>     test_rpc_module()   File "tests/android_rpc_test.py", line 73, in test_rpc_module     f2 = remote.load_module("cpu_lib.tar")   File "/root/.local/lib/python3.8/site-packages/tvm-0.13.0-py3.8-linux-x86_64.egg/tvm/rpc/client.py", line 161, in load_module     return _ffi_api.LoadRemoteModule(self._sess, path)   File "/root/.local/lib/python3.8/site-packages/tvm-0.13.0-py3.8-linux-x86_64.egg/tvm/_ffi/_ctypes/packed_func.py", line 238, in __call__     raise get_last_ffi_error() tvm.error.InternalError: Traceback (most recent call last):   4: TVMFuncCall   3: _ZN3tvm7runtime13PackedFuncObj9ExtractorINS0_16PackedFuncSubObjIZNS0_15TypedPackedFuncIFNS0_6ModuleES5_NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEE17AssignTypedLambdaINS0_UlS5_SB_E3_EEEvT_SB_EUlRKNS0_7TVMArgsEPNS0_11TVMRetValueEE_EEE4CallEPKS1_SH_SL_   2: tvm::runtime::RPCWrappedFunc::operator()(tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*) const   1: tvm::runtime::RPCClientSession::CallFunc(void*, TVMValue const*, int const*, int, std::function<void (tvm::runtime::TVMArgs)> const&)   0: tvm::runtime::RPCEndpoint::CallFunc(void*, TVMValue const*, int const*, int, std::function<void (tvm::runtime::TVMArgs)>)   File "/home/tt/project/docker_tvm2/tvm/src/runtime/rpc/rpc_endpoint.cc", line 808 InternalError: Check failed: (code == RPCCode::kReturn) is false: code=kShutdown  

解决方法:

把cpu_lib.tar改为cpu_lib.so;并且在export_library添加ndk.create_shared,如下:

path_dso_cpu = temp.relpath("cpu_lib.so")

f.export_library(path_dso_cpu, ndk.create_shared)

原因:

没有添加ndk.create_shared,使用默认的编译器,在android上不能跑

标签:

tvmandroid_rpc_test.py执行报错解决由讯客互联软件开发栏目发布,感谢您对讯客互联的认可,以及对我们原创作品以及文章的青睐,非常欢迎各位朋友分享到个人网站或者朋友圈,但转载请说明文章出处“tvmandroid_rpc_test.py执行报错解决