If the system TRT version has been updated by the package manager and my code then loads an older serialized TRT engine from a file, I get an error like below:
trtRuntime = nvinfer1::createInferRuntime(gLogger.getTRTLogger());
engine = trtRuntime->deserializeCudaEngine(cached_engine.data(),
cached_engine.size(), nullptr);
[E] [TRT] 6: The engine plan file is not compatible with this version of TensorRT, expecting library vers
ion 8.2.2 got 8.2.1, please rebuild.
[E] [TRT] 4: [runtime.cpp::deserializeCudaEngine::50] Error Code 4: Internal Error (Engine deserializatio
n failed.)
Of course the simple solution is to delete and rebuild the TRT engine. But my users don’t necessarily understand this, so I would like to be able to test for this condition, or catch this error so it can be dealt with automatically. How can I do this?