3

Question 1
If I want to build an application with OpenCL support, do I have any guarantees that the OpenCL.lib implementation from my vendor is able to work with all devices from other Vendors? If yes what's the difference between the implementation?

Question 2
Is it possible to use different OpenCL versions in the same application? For example AMD has released a preview driver for OpenCL 2.0 support. On the other hand the lovely company called Nvidia is still trying to ignore everything past OpenCL 1.1. It would be nice if I could write platform specific code in different versions.

2
  • 3
    Based on personal experience (notebook with Intel IGPU & CPU + Radeon GPU on Windows7), answer to question 1 is positive. When I loaded platforms list & looked at cl_platform_id in VS2013 debugger, deep in guts I saw that 2 libraries are dynamically loaded - one for AMD & one for Intel. Though, I don't know what is the general case. For question 2 - backwards compatibility exists (symbols will be found in libraries). Commented May 15, 2014 at 17:15
  • Thanks for your comment! I've experienced 1 myself - I'm looking for the general behavior (couldn't find anything). Thanks for answering 2! :) Commented May 15, 2014 at 17:22

1 Answer 1

4

1: On Windows, OpenCL.lib is a static wrapper around OpenCL.dll, which is the ICD loader, and exposes all of the available platforms. It is provided by Khronos and redistributed by the OpenCL platform vendors. So go ahead and link to it; it will work with whatever is installed (although if nothing is installed your application won't run because it can't find OpenCL.dll; this is solved other ways).

2: Yes. As long as the ICD loader is the latest, you can get at the newer API on newer platforms / devices. Just don't use new API on old devices; that will crash or worse.

Sign up to request clarification or add additional context in comments.

2 Comments

I'll add that unless you NEED newer API, a safe way to target both older and newer platforms / devices is to use the 1.1 cl.h header file (since it doesn't include the 1.2 or newer API).
Good answer! Never heard of the ICD loader before: Can be found here: khronos.org/registry/cl/specs/opencl-icd-1.2.11.0.tgz

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.