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

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

8.3. Emulating Your OpenCL Kernel

To emulate your OpenCL™ kernel, run the emulation .aocx file on the platform on which you build your kernel.

To emulate your kernel, perform the following steps:

  1. Run the utility command aocl linkflags to find out which libraries are necessary for building a host application. The software lists the libraries for both emulation and regular kernel compilation flows.
  2. Build a host application and link it to the libraries from Step 1.
    Attention: To emulate multiple devices alongside other OpenCL SDKs, link your host application to the Khronos ICD Loader Library before linking it to the host runtime libraries. Link the host application to the ICD Loader Library by modifying the Makefile for the host application. Refer to Linking Your Host Application to the Khronos ICD Loader Library for more information.
  3. If necessary, move the <your_kernel_filename>.aocx file to a location where the host can find easily, preferably the current working directory.
  4. To run the host application for emulation:
    • For Windows, first define the number of emulated devices by invoking the set CL_CONTEXT_EMULATOR_DEVICE_INTELFPGA=<number_of_devices> command and then run the host application.

      After you run the host application, invoke set CL_CONTEXT_EMULATOR_DEVICE_INTELFPGA= to unset the variable.

    • For Linux, invoke the env CL_CONTEXT_EMULATOR_DEVICE_INTELFPGA=<number_of_devices> <host_application_filename> command.
    This command specifies the number of identical emulation devices that the Emulator needs to provide.
    Remember: When the environment variable CL_CONTEXT_EMULATOR_DEVICE_INTELFPGA is set, only the emulated devices are available, i.e., access to all physical boards is disabled.
  5. If you change your host or kernel program and you want to test it, only recompile the modified host or kernel program and then rerun emulation.