PDA

View Full Version : create context from list of devices with different types?



janjan
06-30-2009, 05:44 PM
Assume that clGetDeviceIDs(..., some_platform, ...) returns a list of devices from different device type (e.g. GPU _and_ CPU):

Is it allowed/possible to create a context from these devices?

affie
07-01-2009, 02:41 PM
You can use any combination of devices that are returned by clGetDeviceIDs to create a CL context.

For example, clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...) will return all CL devices in the system supported by a particular platform. This may include CPUs and GPUs (from the same or different vendors) depending on what your CL implementation supports.

You can pass these devices (CPUs, GPUs, or other CL devices returned by clGetDeviceIDs) to <devices> argument in clCreateContext. And all these devices can then be used to enqueue work. CL allows heterogenous devices to be used together in a CL context. The decision, however, falls upon the implementation as to what devices it will allow.

janjan
07-01-2009, 03:08 PM
Thank you very much for your reply!

As I already pointed out in my last two posts, I think that the documentation could be improved whenever it comes to "what is allowed and what not?" (e.g. different device_types in a context, different platforms in a context, min/max number of contexts per device and so on).