11

I just tried to make myself familiar with OpenCL but totally got confused when everyone in the Internet was talking about downloading a Vendor specific OpenCL SDK. Why would I need that?

My understanding of using OpenCL was the following:

  1. Download the OpenCL header files that are maintained by Kronos in the Khronos OpenCL Registry and make it available to your compiler.
  2. Compile your code and link against the OpenCL.dll.

The reason why it confuses me is because I thought that OpenCL should abstract away vendor specific implementations. If I now download a Vendor specific SDK isn't then this advantage destroyed?

Can someone please make this clear?

denim
  • 1,329
  • 1
  • 15
  • 24

1 Answers1

21

Your understanding is absolutely correct - you do not need any vendor SDKs in order to develop or run OpenCL programs. All you need are the headers and a library to link against. The vendor SDKs provide sample code that may be useful to look at while you are learning how to use OpenCL, and they may also provide tools that can aid development.

On Windows, you will need an OpenCL.lib library to link against, which the SDKs do provide. You can download the sources for this library and build it yourself if you wish.

There is no harm from using a specific vendor's SDK however. The headers and library that they provide in the SDK should just be the stock Khronos versions that you can download yourself. This means that an OpenCL application built using one vendor's SDK will still run just fine against other vendors' devices.

jprice
  • 9,755
  • 1
  • 28
  • 32
  • Perfect answer thanks! I just couldn't find this information on my own in the Internet. Also thank you very much for explaining the details with the OpenCL.lib because this would have been my next question. – denim Mar 19 '15 at 13:53
  • The next step is using dynamic loading, in that case you don't even need the "OpenCL.lib", just the headers and the code to resolve the pointer to the functions, some people already codded tools for that: https://github.com/martijnberger/clew – DarkZeros Mar 19 '15 at 14:13
  • Thanks, I was aware of dynamic loading but was curious to know why no one really mentions it in the internet. Everyone kept talking about using a Vendor specific SDK. Now I know that the SDKs do not harm and that they are optional. – denim Mar 19 '15 at 14:20
  • @jprice: You mentioned that "You can download the sources for this library and build it yourself if you wish." to build e.g.: the MSVC import library. But the link simply references the Khronos Registry. Can you please be more precise on where the find the sources to build the OpenCL.dll and OpenCL.lib on my own? Thanks. – denim Mar 20 '15 at 13:21
  • @denim: It's the "Installable Client Driver" you're after, which for some reason only seems to be listed for OpenCL 1.2 at the moment. Here's the direct link to the ICD 1.2 tarball: https://www.khronos.org/registry/cl/specs/opencl-icd-1.2.11.0.tgz – jprice Mar 20 '15 at 13:41
  • @jprice: Thanks. Indeed it was the "Installable Client Driver" I was after. Last question: In case that I build the OpenCL.dll and OpenCL.lib on my own to be used by my Windows Application is it then good practice to install my OpenCL.dll next to my Application on the target System? – denim Mar 23 '15 at 07:49
  • @denim: The OpenCL.dll library is distributed with the GPU drivers and should already be present on any Windows machine with an OpenCL capable GPU and corresponding driver. If you intend to run your application on systems that *do not* have an OpenCL capable GPU (e.g. just using the CPU) then you will need to instruct your users to install an appropriate runtime library (Intel or AMD), which should also install an OpenCL.dll. – jprice Mar 23 '15 at 09:18