PDA

View Full Version : One cl_context includes devices from different cl_platforms?



janjan
06-29-2009, 12:43 PM
Assuming I have a OpenCL driver / environment in which the function clGetPlatformIDs() returns more than one cl_platform_id:

Is it possible to create a create a context including devices from different platforms?

I tried to find an answer in the OpenCL specifications but didn't found any definitive answer. There are some passage in section 4.3 which makes me think it is not possible but I'd like to be sure on this one.

affie
06-30-2009, 09:48 AM
The devices specified in <devices> argument to clCreateContext must be for the same platform. clCreateContext returns CL_INVALID_DEVICE if devices contains an invalid device or are not associated with the specified platform.

janjan
06-30-2009, 12:32 PM
thank you!

now that i now of this, it is finally clear to me that the sentence
"devices is a pointer to a list of unique devices returned by clGetDeviceIDs for a platform."
implies this behaviour.

Perhaps it might be a good idea to clarify this point in the OpenCL spec? Something similar to this would have helped me a lot:

"devices is a pointer to a list of unique devices returned by clGetDeviceIDs for a specific platform. Therefor, it is not possible to mix devices from different platforms into one context."


edit:
after reading your answer again it is also clear to me that the sentence
"CL_INVALID_DEVICE if devices contains an invalid device or are not associated with the
specified platform."
also describes this behaviour. Nevertheless, I think an additional sentence like the above might clarify the situation.

daa
05-23-2012, 02:09 PM
Is the restriction of not allowing a single context to include different platforms a design choice or a technical limitation?

Will OpenCL ever be able to support that feature (a context of different platforms)?

sean.settle
05-23-2012, 11:32 PM
In my opinion the restriction is due to vendors having little or no apparent financial incentive to implement that level of interoperability relative to the support it would require. Efficiently managing buffers across platforms and including a compiler optimized for each device requires knowing all the hardware platforms and devices.

The closest thing available to what you seem to want is the IBM OpenCL Common Runtime for Linux, which is a platform wrapper. It hasn't been updated in awhile and only supports OpenCL 1.1 vendor platforms (and/or devices, I can't recall exactly).

daa
05-24-2012, 12:05 AM
Thank you Sean for the explanation.