Re: How to queue in a multidevice environment
Posted by Arnold on Mar 11, 2017; 3:37pm
URL: https://forum.jogamp.org/How-to-queue-in-a-multidevice-environment-tp4037674p4037768.html
I think I understand sufficient intricacies of multi device openCL to have some examples running. What I don't understand how each task is associated with a certain device. I create a CLMultiContext from the relevant devices and use (a descendant of) CLTask to distribute the work over the devices. I found the example in one of the tests you mentioned. Its procedure execute reads as follows:
public Buffer execute (final CLSimpleQueueContext qc)
{
final CLCommandQueue queue = qc.getQueue ();
final CLContext context = qc.getCLContext ();
final CLKernel kernel = qc.getKernel (kernelName);
out.println ("starting #" + index + ", offset = " + offset + ", sliceHeight = " + sliceHeight + " " +
context.getMaxFlopsDevice ().getName ());
// etc.
In the printout I see that most tasks run on the CPU (assuming that this is the correct way to detrmine to which device context is assigned). From previous bencmarks I know that I had better distribute the tasks evenly between CPU and GPU. How can I select a device for each task? And out of curiosity: how does the CLMultiContext framework assign a device to a certain task?