Intel® FPGA SDK for OpenCL™ Pro Edition: Programming Guide

ID 683846
Date 3/28/2022
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

6.6.2.1. Linking Your Host Application to the Khronos ICD Loader Library

The Intel® FPGA SDK for OpenCL™ supports the OpenCL ICD extension from the Khronos Group™. The OpenCL ICD extension allows you to have multiple OpenCL implementations on your system. With the OpenCL ICD Loader Library, you may choose from a list of installed platforms and execute OpenCL API calls that are specific to your OpenCL implementation of choice.

In addition to the SDK's host runtime libraries, Intel® supplies a version of the ICD Loader Library that supports the OpenCL Specification version 1.0 and the implemented APIs from the OpenCL Specification versions 1.1, 1.2, and 2.0. To use an ICD library from another vendor, consult the vendor's documentation on how to link to their ICD library.

Before linking your OpenCL host application to the ICD Loader Library, you must also set up the FCD for loading the board MMD libraries. If you have not set up the FCD yet, refer to Managing an FPGA Board for more information.

Ensure that you have set up both ICD and FCD correctly. You can verify this by using the aocl diagnose –icd-only utility, which populates the corresponding ICD/FCDs and verifies if the libraries are registered in the system.

  • If the output of the aocl diagnose utility displays ICD diagnostics PASSED, then when you build your host application, the host application automatically gets linked with the ICD Loader Libraries.
  • If the aocl diagnose utility fails to detect ICD, follow these steps to verify the ICD setup:
    • For Windows system, 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 altera_icd.dll. You can find this dynamic library file in <INTELFPGAOCLSDKROOT>/host/windows64/bin. 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] "alteracl_icd.dll"=dword:00000000

    • For Linux system, ensure that the file /etc/OpenCL/vendors/Altera.icd exists in the system and contains the text libalteracl.so.
  • If the aocl diagnose utility fails to detect FCD, follow these steps for checking the FCD setup:
    • For Windows system, check the libraries in the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Intel\OpenCL\Boards to determine if you have chosen to install for all users. Otherwise, check the registry key HKEY_CURRENT_USER\SOFTWARE\Intel\OpenCL\Boards. The value of Name should be <path_to_the_mmd_library>, and the Data should be a DWORD that is set to 0. For example, the registry key should resemble the following:

      [HKEY_LOCAL_MACHINE\SOFTWARE\Intel\OpenCL\Boards] "c:\board_vendor a\my_board_mmd.dll"=dword:00000000

    • For Linux system, ensure that the file /opt/Intel/OpenCL/Boards/my_board.fcd exists in the system and contains the name of the vendor-specific libraries (for example, /data/board_vendor_a/libmy_board_mmd.so).
      Attention:
      • If your board vendor provides multiple libraries, you must double check that they are in a particular order. Consult with your board vendor to determine the correct order to load the libraries. You must list the libraries in the registry in their loading order.
      • For Intel® Arria® 10 SoC boards, when you build the SD flash card image for your Custom Platform, create an Altera.icd file containing the text libalteracl.so. Store the Altera.icd file in the /etc/OpenCL/vendors directory of your Custom Platform. Refer to Building the Software and SD Card Image for the Intel® Arria® 10 SoC Development Kit Reference Platform for more information.