onnxruntime编译安装

克隆源码

git clone --recursive https://github.com/Microsoft/onnxruntime
cd onnxruntime/
git checkout v1.8.0
git submodule update --init --recursive

编译

./build.sh --skip_tests --use_cuda --config Release --build_shared_lib --parallel --cuda_home /usr/local/cuda-11.1 --cudnn_home /usr/local/cuda-11.1

其中的use_cuda表示你要使用CUDA的onnxruntime,cuda_home和cudnn_home均指向你的CUDA安装目录即可。

编译完成输出

[100%] Linking CXX executable onnxruntime_test_all
[100%] Built target onnxruntime_test_all
[100%] Linking CUDA shared module libonnxruntime_providers_cuda.so
[100%] Built target onnxruntime_providers_cuda
2022-03-15 13:49:03,260 util.run [DEBUG] - Subprocess completed. Return code: 0
2022-03-15 13:49:03,260 build [INFO] - Build complete

qt添加头文件和库

*.pro文件

#onnx
INCLUDEPATH += /home/online/mytest/onnx/onnxruntime/include/onnxruntime \
            /home/online/mytest/onnx/onnxruntime/include/onnxruntime/core/session


LIBS += /home/online/mytest/onnx/onnxruntime/build/Linux/Release/libonnxruntime.so.1.8.0
LIBS += /home/online/mytest/onnx/onnxruntime/build/Linux/Release/libonnxruntime_providers_cuda.so
LIBS += /home/online/mytest/onnx/onnxruntime/build/Linux/Release/libonnxruntime_providers_shared.so
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值