Intel® FPGA SDK for OpenCL™ Standard Edition: Getting Started Guide

ID 683678
Date 9/24/2018
Public
Document Table of Contents

2.6.4. 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. Link your host application to the libraries returned by the aocl linkflags utility command.
  3. Move the hello_world_emulation.aocx file to the current working directory so that the host can locate it easily.
  4. To run the host application for emulation, 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.
    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, that is, access to all physical boards is disabled.
  5. After you run the host application, unset the CL_CONTEXT_EMULATOR_DEVICE_INTELFPGA variable by invoking the set CL_CONTEXT_EMULATOR_DEVICE_INTELFPGA= command.
Each invocation of the emulated kernel creates a shared library copy called <process_ID>-libkernel.so in a default temporary directory, where <process_ID> is a unique numerical value assigned to each emulation run. You may override the default directory by setting the TMP or TEMP environment variable.