Intel FPGA® OpenCL™ Design Example
OPRA FAST Parser

This readme file for the OPRA FAST Parser OpenCL Design Example contains information about the design example package. For more examples, please visit the Intel FPGA OpenCL Design Examples page.

Description

This example is a OPRA Fast parser kernel. It demonstrates:

The kernel parses incoming compressed OPRA Fast data from a UDP offload engine, and returns a subset of fields over ethernet with the UDP offload engine. An initial run is performed by reading and writing to memory for reference. The host program forks into two processes, which allows the host to send and receive data over UDP independently, and saturate the 10G link. See the included presentation for more information.

Software & Hardware Requirements

Requirement Version OpenCL KernelHost Program
Hardware
Compile
Emulation
Compile
HardwareEmulation
CompileRunCompileRun
Quartus Prime Design Software (Quartus II)16.1 or later
Intel(R) FPGA SDK for OpenCL(TM)16.1 or later
(either)
(either)
(either)
(either)
Intel(R) FPGA Runtime Environment for OpenCL(TM)16.1 or later
Network Board Support Package(1)16.1-compatible
Board Hardware-
gcc4.4.7 or later
GNU Make3.8.1 or later
10G Networking Hardware(2)-

Notes

  1. This example design requires a BSP that conforms the specifications of the Network Reference Platform. In particular, the BSP must expose a UDP input and output I/O channel with the interface of the PLDA quick user dataprogram protocol (QuickUDP) intellectual property (IP) core.
  2. In order to achieve 10G speeds, special hardware needs to be used in the host PC. The following hardware combination has been tested to run at 10G speeds:
    • Solarflare SFN5122F Ethernet Card
    • 2x Avago AFBR-709SMZ Transceivers
    • Mellanox MAM1Q00A-QSA Adaptors
    • Addon add-lc-lc-15m5om3 fiber optic cable

Package Contents

Path Description
opra_fast_parser/
OPRAFAST.pdf Detailed presentation about the application, compiler features and implementation.
Makefile Makefile for host program
bin/ Host data files, Host program, AOCX files
config.sh Script to setup the networking configuration
device/ OpenCL kernel files
opra_fast_parser.cl Top-level OpenCL kernel file
host/
inc/ Host include files
src/ Host source files

Additional Documentation

This presentation contains detailed information about this design:

  • Overview of the application
  • Compiler features, such as I/O channels and loop pipelining
  • Kernel and host implementation

Compiling the OpenCL Kernel

The top-level OpenCL kernel file is device/opra_fast_parser.cl.

To compile the OpenCL kernel, run:

aoc device/opra_fast_parser.cl -o bin/opra_fast_parser.aocx --board <board>

where <board> matches the board you want to target. The -o bin/opra_fast_parser.aocx argument is used to place the compiled binary in the location that the host program expects.

If you are unsure of the boards available, use the following command to list available boards:

aoc --list-boards

Compiling for Emulator

To use the emulation flow, the compilation command just needs to be modified slightly:

aoc -march=emulator device/opra_fast_parser.cl -o bin/opra_fast_parser.aocx --board <board>

Compiling the Host Program

To compile the host program, run:

make

The compiled host program will be located at bin/host.

Running the Host Program

Before running the host program, you should have compiled the OpenCL kernel and the host program. Refer to the above sections if you have not completed those steps.

To fully utilize the example design to demonstrate 10G link saturation, the special networking hardware described in the Requirements section needs to be installed and configured:

  1. Install the Solarflare NIC in the PC as documented by the vendor. Make sure the the card is installed in a PCIe slot capable of Gen2x8.
  2. Insert the Mellanox MAM1Q00A-QSA Adaptor into the first QSFP slot of the board. Connect the Avago AFBR-709SMZ Transceivers to the fibre optic cable, and use it to connect one end to the NIC SFP port to the FPGA.
  3. The UDP offload engine is configured with the IP 192.168.7.4, and sends to the IP 192.168.7.43 on the host PC.

To generate packets at 10G speeds, this demo relies on the Solarflare OpenOnload driver to accelerate transfers from the host. The OpenOnload driver can be found at http://www.openonload.org/.

The script bin/config.sh can be used to setup the correct IP addresses and configure the OpenOnload driver, but may need to be modified to configure the correct Ethernet interface. Replace eth2 in the script with the name of the Ethernet interface connected to the FPGA accelerator card.

To run the host program on hardware, execute:

EF_UDP_RCVBUF=200000 bin/host

By default, the host program will use UDP for kernel input and output. To fully saturate the 10G link, the onload driver is used and an environment variable to set a buffer size is needed.

Running with the Emulator

Prior to running the emulation flow, ensure that you have compiled the kernel for emulation. Refer to the above sections if you have not done so. Also, please set up your environment for emulation. Please see the Intel(R) FPGA SDK for OpenCL(TM) Programming Guide for more information.

When using the emulator, it is advised to use a smaller problem size than what would be used when running in hardware.

For this example design, the suggested emulation command is:

CL_CONTEXT_EMULATOR_DEVICE_ALTERA=1 bin/host -in=mem -out=mem -framecount=100

The emulation flow does not support I/O channels, so UDP input and output to the kernel is not supported. Instead, we configure the host program to use memory-based input and output.

Host Parameters

The general command-line for the host program is:

bin/host [-in=<udp|mem>] [-out=<udp|mem>] [-framecount=<#>]

where the parameters are:

Parameter Type Default Description
-in=<udp|mem> Optional udp Input source. One of "udp" or "memory".
-out=<udp|mem> Optional udp Output destination. One of "udp" or "memory".
-framecount=<#> Optional 1000000 Number of frames to send via UDP or to put into memory as input.

OpenCL Binary Selection

The host program requires a OpenCL binary (AOCX) file to run. For this example design, OpenCL binary files should be placed in the bin directory.

By default, the host program will look for a binary file in the following order (earlier pattern matches take priority):

  1. A file named opra_fast_parser.aocx.
  2. A file named opra_fast_parser_<board>_161.aocx, where <board> is the name of the board (as passed as the --board argument to aoc).

Release History

Example Version SDK Version Date Changes
1.2 16.0 June 2016
  • Fixed makefile.
1.1 14.1 December 2014
  • New readme documentation.
  • Provide suggested emulation-specific arguments.
1.0 14.0 July 2014
  • First release of example.

Legal

Copyright (C) 2013-2016 Altera Corporation, San Jose, California, USA. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to
whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

This agreement shall be governed in all respects by the laws of the State of California and
by the laws of the United States of America.

Trademarks

OpenCL and the OpenCL logo are trademarks of Apple Inc. used by permission by Khronos.

Product is based on a published Khronos Specification, and has passed the Khronos Conformance Testing Process. Current conformance status can be found at www.khronos.org/conformance.

Contacting Intel

Although we have made every effort to ensure that this design example works correctly, there might be problems that we have not encountered. If you have a question or problem that is not answered by the information provided in this readme file or the example's documentation, please contact Intel support (myAltera).