Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using TensorRT EP by nuget #21428

Closed
alikad opened this issue Jul 20, 2024 · 6 comments
Closed

using TensorRT EP by nuget #21428

alikad opened this issue Jul 20, 2024 · 6 comments
Labels
ep:CUDA issues related to the CUDA execution provider ep:TensorRT issues related to TensorRT execution provider .NET Pull requests that update .net code platform:windows issues related to the Windows platform

Comments

@alikad
Copy link

alikad commented Jul 20, 2024

Describe the issue

Hi
i want to use TensorRT EP but don't know how.
first is i used custom build with windows 10 and vs2019 but i get some errors at building mu project.
now I'm using nuget but i get same errors.
827 unresolved externals errors!
image

the onnxRuntime config is this:
image

and the enviroment variable is this:
image

To reproduce

#include <iostream>
#include <assert.h>
#include <cmath>
#include <stdlib.h>
#include <stdio.h>
#include <vector>
#include "onnxruntime_c_api.h"
#include "cuda_provider_factory.h"
#include "onnxruntime_cxx_api.h"

int main() {
	Ort::Env env(ORT_LOGGING_LEVEL_WARNING, "test");
	Ort::SessionOptions session_options;

#ifdef _WIN32
	const wchar_t* model_path = L"squeezenet.onnx";
#else
	const char* model_path = "squeezenet.onnx";
#endif

	OrtStatus* status = OrtSessionOptionsAppendExecutionProvider_Tensorrt(session_options, 0);
	if (status != nullptr) {
		return -1;
	}
	// Create the session
	Ort::Session session(env, model_path, session_options);

	return 0;
}

Please Help.

Urgency

No response

Platform

Windows

OS Version

10

ONNX Runtime Installation

Released Package

ONNX Runtime Version or Commit ID

1.18.1

ONNX Runtime API

C++

Architecture

X64

Execution Provider

TensorRT

Execution Provider Library Version

CUDA 11.8

@github-actions github-actions bot added ep:CUDA issues related to the CUDA execution provider ep:TensorRT issues related to TensorRT execution provider platform:windows issues related to the Windows platform labels Jul 20, 2024
@tianleiwu
Copy link
Contributor

For 1.18.1, since you use cuda 11.8, you need cuDNN 8.9 and TRT 10.
See https://onnxruntime.ai/docs/execution-providers/CUDA-ExecutionProvider.html#requirements. Note that it also applies to TensorRT EP.

If you want to use cuDNN 9, you will need install package for cuda 12: https://onnxruntime.ai/docs/install/#install-onnx-runtime-gpu-cuda-12x-1

@alikad
Copy link
Author

alikad commented Jul 22, 2024

thanks, i will test and send the result.

@alikad
Copy link
Author

alikad commented Jul 22, 2024

now i added "TensorRT-10.2.0.19.Windows.win10.cuda-11.8", "cudnn-windows-x86_64-8.9.0.131_cuda11", "Microsoft.ML.OnnxRuntime 1.18.1", "Microsoft.ML.OnnxRuntime.Gpu 1.18.1" and cuda 11.8.
but same error.
Code:
image

error:
image

includes:
image

linker libraries:
image

linker inputs:
image

@tianleiwu is there any error at my sample code or is it from the libraries?

@tianleiwu
Copy link
Contributor

@alikad,

Could you follow the example code here:
https://github.com/microsoft/onnxruntime-inference-examples/blob/0de2e66e03981714e5308c457b72d785e98d0fe2/c_cxx/squeezenet/main.cpp

@alikad
Copy link
Author

alikad commented Jul 23, 2024

with little changes, it worked. i removed the " Ort::ThrowOnError" parts and the final results are achieved
thnks a lot.

@sophies927 sophies927 added the .NET Pull requests that update .net code label Jul 25, 2024
@jywu-msft
Copy link
Member

issue seems to be resolved. closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ep:CUDA issues related to the CUDA execution provider ep:TensorRT issues related to TensorRT execution provider .NET Pull requests that update .net code platform:windows issues related to the Windows platform
Projects
None yet
Development

No branches or pull requests

4 participants