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

7.6. Compiling a Kernel for a Specific FPGA Board and Custom Platform (-board=<board_name>) and (-board-package=<board_package_path>)

To compile your OpenCL™ kernel for a specific FPGA board, include the -board=<board_name> option in the aoc command.
Warning: During intermediate compilation with the -rtl flag, if you compile a kernel1.cl file for board X (that is, -board=X) and a kernel2.cl file for board Y (that is, -board=Y), the Intel® FPGA SDK for OpenCL™ Offline Compiler issues an error and exits when you run the aoc -rtl kernel1.aoco kernel2.aoco command.

When you compile your kernel by including the -board=<board_name> option in the aoc command, the Intel® FPGA SDK for OpenCL™ Offline Compiler defines the preprocessor macro AOCL_BOARD_<board_name> to be 1, which allows you to compile device-optimized code in your kernel.

  • To obtain the names of the available FPGA boards in your Custom Platform, invoke the aoc -list-boards command.
    For example, the offline compiler generates the following output:
    Board List:
    FPGA_board_1

    where FPGA_board_1 is the <board_name>.

    You can also list out all the available FPGA boards from a specific Custom Platform. Include the -board-package=<custom_platform_path> option in the aoc command. At the command prompt, invoke the following command:

    aoc –board-package=<custom_platform_path> -list-boards=<board_name>

    The Intel® FPGA SDK for OpenCL™ Offline Compiler lists the available boards within the specific Custom Platform.

  • To compile your OpenCL kernel for FPGA_board_1, invoke the aoc -board=FPGA_board_1 <your_kernel_filename>.cl command.
    The offline compiler defines the preprocessor macro AOCL_BOARD_FPGA_board_1 to be 1 and compiles kernel code that targets FPGA_board_1.
  • If there are multiple Custom Platforms (board packages) installed, you can compile your kernel with the board variant from a specific Custom Platform by including -board-package=<custom_platform_path> option with -board=<board_name>. At the command prompt, invoke the following command:
    aoc -board-package=<custom_platform_path> -board=<board_name>

    The Intel® FPGA SDK for OpenCL™ Offline Compiler compiles the kernel with the board specified in the <custom_platform_path>.

  • To list Custom Platforms available in the system, include the -list-board-packages option in the aoc command. At a command prompt, invoke the aoc -list-board-packages command. The Intel® FPGA SDK for OpenCL™ Offline Compiler generates an output that resembles the following:
    Installed board packages:
    <board_package_1>
    ...
    

    Where <board_package_N> is the board package of the Custom Platform installed in your system or shipped within the Intel® FPGA SDK for OpenCL™ .

Tip:

To readily identify compiled kernel files that target a specific FPGA board, Intel® recommends that you rename the kernel binaries by including the -o option in the aoc command.

  • To target your kernel to FPGA_board_1 in the one-step compilation flow, invoke the following command:
    aoc -board=FPGA_board_1 <your_kernel_filename>.cl -o <your_executable_filename>_FPGA_board_1.aocx
  • To target your kernel to FPGA_board_1 in the multistep compilation flow, perform the following tasks:

    1. Invoke the following command to generate the .aoco file:
      aoc -rtl -board=FPGA_board_1 <your_kernel_filename>.cl -o <my_object_filename>_FPGA_board_1.aocr -save-temps
    2. Invoke the following command to generate the .aocx file:
      aoc -board=FPGA_board_1 <your_object_filename>_FPGA_board_1.aocr -o <your_executable_filename>_FPGA_board_1.aocx
  • If you have an accelerator board consisting of two FPGAs, each FPGA device has an equivalent "board" name (for example, board_fpga_1 and board_fpga_2). To target a kernel_1.cl to board_fpga_1 and a kernel_2.cl to board_fpga_2, invoke the following commands:
    aoc -board=board_fpga1 kernel_1.cl
    aoc -board=board_fpga2 kernel_2.cl