Intel Acceleration Stack Quick Start Guide for Intel® Programmable Acceleration Card with Intel® Arria® 10 GX FPGA

ID 683633
Date 12/04/2020
Document Table of Contents

7.2.1. Running the Hello FPGA Example

The hello_fpga sample host application uses the OPAE library to test the hardware in native loopback mode (NLB). Load the FPGA with the nlb_mode_0 AFU image to run this example.

Run the following commands to test the hello_fpga sample host application:

  1. Run the following command to load the AFU image:
    sudo fpgasupdate $OPAE_PLATFORM_ROOT/hw/samples/nlb_mode_0/bin/\
  2. Configure the system hugepages to allocate 20, 2 MB hugepages that this utility requires. This command requires root privileges:
    sudo sh -c "echo 20 > /sys/kernel/mm/hugepages/\
  3. Compile the source code for hello_fpga located at $OPAE_PLATFORM_ROOT/sw/opae*/samples/hello_fpga.c:
  4. Extract the tar file:
    tar xf opae*.tar.gz
    Note: This step is only necessary if you installed the OPAE software from binaries. For more information, refer to section Installing the OPAE Software from Prebuilt Binaries.
  5. Move to the OPAE directory:
    cd opae*
  6. Compile the example:
    gcc -o hello_fpga -std=gnu99 -rdynamic \
    -ljson-c -luuid -lpthread -lopae-c -lm -Wl,-rpath \
    -lopae-c $OPAE_PLATFORM_ROOT/sw/opae*/samples/hello_fpga.c
    gcc -o hello_fpga -std=gnu99 -rdynamic \
    -ljson-c -luuid -lpthread -lopae-c -lm -Wl,--no-as-needed \
    -lopae-c -luuid $OPAE_PLATFORM_ROOT/sw/opae*/samples/hello_fpga.c
  7. To run the example, type the following command:
    Option Description
    For the OPAE RPM installation:
    sudo ./hello_fpga
    For an OPAE installation from source:
    sudo LD_LIBRARY_PATH=\
    $LD_LIBRARY_PATH:/<path to opae install>/\
    lib64 ./hello_fpga

    Sample output:

    Running Test
    Done Running Test
    For more information about the hello_fpga example, refer to the following files:
    • Source code located at $OPAE_PLATFORM_ROOT/sw/opae*/samples/hello_fpga.c
    • Native Loopback Accelerator Functional Unit (AFU) User Guide for AFU register descriptions.