You are in a tricky situation since the OpenCV code has missing functionality interface to the underlying OpenCL options:
804 void CommandQueue::create(ContextImpl* context)
805 {
806 release();
807 cl_int status = 0;
808 // TODO add CL_QUEUE_PROFILING_ENABLE
809 cl_command_queue clCmdQueue = clCreateCommandQueue(context->clContext, context->clDeviceID, 0, &status);
810 openCLVerifyCall(status);
811 context_ = context;
812 clQueue_ = clCmdQueue;
813 }
I think you should either release and re-create the internal queue, by:
cl_command_queue Queue = clCreateCommandQueue(ocl::Context::getOpenCLContextPtr(), ocl::Context::getOpenCLDeviceIDPtr(), CL_QUEUE_PROFILING_ENABLE); //Create a new queue with same parameters
ocl::CommandQueue::Release(); //To release the old queue
ocl::CommandQueue::clQueue_ = Queue ; //To overwrite it internally with the new one
Or do it everything yourself (creating all the devices and using them manually) But beware! This is unsafe! (And untested). However, the DOC says that those classes have public attributes and they can be written from the outside.