Discussion created by Sheeep on Aug 13, 2010
Latest reply on Aug 14, 2010 by Sheeep
Run two queues parallel


I tried to use gpu and cpu parallel.

I created two differente queues in two contexts:

queueCPU = cl::CommandQueue(Context, deviceCPU[0]);

queueGPU = cl::CommandQueue(Context, deviceGPU[0]);


I want to execute both queues parallel. 

so I do:

queueCPU.enqueueNDRangeKernel(this->Kernel[n], cl::NullRange, globalWorkSizeCPU, localWorkSizeCPU, NULL, NULL);


queueGPU.enqueueNDRangeKernel(this->Kernel[n], cl::NullRange, globalWorkSizeGPU, localWorkSizeGPU, NULL, NULL);


and after enqueueing I want to read the data back to host:

queueCPU.enqueueReadBuffer(this->qBuffer[n].ioBuffer, true, 0,size, hostpointer);

queueGPU.enqueueReadBuffer(this->qBuffer[n].ioBuffer, true, 0,size, hostpointer);


If I do it that way, the queues don't run parallel. I think one queue is blocked, so the other can't enqueue, right?


and if I do this (non blocking):


queueCPU.enqueueReadBuffer(this->qBuffer[n].ioBuffer, false, 0,size, hostpointer);

queueGPU.enqueueReadBuffer(this->qBuffer[n].ioBuffer, false, 0,size, hostpointer);

they run parallel, but I don't get the right result.



How can I block the memory, and execute the queues parallel?




P.S. sorry for not posting complete code, but is in different classes, so I thinks it's to much. If needed I can make an simple example...