GL/CL interop on multiple GPUs
Hi, my question is:
If i have two gpu of different type (like ati and nvidia) installed on my pc and execute some openGL code in the first gpu and instead, in the second GPU i execute some openCL code, the two gpus can interact with GL/CL interop methods without pass ANY data through the CPU?
And if this is possible can tell me which is the GL/CL code that do the devices selection where the code will be excuted?
thanks very much.
In order to interoperate between OpenGL and OpenCL, the OpenCL context must be built from the OpenGL context. If you don't get an error when trying to do this across devices (GL on one, CL on the other), then it should work correctly. However, in most cases you'll get an error and you'll need to have a non-interop fallback case (stand-alone CL context, transfer images through CPU).
And for the devices selection where the code will be excuted, how to do that?
thanks for replying.
In OpenCL you iterate the Platforms, then within each Platform, iterate the Devices that are available. Filter to those that you wish to support (e.g., perhaps GPU only) then select one or more that you create Contexts on (this is where you'd use CL/GL interop if available). Then for a Context + Device you create a Command Queue. Memory transfers and Kernel executions are submitted to a Command Queue, so this is how you select which device your kernels run on.