OpenCL* Quick Start User Guide: Intel FPGA Programmable Acceleration Card D5005

Download
ID 683324
Date 7/21/2020
Public

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

The init_env.sh 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

    2.0.1

    , please add the following line at the end of init_env.sh script:
    export ALTERAOCLSDKROOT= $INTELFPGAOCLSDKROOT
    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 init_env.sh points to this version by default.
  • Runs the OpenCL* initialization script to enable the runtime environment or the development environment (if installed) by running init_opencl.sh
    Note: If this is your first time running init_env.sh, 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 init_env.sh script. Most settings are temporary.
  • Sets various permissions and system parameters by running setup_permissions.sh
  • 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 and the init_env.sh script sources the setup_permission.sh script. You must execute setup_permisssion.sh script after every reboot. Intel recommends you to include it as part of the init_env.sh 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>/init_env.sh or <DEV install path>/init_env.sh 
    
  2. Install OpenCL* drivers by running the following command:
    aocl install $AOCL_BOARD_PACKAGE_ROOT
    Note: You may have to run the above source init_env.sh 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® FPGA 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: 
    	/etc/OpenCL/vendors
    
    Found 1 icd entry at that location:
    	/etc/OpenCL/vendors/Altera.icd
    
    the following OpenCL libraries are referenced in the icd files:
    	libalteracl.so
    
    checking LD_LIBRARY_PATH for registered libraries:
    	libalteracl.so 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:
    	/opt/Intel/OpenCL/Boards
    
    Found 1 fcd entry at that location:
    	/opt/Intel/OpenCL/Boards/dcp_bsp.fcd
    
    the following OpenCL libraries are referenced in the fcd files:
    	/<installation_directory>/inteldevstack/a10_gx_pac_ias_1_2_1_pv/opencl/opencl_bsp/linux64/lib/libintel_opae_mmd.so
    
    checking LD_LIBRARY_PATH for registered libraries:
    	/<installation_directory>/inteldevstack/a10_gx_pac_ias_1_2_1_pv/opencl/opencl_bsp/linux64/lib/libintel_opae_mmd.so 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:
    acl0
    
    BSP Install Location:
    /<installation_directory>/inteldevstack/a10_gx_pac_ias_1_2_1_pv/opencl/opencl_bsp
    
    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.
    
    DIAGNOSTIC_PASSED
    --------------------------------------------------------------------
    
    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

Did you find the information on this page useful?

Characters remaining:

Feedback Message