GitHub - intel/fpga-runtime-for-opencl: Intel® FPGA Runtime for OpenCL™ Software Technology (original) (raw)

Prerequisites

Linux

Windows

Building the Runtime

Build Instructions for Linux and Windows

Perform these steps to build the runtime:

  1. Clone and change to the runtime repository.
git clone https://github.com/intel/fpga-runtime-for-opencl  
cd fpga-runtime-for-opencl  
  1. Switch to the latest release version.
  2. Create and change to the runtime build directory.
  3. Generate the Ninja build files using the cmake command.
cmake -G Ninja .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../install  
  1. Build the runtime.
  2. Install the runtime to the runtime installation directory.

Build Options

cmake -G Ninja .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../install  
cmake -G Ninja .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=../install  
CC=gcc CXX=g++ cmake -G Ninja .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../install  
cmake -G Ninja .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=C:\libelf;C:\zlib -DCMAKE_INSTALL_PREFIX=../install  

Alternatively, specify header and library directories explicitly.

cmake -G Ninja .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INCLUDE_PATH=C:\libelf\include;C:\zlib\include -DCMAKE_LIBRARY_PATH=C:\libelf\lib;C:\zlib\lib -DCMAKE_INSTALL_PREFIX=../install  

Running Unit Tests

To run unit tests, execute the following command in the runtime build directory:

Notes

set PATH=C:\libelf\lib;C:\zlib\lib;%PATH%  
export AOCL_BOARD_PACKAGE_ROOT="$(git rev-parse --show-toplevel)/test/board/a10_ref"  

Switch to the directory containing the test executable:
Run the tests whose group and name contain the given substrings:

./acl_test -v -g acl_mem -n create_buffer  

Using the Runtime

With IntelⓇ FPGA SDK for OpenCL™ or IntelⓇ FPGA RTE for OpenCL™

Perform these steps if you have the IntelⓇ FPGA SDK for OpenCL™ or IntelⓇ FPGA RTE for OpenCL™ installed on your system:

  1. In the IntelⓇ FPGA SDK for OpenCL™ installation directory, source the initialization script.
    • On Linux:
    • On Windows:
  2. Update the /etc/OpenCL/vendors/Altera.icd file with either the filenamelibalteracl.so if LD_LIBRARY_PATH contains the full path of the runtime installation directory; otherwise, the full path of libalteracl.so itself.
  3. Compile your OpenCL host program with the OpenCL header files included from the runtime installation directory.
-Ifpga-runtime-for-opencl/install/include  
  1. Link your OpenCL host program with the libOpenCL.so library from the IntelⓇ FPGA SDK for OpenCL™ installation directory.
-L$INTELFPGAOCLSDKROOT/host/linux64/lib -lOpenCL  
  1. Run your OpenCL host program.

Without IntelⓇ FPGA SDK for OpenCL™ or IntelⓇ FPGA RTE for OpenCL™

Perform these steps if you do not have the IntelⓇ FPGA SDK for OpenCL™ or IntelⓇ FPGA RTE for OpenCL™ installed on your system:

  1. Download, build, and install theOpenCL ICD Loader.
  2. Create the /etc/OpenCL/vendors/Altera.icd file with either the filenamelibalteracl.so if LD_LIBRARY_PATH contains the full path of the runtime installation directory; otherwise, the full path of libalteracl.so itself.
  3. Compile your OpenCL host program with the OpenCL header files included from the runtime installation directory.
-Ifpga-runtime-for-opencl/install/include  
  1. Link your OpenCL host program with the libOpenCL.so library from the OpenCL ICD Loader.
  2. Run your OpenCL host program.

Debug Environment Variables

Environment Variable Title Description
ACL_DEBUG Set this variable to a value of 1 to 4 to output general-purpose debug messages from the OpenCL Runtime.
ACL_HAL_DEBUG Set this variable to a value of 1 to 5 to increase debug output from the hardware abstraction layer (HAL), which interfaces directly with the MMD layer.
ACL_CONTEXT_CALLBACK_DEBUG Set this variable to a value of 1 to produce error text for errors that occur in the OpenCL context. This is error text that would be sent upstream through a callback function provided with clCreateContext.

Notes