Developer Guide

Intel® oneAPI DPC++/C++ Compiler Handbook for FPGAs

ID 785441
Date 6/24/2024
Public
Document Table of Contents

The OpenCL™ Installable Client Driver (ICD)

When you compile your multiarchitecture binary, the Intel® oneAPI DPC++/C++ Compiler links the host application to the ICD Loader library automatically. For more information about the OpenCL™ ICD Loader and how it searches for the available OpenCL implementations, refer to https://github.com/KhronosGroup/OpenCL-ICD-Loader.

IMPORTANT:
The ICD and FCD serve different functions:
  • The ICD allows you to enumerate and choose between different runtime implementation in your host program. The ICD is required when you run your multiarchitecture binary in emulation, simulation, or on hardware.
  • The FCD allows you to enumerate and choose between different BSPs in your host program. The FCD is required only when you run your multiarchitecture binary on hardware.

Verifying ICD Configuration for FPGA Targets

The FPGA Support Package for the Intel® oneAPI DPC++/C++ Compiler provides the OpenCL implementation for the FPGA platform in the following library files:

  • Linux: libalteracl.so, found under <oneapi_root>/compiler/latest/opt/oclfpga/host/linux64/lib
  • Windows: alteracl.dll, found under <oneapi_root>/compiler/latest/opt/oclfpga/host/windows64/bin

To confirm that the ICD Loader can find the OpenCL implementation for the FPGA platform, do the following:

Linux
Ensure that the file /etc/OpenCL/vendors/Altera.icd exists in the system and that the file contains the text libalteracl.so.
Windows
Open the regedit with administrator privilege and go to the Windows registry key HKEY_LOCAL_MACHINE\SOFTWARE\Khronos\OpenCL\Vendors. The value of Name should be <oneapi_root>/compiler/<oneapi_version>/opt/oclfpga/host/windows64/bin/alteracl.dll. The Type should be DWORD, and the Data should be 00000000. For example, the registry key should resemble the following:

HKEY_LOCAL_MACHINE\SOFTWARE\Khronos\OpenCL\Vendors] "<oneapi_root>/compiler/<oneapi_version>/opt/oclfpga/host/windows64/bin/alteracl.dll"=dword:00000000

Overriding Default Environment Variables

Use the following environment variables to override some of the ICD loader default behavior.

Environment Variable Behavior Example Format
OCL_ICD_FILENAMES Specifies a list of additional OpenCL implementations to load. The libraries here are enumerated before any other ones discovered via default mechanisms. export OCL_ICD_FILENAMES=libVendorA.so:libVendorB.so

set OCL_ICD_FILENAMES=vendor_a.dll;vendor_b.dll

OCL_ICD_VENDORS (Linux only) Specifies a directory to scan for .icd files to enumerate in place of the default /etc/OpenCL/vendors. export OCL_ICD_VENDORS=/my/local/icd/search/path