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 Release2.0.1
, please add the following line at the end of init_env.sh 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 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:
- Initialize the environment to use OpenCL* and Intel® Acceleration Stack:
- Install OpenCL* drivers by running the following command:
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:
- 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:
- Enter the following command to see the boards connected to the host machine: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:
- Program the required OpenCL* configuration file from the host machine by typing the following command: Sample Output: 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,