Developer Guide
Intel oneAPI DPC++/C++ Compiler Handbook for Intel FPGAs
A newer version of this document is available. Customers should click here to go to the newest version.
Compile and Emulate Your Design
To compile and emulate your FPGA kernel design, perform the following steps:
- Modify the host part of your program to declare the sycl::ext::intel::fpga_emulator_selector_v device selector. Use this selector when instantiating a device queue for enqueuing your FPGA device kernel. For more information, refer to Device Selectors for FPGA.
- Compile your design by including the -fintelfpga option in your icpx command to generate an executable.
- Run the resulting executable:
For Windows:
- Define the number of emulated devices by invoking the following command:
set CL_CONFIG_CPU_EMULATE_DEVICES=<number_of_devices>
- Run the executable.
- Invoke the following command to unset the variable:
set CL_CONFIG_CPU_EMULATE_DEVICES=
- Define the number of emulated devices by invoking the following command:
For Linux, invoke the following command:
env CL_CONFIG_CPU_EMULATE_DEVICES=<number_of_devices> <executable_filename>
This command specifies the number of identical emulation devices that the emulator must provide.
TIP:If you want to use only one emulator device, you need not set the CL_CONFIG_CPU_EMULATE_DEVICES environment variable.
- The emulator is built with GCC 7.4.0 as part of the Intel® oneAPI DPC++/C++ Compiler. When running the executable for an emulated FPGA device, the version of libstdc++.so must be at least that of GCC 7.4.0. In other words, the LD_LIBRARY_PATH environment variable must ensure that the correct version of libstdc++.so is found.
If the correct version of libstdc++.so is not found, the call to clGetPlatformIDs function fails to load the FPGA emulator platform and returns CL_PLATFORM_NOT_FOUND_KHR (error code -1001). Depending on which version of libstdc++.so is found, the call to clGetPlatformIDs may succeed, but a later call to the clCreateContext function may fail with CL_DEVICE_NOT_AVAILABLE (error code -2).
If the LD_LIBRARY_PATH does not point to a compatible libstdc++.so, use the following syntax to invoke the host program:
env LD_LIBRARY_PATH=<path to compatible libstdc++.so>:$LD_LIBRARY_PATH <executable> [executable arguments]