windows10 编译onnxruntime

编程入门 行业动态 更新时间:2024-10-28 13:16:24

前言

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/microsoft/onnxruntime
1、下载:

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

如果下载慢,也可以用gittee上的镜像:https://gitee/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时必须设置正确的,因为没有设置正常编译都进行不下去。

更多推荐

windows10 编译onnxruntime

本文发布于:2023-05-17 16:47:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/141023.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:onnxruntime

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!