TensorRT Engine Creation from Caffe Model Fails When Run Consecutively

I have an application which creates TensorRT engine from caffemodel and several engines are created from different caffemodels on this application. Now when I just create a single engine, everything is fine and the engine is created. But when I try to consecutively create two different engines (not at the same time), after the first engine is created, application throws segmentation fault when trying to create the second engine.

I use sample::getEngine function to create the engine. But it seems that the function throws segmentation fault without giving any proper log for this case. The part where it throws the segmentation fault seems to be the snippet below.

const auto blobNameToTensor = parser.caffeParser->parse(
            model.prototxt.c_str(), modelName.empty() ? nullptr : modelName.c_str(), network, DataType::kFLOAT);


TensorRT Version: TensorRT-
GPU Type: Quadro P4000
Nvidia Driver Version: 455.32.00
CUDA Version: 10.2

Relevant Files

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.


I followed your suggestion and it worked smoothly. Thanks!