Multi Platform Contexts

Hi,
Is it supported to make a single context over a multiple cl_device_ids which in turn span multiple cl_platform_ids?

When I try under Windows, it fails with either an access violation or CL_INVALID_DEVICE, depending on which cl_device_ids I include in the call to clCreateContext.
I’ve tried calling clCreateContext with NULL for properties, {CL_CONTEXT_PLATFORM, NULL, 0} and the properties array having one CL_CONTEXT_PLATFORM entry for each cl_platform_id

I get the following platforms/devices returned by clGetPlatformIDs/clGetDeviceIDs on my PC:

Intel
CPU - OpenCL 1.1
nvidia
GPU - OpenCL 1.0
AMD
GPU - OpenCL 1.1
CPU - OpenCL 1.1

For a bonus question, how do I determine at runtime that two cl_device_ids relate to the same physical hardware. In the above list Intel/CPU and AMD/CPU appear as two distinct cl_device_ids but in reality share the same hardware. The only way I could think of was to limit my application to a single CL_DEVICE_TYPE_CPU device and hope that a given platform scaled across all cores of the CPU.

[I looking to run OpenCL across customer hardware over which I have no knowledge, other than that it runs Windows. Therefore all discovery / decisions have to be made at runtime]

Is it supported to make a single context over a multiple cl_device_ids which in turn span multiple cl_platform_ids?

No, it’s not supported. That’s actually why we have different platforms.

For a bonus question, how do I determine at runtime that two cl_device_ids relate to the same physical hardware. In the above list Intel/CPU and AMD/CPU appear as two distinct cl_device_ids but in reality share the same hardware.

I don’t think there’s a way to do that, unfortunately. If I was writing an application I would use the heuristic that the CPU will always be the same physical device in all platforms.

The only way I could think of was to limit my application to a single CL_DEVICE_TYPE_CPU device and hope that a given platform scaled across all cores of the CPU.

Yes, it will scale to all physical cores.

Is it supported to make a single context over a multiple cl_device_ids which in turn span multiple cl_platform_ids?
I know you’re seeking a Windows solution, but there is something like this for Linux: http://www.alphaworks.ibm.com/tech/ocr

Hey Brian,

Thanks for posting that link! I had no idea such middleware already existed.