tags:

views:

63

answers:

2

The definition of a platform in Khronos' OpenCL 1.0 and 1.1 specifications:

Platform: The host plus a collection of devices managed by the OpenCL framework that allow an application to share resources and execute kernels on devices in the platform.

The OpenCL function clGetPlatformIDs creates an array of platforms, implying that multiple platforms is possible. Is it safe to assume (in code) that a given OpenCL host has only one platform?

In other words, will I lose anything on any host by doing this:

cl_platform_id platform_id;
cl_uint num_platforms;
errcode = clGetPlatformIDs(1, &platform_id, &num_platforms);
A: 

Even if you assume that a host has only one platform, you would have to figure out what the Id of that platform is, before calling clGetPlatformInfo. So its better if you call clGetPlatformIDs, pick up a default or user supplied platform and then call clGetPlatformInfo.

Thanks, I understand what you are saying and I agree; you can't do much without a platform id. I think my question was unclear when you read it, so I've added an example.
Jacob
+1  A: 

I wouldn't rely on there being only on Platform. When you have multiple OpenCL implementations on one system (which should be possible with the OpenCL ICD, although I'm not sure if that is only planned or already finished), you should get multiple platforms, one for each opencl implementation. One example where there could be multiple opencl implementations would be an nvidia implementation to run opencl on gpu and an amd implementation to run on cpu, so that it not that far fetched either.

edit: look at http://developer.amd.com/support/KnowledgeBase/Lists/KnowledgeBase/DispForm.aspx?ID=71 for (better) desciption of this

Grizzly