I want to create context in every thread.
for every thread,I create cuda context by pycuda.driver.Device.make_context and use the same engine to create trt context:
self.context = self.engine.create_execution_context()
self.context.active_optimization_profile=0
it’s works fine for fixed shapes(the second line is not used).
but for dynamic shapes,
when I execute the code second time in the second thread,the first line of code causes a warning:
[TensorRT] WARNING: Could not set default profile 0 for execution context. Profile index must be set explicitly.
and the second line of the code causes a error:
.......
self.context.active_optimization_profile=0
IndexError: Profile index 0 is out of bounds.
Environment:
Ubuntu 18.04
CUDA 10.1
TensorRT 6.0.1.5 ga