Reputation: 69
I want to run two different algorithms on the same device at the same time assuming that my device has 2 compute units. Is that possible by just creating 2 different kernels, 2 programs and 2 command queues?
I've tried to test this, but it seems like the second kernel doesn't execute, so I'm wondering if this is even possible?
In the Nvidia OpenCL Programming Guide, I've read that:
"For devices of compute capability 2.x and higher, multiple kernels can execute concurrently on a device, so maximum utilization can also be achieved by using streams to enable enough kernels to execute concurrently."
Now I'm not sure if this really means I can run multiple DIFFERENT kernels or just multiple instances of the same kernel (and those would be just simple old work items).
I've also checked that my Nvidia GeForce GT 525M has a compute capability of 2.1.
Upvotes: 1
Views: 196
Reputation: 11232
Yes, it's perfectly legal to have multiple command queues on the same device, running different kernels.
Both kernels should definitely execute, even if the device doesn't support concurrent kernel execution (then they will just run sequentially). You may have a bug in your code. Remember that you will have to clFinish
both command queues independently (or have an event for each kernel invocation).
What may be hard is getting the two kernels to actually run concurrently. Even if the device supports that behavior in hardware, the kernels could still run sequentially, if any of the resources are not sufficient to run them simultaneously.
If your two algorithms can each by themselves run sufficiently parallel to use most of the device resources, it's easier to just run them in the same command queue after one another than trying to parallelize the execution.
Upvotes: 2