OpenCL ICD Loader

oneAPI Construction Kit supports fetching and building the Khronos OpenCL ICD Loader when the variable CA_CL_ENABLE_ICD_LOADER is set to ON. Support is disabled by default but can be enabled when configuring the build.

Warning

When the OpenCL ICD Loader is enabled and OpenCL drivers are installed on the system, failure to explicitly specify either OCL_ICD_FILENAMES or OCL_ICD_VENDORS when running a test suite or application will result in it using the system driver rather than a driver from the oneAPI Construction Kit build.

Hint

Note that on windows it will be necessary to set the registry setting to the built bin/CL.ll. The source/cl/tools/icd-register.ps1 can be used for this.

During development, when the OpenCL ICD Loader is enabled, executables which link against it must specify an Installable Client Driver (ICD) which implements the OpenCL API.

OCL_ICD_FILENAMES

An environment variable containing a : separated list of ICD’s. If present, it is parsed by the OpenCL ICD Loader and used to populate the list of OpenCL drivers available to an OpenCL application. Example:

$ OCL_ICD_FILENAMES=/path/to/libCL.so /path/to/UnitCL

oneAPI Construction Kit also supports the creation of .icd files which are output to <build>/share/OpenCL/vendors and can be read by the OpenCL ICD Loader to populate the list of OpenCL drivers for an application to choose from.

OCL_ICD_VENDORS

An environment variable specifying the directory to search for .icd files. If present, the OpenCL ICD Loader uses it to override the default search path of /etc/OpenCL/vendors on Linux or the registry entry HKEY_LOCAL_MACHINE\SOFTWARE\Khronos\OpenCL\Vendors on Windows. For example:

$ OCL_ICD_VENDORS=/path/to/OpenCL/vendors /path/to/UnitCL

Note

The oneAPI Construction Kit check target infrastructure automatically makes use of the OpenCL ICD Loader when enabled, selecting the CL OpenCL driver by specifying OCL_ICD_FILENAMES.