Marco13

Detecting which functions are available depending on platform

Discussion created by Marco13 on Jan 11, 2011
Latest reply on Jan 11, 2011 by nou

Hello,

I have multiple OpenCL implementations on one PC. The Stream SDK, with OpenCL 1.1 support, and ... one implementation from another graphics card vendor, which does not yet support OpenCL 1.1.

This means that there are two platforms available, which support different versions of OpenCL. OpenCL is wrapped away in a DLL. When using this DLL to call an OpenCL 1.1-function (like clCreateSubBuffer), implicitly using the OpenCL 1.0 platform, the program dies painfully.

Theoretically, it would be possible to

- detect the context from the given memory object

- detect the devices for the context

- detect the platforms for the devices

- figure out whether these platforms are all the same, with OpenCL 1.1 support

But of course, this is not practically applicable.

Is there any way to detect at runtime(!) whether such a call is supported? For example, to achieve that a call to a non-supported function always returns a value different to CL_SUCCESS, but without causing a crash or non-recoverable error? One could query all OpenCL versions at startup, and set a flag to programmatically disable all functions which are not supported based on the lowest OpenCL version number, but maybe there is a more elegant and less restraining solution.

Thanks in advance for any hints.

bye

Marco

 

Outcomes