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

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

12.1.7. Using an OpenCL Library that Works with Simple Functions (Example 1)

Intel® provides an OpenCL™ library design example of a simple kernel that uses a library containing RTL implementations of three double-precision functions: sqrt, rsqrt, and divide.

The example1.tgz tar ball includes a library, a kernel, and a host system. The example1.cl kernel source file includes two kernels. The kernel test_lib uses library functions; the kernel test_builtin uses built-in functions. The host runs both kernels and then compares their outputs and runtimes. Intel® recommends that you use the same strategy to verify your own library functions.

To compile this design example, perform the following tasks:

  1. Obtain example1.tgz from the OpenCL Design Examples web page.
  2. Unpack it into a local directory.
  3. Follow the instructions in the README.html file, which is located in the top-level of the unpacked example.
    When you run the compiled host program, it should produce the following output:
    Loading example1.aocx ...
    Create buffers
    Generate random data for conversion...
    Enqueuing both library and builtin in kernels 4 times with global size 65536
    Kernel computation using library function took 5.35333 seconds
    Kernel computation using built-in function took 5.39949 seconds
    Reading results to buffers...
    Checking results...
    Library function throughput is within 5% of builtin throughput.
    PASSED