【ONNXRuntime】Win10 GPU环境 ONNXRuntime下载与VS开发配置

编程知识 更新时间:2023-05-02 16:54:12

ONNXRuntime下载

        下载地址:Releases · microsoft/onnxruntime (github)

        在下载地址找到对应版本,历史版本在Assets点开折叠后可以看到,可下载内容如下,如果需要支持GPU需要下载对应版本。

         也可以通过指定版本的地址直接定位到想要的版本,例如1.8.0

https://github/microsoft/onnxruntime/releases/tag/v1.8.0

GPU环境准备

        因为onnxruntime官方不支持windows编译(编译需要的Nvidia NCCL不支持widows),所以使用release包时需要使用比较严格对应的CUDA和cudnn,参考安装说明。但实际测试发现也并非严格对应,比如1.10.0可以用1.8.0的环境,但不能用1.6.0的环境。

Please reference table below for official GPU packages dependencies for the ONNX Runtime inferencing package. Note that ONNX Runtime Training is aligned with PyTorch CUDA versions; refer to the Training tab on https://onnxruntime.ai/ for supported versions.

Note: Because of CUDA Minor Version Compatibility, Onnx Runtime built with CUDA 11.4 should be compatible with any CUDA 11.x version. Please reference Nvidia CUDA Minor Version Compatibility.

ONNX RuntimeCUDAcuDNNNotes
1.1011.48.2.4 (Linux)
8.2.2.26 (Windows)
libcudart 11.4.43
libcufft 10.5.2.100
libcurand 10.2.5.120
libcublasLt 11.6.1.51
libcublas 11.6.1.51
libcudnn 8.2.4
1.911.48.2.4 (Linux)
8.2.2.26 (Windows)
libcudart 11.4.43
libcufft 10.5.2.100
libcurand 10.2.5.120
libcublasLt 11.6.1.51
libcublas 11.6.1.51
libcudnn 8.2.4
1.811.0.38.0.4 (Linux)
8.0.2.39 (Windows)
libcudart 11.0.221
libcufft 10.2.1.245
libcurand 10.2.1.245
libcublasLt 11.2.0.252
libcublas 11.2.0.252
libcudnn 8.0.4
1.711.0.38.0.4 (Linux)
8.0.2.39 (Windows)
libcudart 11.0.221
libcufft 10.2.1.245
libcurand 10.2.1.245
libcublasLt 11.2.0.252
libcublas 11.2.0.252
libcudnn 8.0.4
1.5-1.610.28.0.3CUDA 11 can be built from source
1.2-1.410.17.6.5Requires cublas10-10.2.1.243; cublas 10.1.x will not work
1.0-1.110.07.6.4CUDA versions from 9.1 up to 10.1, and cuDNN versions from 7.1 up to 7.4 should also work with Visual Studio 2017

For older versions, please reference the readme and build pages on the release branch.

        以CUDA11.0.3和cudnn8.0.2.39下载环境安装,CUDA只安装runtime和development,cudnn解压放到cuda安装目录即可。

VS开发配置

工程属性

C/C++ -> Additional Include Directories添加:

D:\libs\onnxruntime-win-x64-gpu-1.10.0\include

Linker -> Additional Library Directories添加:

D:\libs\onnxruntime-win-x64-gpu-1.10.0\lib

Linker -> Input -> Additional

onnxruntime.lib

使用时

#include <onnxruntime_cxx_api.h>

如果cuda/cudnn环境与onnxruntime不适配,在session.run()时会报错,例如:

Unhandled exception at 0x00007FF84C9D313C (cudnn64_8.dll) in onnx.exe: Fatal program exit requested.

更多推荐

【ONNXRuntime】Win10 GPU环境 ONNXRuntime下载与VS开发配置

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

发布评论

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

>www.elefans.com

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

  • 106833文章数
  • 26986阅读数
  • 0评论数