C++ Onnx-GPU Cuda Dll throws access violation

Viewed 153

I am programming the first time on C++ and i have a not solvable problem at the moment. My trained network works fine using Onnx-CPU but i have trouble running it on the GPU.

Enviroment and Versions:

Windows 10, RTX 3090 Driver: 516.59

Visual Studio Code Community 2022

Microsoft.ML.OnnxRuntime.Gpu 1.12.0

Cuda 11.4

cuDnn 8.2.2.26

#include <iostream>

#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <vector>
#include <string>

#include <onnxruntime_cxx_api.h>

int main() {
    const string imageFile = "image";
    auto onnxFile = L"path to onnx file";

//Testing CV
cv::Mat img = cv::imread(imageFile)

//-----------------------------------------------GPU SUPPORT------------------------------------------------


auto providers = Ort::GetAvailableProviders();
for (auto provider : providers) {
    cout << provider << endl;
}
Ort::Session session(nullptr);
Ort::Env env(OrtLoggingLevel::ORT_LOGGING_LEVEL_WARNING, "test");
Ort::SessionOptions session_options;
session_options.SetIntraOpNumThreads(1);
Ort::ThrowOnError(OrtSessionOptionsAppendExecutionProvider_CUDA(session_options, 0));//Crash is here


//----------------------------------------------------------------------------------------------------------

// create session
session = Ort::Session(env, onnxFile, sessionOptions);

}

The error i get is:

Exception thrown at 0x00007FFD36393F68 (cufft64_10.dll) in programm.exe: 0xC0000005: Access violation writing location 0x000000D3562B0000. The file is in C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.4\bin\cufft64_10.dll.

I hope you can help me figure out what i have done wrong in my installation/code snippet.

0 Answers
Related