Multiple GPUs with QtOpenCL
I am currently developing an application using QtOpenCL on a machine with 4 GPUs. These GPUs are currently working individually in a master/worker fashion, but later I want them to work together by exchanging ghost layers in a large matrix. I use QRunnables for creating tasks and for filling the command queue for the first available GPU.
Using multiple devices is sort of tricky when using QtOpenCL, since a context has a default command queue which is used for queueing kernels and such. But I need 4 command queues, one for each GPU. What I ended up with was creating one context per GPU with a command queue with one of the devices only. Is this the way it's supposed to be done?
The NVIDIA examples just created multiple command queues in a single context, but for the C-API the command queue is an input to the OpenCL calls, which makes how to do it obvious.