Hi,
I have a dynamically reshapable model loaded through CaffeParser. It works fine with single opt profile and single execution context. However, when I create 2 profiles in an engine, creation of the first execution context goes well, I set it to use profile 1. Then I create second context and try to set it to profile 0 I get error: “Profile 0 has been chosen by another IExecutionContext. Use another profileIndex or destroy the IExecutionContext that use this profile.”
For debug purpose I created a single execution context and tried to do following sequence of calls:
m_context->setOptimizationProfile(1)
m_context->setOptimizationProfile(0)
The first call to switch to profile 1 gives warning
“Current optimization profile is: 0. Please ensure there are no enqueued operations pending in this context prior to switching profiles”
But profile is switched (confirmed with call to m_context->getOptimizationProfile())
The second call to switch back to profile 0 which is not used now gives warning and error:
“Current optimization profile is: 1. Please ensure there are no enqueued operations pending in this context prior to switching profiles”
“Profile 0 has been chosen by another IExecutionContext. Use another profileIndex or destroy the IExecutionContext that use this profile.”
The execution context stays linked to profile 1. (m_context->getOptimizationProfile() ==1)
The same code works fine on PC (still waning messages but no errors and profiles are correctly switched)
From the documentation on setOptimizationProfile it seems there might be some pending memory operations even though I have not called any enqueue or execute methods.
setOptimizationProfile is also marked as depricated but not clear what to use instead.
There is a setOptimizationProfileAsync but it seems to be more difficult to use (I have to manage cudaStream_t stream myself).
Could you suggest way to resolve the problem, please?
Kind regards
Alexey