Question

AMD has kept only 2.9, 2.8 and 2.7 versions of its SDK online all of which are for OpenCL 1.2. I want to have my application to be compatible with OpenCL 1.1 hardware. Since I am stuck with up with a 1.2 SDK and don't have much hardware support for testing I wanted to know what is the right way to do this?

  1. I downloaded the 1.1 headers from Khronos website and used them with my MinGW compiler. The application works on my ATI GPU with only OpenCL 1.1 drivers but I don't know for sure whether I am right or not. I have this doubt because I am still linking the OpenCL.lib from the SDK which is OpenCL 1.2.

  2. Also should I distribute the OpenCL.dll from SDK with my application?

  3. What is the best way to avoid an error message in non compatible hardware by disabling the OpenCL code so that at least everything else runs?

Was it helpful?

Solution

Take a look at cl.h header:

Every API function has macro, that defines to which version does it belong:

extern CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL
clCreateImage2D(cl_context              /* context */,
                cl_mem_flags            /* flags */,
                const cl_image_format * /* image_format */,
                size_t                  /* image_width */,
                size_t                  /* image_height */,
                size_t                  /* image_row_pitch */, 
                void *                  /* host_ptr */,
                cl_int *                /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;

So, to make your application OpenCL 1.1 compliant, use functions from version 1.1 and older. Take into account, that may functions (like clCreateImage2D) are deprecated in new API versions. In that case you need to define CL_USE_DEPRECATED_OPENCL_1_1_APIS macro - but I don't know if it's good practice.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top