Allocation error reading engine

Description

I want to read the tensort rt engine with the following code but I received an error:

QFile en(“C:/Users/model.trt”;);
if (en.open(QIODevice::ReadOnly))
{
QByteArray data = en.readAll();
nvinfer1::IRuntime* runtime = nvinfer1::createInferRuntime(sample::gLogger);
nvinfer1::ICudaEngine* engine = runtime->deserializeCudaEngine(data.data(), data.size(), nullptr);
en.close();
}

[E] [TRT] C:\source\rtSafe\safeRuntime.cpp (32) - Cuda Error in nvinfer1::internal::DefaultAllocator::free: 1 (invalid argument)

Environment

TensorRT Version: TensorRT-8.0.1.6
GPU Type: NVIDIA TITAN RTX
Nvidia Driver Version:
CUDA Version: 11.3
CUDNN Version:
Operating System + Version: Windows 10
Python Version (if applicable):
TensorFlow Version (if applicable):
PyTorch Version (if applicable):
Baremetal or Container (if container which image + tag):

Hi , UFF and Caffe Parser have been deprecated from TensorRT 7 onwards, hence request you to try ONNX parser.
Please check the below link for the same.

Thanks!

I created the tensor rt engine with this command:
trtexec.exe --onnx=model.onnx --minShapes=input_layer:1x224x224x3 --optShapes=input:2x224x224x3 --maxShapes=input:12x224x224x3 --saveEngine=model.trt

With “onnx2trt” command I do not have these options, do I?
So, ho wcan I read the tensor rt engine in C++ without the function deserializeCudaEngine(…)?

Hi,

Could you please share with us the ONNX model and minimal issue repro script to try from our end for better debugging.

Thank you.