Intel® FPGA SDK for OpenCL™ Standard Edition: Programming Guide

ID 683342
Date 4/22/2019
Public
Document Table of Contents

7.5. Compiling a Kernel for a Specific FPGA Board (-board=<board_name>)

To compile your OpenCL™ kernel for a specific FPGA board, include the -board=<board_name> option in the aoc 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.

  1. 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>.

  2. 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.
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 -c -board=FPGA_board_1 <your_kernel_filename>.cl -o=<my_object_filename>_FPGA_board_1.aoco

  2. Invoke the following command to generate the .aocx file:

    aoc -board=FPGA_board_1 <your_object_filename>_FPGA_board_1.aoco -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