Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does OpenCL work without ICD loader extension?

Tags:

c

dll

opencl

AFAIK it works like this with ICD loader extension:

  • ICD (installable client driver) = proprietary OpenCL implementation = OpenCL runtime; You can find it in files like amdocl.so/dll or IntelOpenCL.so/dll
  • ICD loader (in OpenCL.dll/libOpenCL.so): for managing multiple ICDs in the same system
    • It is linked with the OpenCL application and acts as a placeholder for the ICD.
    • The application invokes the functions exported by the ICD loader's library. However the ICD loader just decides to which ICD to redirect to depending on the selected OpenCL platform.
    • The ICD loader mechanism is necessary, because a vendor's OpenCL implementation usually just supports this vendor's hardware, but you might want to use multiple devices from different vendors in the same OpenCL application.

As the ICD loader is just an optional OpenCL extension, I wonder how OpenCL works without the ICD loader. Of course, in this case you can not use multiple vendors' implementations in the same application at the same time, but what is used for linking the application? If the developer linked it against a specific implementation, then the main goal of OpenCL, portability, could not be reached anymore.

Or do the vendors have to provide dynamic libraries, that are compatible to each other? That means, if the developer linked to the dynamic library of vendor A, at runtime it would also work, if the target system has the dynamic library of vendor B installed?

Is that anywhere documented?

like image 411
Niklas Peter Avatar asked Jun 03 '16 11:06

Niklas Peter


People also ask

What is OpenCL ICD loader?

OpenCL defines an Installable Client Driver (ICD) mechanism to allow developers to build applications against an Installable Client Driver loader (ICD loader) rather than linking their applications against a specific OpenCL implementation. The ICD Loader is responsible for: Exporting OpenCL API entry points.

What is an ICD OpenCL?

The OpenCL Installable Client Driver (ICD) is a mechanism to allow OpenCL implementations from. multiple vendors to coexist on a system. A vendor OpenCL implementation is an OpenCL Installable. Client Driver if it implements the extension cl_khr_icd, which is described in the OpenCL extension.

What is OCL ICD?

OpenCL ICD Bindings. OpenCL is a royalty-free standard for cross-platform, parallel programming of modern processors found in personal computers, servers and handheld/embedded devices. This package provides an Installable Client Driver Bindings (ICD Bindings).


1 Answers

For Windows OpenCL applications, your application includes OpenCL.h (or cl.h) and links to OpenCL.lib, which is a static library wrapper for OpenCL.dll which resides in the Windows System32 folder. You don't know if it is an ICD or a vendor driver. For the past many years it has been an ICD, but before that (for very early OpenCL implementations) it was a vendor driver. The beauty of the ICD is that the application does not need to know, you just call the OpenCL API. Only when it is an ICD will the number of platforms be greater than 1.

like image 184
Dithermaster Avatar answered Nov 09 '22 22:11

Dithermaster