OpenCL* on Intel® Programmable Acceleration Card with Intel® Arria® 10 GX FPGA Quick Start User Guide

ID 683831
Date 6/05/2020

2.2. Initializing the Environment for OpenCL* with Intel Acceleration Stack

The script performs all the initialization and setup for the Acceleration Stack for OpenCL* . The script is available in either /<RTE install path>/ or /<DEV install path>/.

The script completes the following tasks:
  • Exports the following environment variables:
    Environment Variables Description
    OPAE_PLATFORM_ROOT Points to the extracted Intel Acceleration Stack release.
    AOCL_BOARD_PACKAGE_ROOT Points to the unpacked OpenCL* BSP.
    INTELFPGAOCLSKDROOT The Intel FPGA SDK for OpenCL* installation directory.
    ALTERAOCLSDKROOT Builds and runs the OpenCL* samples in the installation directory.
    Note: If you are using the Intel® Acceleration Stack for Runtime Release


    , please add the following line at the end of script:
    QUARTUS_HOME Exported only if you are using the Intel Acceleration Stack for Development. Points to Intel® Quartus® Prime installation used for compiles.
    Note: The Acceleration Stack for Development includes Intel® Quartus® Prime software. Use this version for all your OpenCL* development and compiles as FIM on the board is developed using this particular Intel® Quartus® Prime version. The points to this version by default.
  • Runs the OpenCL* initialization script to enable the runtime environment or the development environment (if installed) by running
    Note: If this is your first time running, you must restart and rerun the script for permanent permissions and system parameter settings to take effect.
    Note: Each time you restart the host or start a new shell, rerun the script. Most settings are temporary.
  • Sets various permissions and system parameters by running
  • Adds the Intel SDK for OpenCL* (aocl) utility located at $INTELFPGAOCLSDKROOT/bin to your PATH
    Note: Ensure that you install the FPGA driver as per the instructions in the Intel Acceleration Stack Quick Start Guide for Intel FPGA Programmable Acceleration Card D5005 Intel Acceleration Stack Quick Start Guide for Intel® PAC with Intel® Arria® 10 GX FPGA and the script sources the script. You must execute script after every reboot. Intel recommends you to include it as part of the script.
Complete the following steps to run the OpenCL* design:
  1. Initialize the environment to use OpenCL* and Intel® Acceleration Stack:
    source <RTE install path>/ or <DEV install path>/ 
  2. Install OpenCL* drivers by running the following command:
    aocl install $AOCL_BOARD_PACKAGE_ROOT
    Note: You may have to run the above source command as root. This helps setting up the right environment to run aocl install as root after. This is the one time step. After the .fcd file is set, you don't need to run this command every time you try to compile or use the Intel® PAC card.
    Sample Output:
    # aocl install
    Do you want to setup the FCD at directory /opt/Intel/OpenCL/Boards [y/n] y
    aocl install: Adding the board package /tools/inteldevstack/a10_gx_pac_ias_1_2_1_pv/opencl/opencl_bsp to the list of installed packages
    aocl install: Setting up the FPGA Client Driver (FCD) to the system.
    Install the FCD file to /opt/Intel/OpenCL/Boards 
    Installing the board package driver to the system.
    aocl install: Running install from /tools/inteldevstack/a10_gx_pac_ias_1_2_1_pv/opencl/opencl_bsp/linux64/libexec
  3. Check if you have two ICD files, Altera.icd, and Intel_FPGA_SSG_Emulator.icd loaded in your /etc/OpenCL/vendors directory when you run the stack installation. The ICD driver links the host against the OpenCL* device libraries. If not installed at the required location, run the following commands to manually copy them:
    sudo cp $INTELFPGAOCLSDKROOT/Altera.icd /etc/OpenCL/vendors/ 
    sudo cp $INTELFPGAOCLSDKROOT/Intel_FPGA_SSG_Emulator.icd /etc/OpenCL/vendors/ 
  4. Enter the following command to see the boards connected to the host machine:
    aocl diagnose
    Note: Use aocl diagnose <device-names> to run diagnose for specified devices and use aocl diagnose all to run diagnose for all devices.

    Sample Output:
    # aocl diagnose 
    ICD System Diagnostics                                              
    Using the following location for ICD installation: 
    Found 1 icd entry at that location:
    the following OpenCL libraries are referenced in the icd files:
    checking LD_LIBRARY_PATH for registered libraries: was registered on the system at /<installation_directory>/tools/intelFPGA_pro/quartus_19.2.0b57/hld/host/linux64/lib
    Using the following location for fcd installations:
    Found 1 fcd entry at that location:
    the following OpenCL libraries are referenced in the fcd files:
    checking LD_LIBRARY_PATH for registered libraries:
    	/<installation_directory>/inteldevstack/a10_gx_pac_ias_1_2_1_pv/opencl/opencl_bsp/linux64/lib/ was registered on the system.
    Number of Platforms = 1 
    	1. Intel(R) FPGA SDK for OpenCL(TM)                             | Intel(R) Corporation           | OpenCL 1.0 Intel(R) FPGA SDK for OpenCL(TM), Version 19.4
    ICD diagnostics PASSED                                              
    BSP Diagnostics                                                     
    Device Name:
    BSP Install Location:
    Vendor: Intel Corp
    Physical Dev Name   Status            Information
    pac_ef00000         Passed            Intel PAC Platform (pac_ef00000)
                                          PCIe 05:00.0
                                          FPGA temperature = 49 degrees C.
    Call "aocl diagnose <device-names>" to run diagnose for specified devices
    Call "aocl diagnose all" to run diagnose for all devices
  5. Program the required OpenCL* configuration file from the host machine by typing the following command:
    aocl program <device name> <filename>

    Sample Output:
    $ aocl program acl0 vector_add.aocx 
    aocl program: Running program from /home/DCPsupport/intelrtestack/a10_gx_pac_ias_1_2_1_pv/opencl/opencl_bsp/linux64/libexec
    Program succeed. 
    You can see the device name in the output for aocl diagnose and you can use one of the pre-compiled bitstream for programming. For example,
    aocl program acl0 $OPAE_PLATFORM_ROOT/opencl/hello_world.aocx