windows10 编译onnxruntime

前言

windows10下编译onnxruntime在网上的教程可谓是风毛菱角,经过本人几天的努力钻研,花了九牛二虎之力,终于是完成了这个操作。

环境

cuda版本:11.4
cudnn版本: 8.2.2.26
onnxruntime:1.10.0
Visual Studio 2019
cuda、cudnn和onnxruntime对应的版本可以参考官网:https://onnxruntime.ai/docs/execution-providers/CUDA-ExecutionProvider.html
在这里插入图片描述
**注意:**cuda、cudnn和onnxruntime的版本一定要对应,否则编译会出错。

下载源码

onnxruntime源码地址:https://github.com/microsoft/onnxruntime
1、下载:

git clone -b rel-1.10.0 --recursive https://github.com/Microsoft/onnxruntime

如果下载慢,也可以用gittee上的镜像:https://gitee.com/mirrors_microsoft/onnxruntime

2、更新包

cd onnxruntime
git submodule update --init --recursive

3、编译脚本

.\build.bat  --build_shared_lib --parallel --use_cuda --cuda_version 11.4 --cuda_home "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.4" --cudnn_home "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.4"  --cmake_generator "Visual Studio 16 2019" --skip_tests --config Release

需要添加参数可以参考onnxruntime官方文档
编译成功如下图所示:
在这里插入图片描述

遇到问题

参照网上的编译流程,期间遇到过cuda版本不对应的问题
还有编译时的一个参数–cuda_version 11.4时必须设置正确的,因为没有设置正常编译都进行不下去。

  • 1
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值