Check OpenCL device version compatibility?

My application is OpenCL 1.1 compatible and I want to check whether each of the device is compatible for that version. There are 2 ways for this:

[li] clGetDeviceInfo() ->CL_DEVICE_VERSION
[/li][li] clGetPlatformInfo() ->CL_PLATFORM_VERSION

I have following doubts:
[li] I do not understand why method 1 is provided as method 2 seems the correct way to me?
[/li][li] Is it possible that the version given by the platform will not match with the version given by a device from the same platform?
[/li][li] What is clGetDeviceInfo::CL_DRIVER_VERSION for?
[/li][li] From all these options which one should I use to check if a device can run my OpenCL 1.1 code?

You should read the section “3.1.1 Platform Mixed Version Support” in the OpenCL Specification.

  1. There are three kinds of version:
  • Platform version: this gives the version of the OpenCL API available for all functions related to the host runtime. This covers nearly all the functions of the API except clGetDeviceInfo.

  • Device version: this defines the information that clGetDeviceInfo can query and the mimimum values the device must support. All this is described by the documentation of clGetDeviceInfo in the OpenCL Specification of the same device version.

  • OpenCL C version: this defines the highest version of the OpenCL C language that is supported by the device (in particular the built-in functions that are available).

  1. The driver version is only for information. Its value is vendor-dependent.

  2. For the device to run your code, you need to check the OpenCL C version to ensure that your kernel code can be compiled successfully for this device.
    You generally have to check with clGetDeviceInfo that the kernel can accept the parameters and the ranges you will pass.