Ocl-icd implementation of opencl icd loader
libOpenCL.so is the library linked by OpenCL programs. It does not contains any OpenCL implementation itself, but merly act as a dispatcher to real OpenCL implementations provided as OpenCL Installable Client Driver (ICD). An ICD loader should be able to load ICDs provided by any vendors.
According to OpenCL specifications from Khronos (see [Kronos]), the ICD Loader looks for files into /etc/OpenCL/vendors/ directory and, for each file whose name ends with .icd, the ICD Loader loads with dlopen(3) the shared library whose name is on the first line of the .icd file.
Shared library name in ".icd" files can have its path, or it can be a plain filename. In the latter case, the ICD shared library will be look for into the standard dynamic loader paths.
Some environment variables can be used modify the default behavior of libOpenCL.
This variable allows one to change the way ICD are searched on the system. Several cases are considerated:
if $OCL_ICD_VENDORS is a directory path, then this path replaces the "/etc/OpenCL/vendors" path in the standard behavior: the loader will use the .icd files in this directory;
else, if $OCL_ICD_VENDORS ends with .icd, libOpenCL.so will only load the ICD whose shared library name is wrote into the specified ".icd" file;
If there is no slash into $OCL_ICD_VENDORS, libOpenCL.so will first try to use /etc/OpenCL/vendors/$OCL_ICD_VENDORS. If this fail, it uses $OCL_ICD_VENDORS (as a relative or absolute file name path).
else libOpenCL.so will try to load $OCL_ICD_VENDORS as the ICD shared library itself (i.e. to load it directly with dlopen(3)).
If set, contrary the the Kronos specification, the loader will not check that the loaded ICDs declare the cl_khr_icd extension. You may need to define this environment variable if you are using the Intel ICD toguether with optirun(1). Else, a bug into the Intel ICD will make the application crash.
If ocl-icd has been compiled with debug support, you can set this environment variable to a value where each bit display some kind of informations. Defined values are:
1: warnings (enabled by default if debug support is present and OCL_ICD_DEBUG is not set)
2: informative messages
4: entering/exiting for some OpenCL functions
8: dump of the internal structure of loaded ICDs
OCL_ICD_DEBUG is mainly useful for ocl-icd development itself and/or for ICD development.
Kronos OpenCL registry website
Vincent Danjean <[email protected]>