Step 3: Running Software Emulation
- To compile the application for Software Emulation, run the
following
commands:
make all REPORT=estimate TARGETS=sw_emu DEVICES=xilinx_kcu1500_dynamic_5_0
The three files that should be generated are vadd (host executable), xclbin/krnl_vadd.sw_emu.xilinx_kcu1500_dynamic.xclbin (binary container), and a system estimate report. To double check, run anls
command in the directory and you should get the follow:[sdaccel@localhost vadd]$ ls Makefile README.md _xocc_compile_krnl_vadd_krnl_vadd.sw_emu.xilinx_kcu1500_dynamic.dir _xocc_link_krnl_vadd.sw_emu.xilinx_kcu1500_dynamic_krnl_vadd.sw_emu.xilinx_kcu1500_dynamic.dir description.json src system_estimate.xtxt vadd xclbin [sdaccel@localhost vadd ]$ ls xclbin/ krnl_vadd.sw_emu.xilinx_kcu1500_dynamic.xclbin krnl_vadd.sw_emu.xilinx_kcu1500_dynamic.xo
- To run the application in emulation, run the following
command:
emconfigutil --platform xilinx_kcu1500_dynamic_5_0 --nd 1
Theemconfigutil
tool generates a emconfig.json file which contains the information about the target device. However, from the Github repository, the makefile is how you will run it. Run this command:make check TARGETS=sw_emu DEVICES=xilinx_kcu1500_dynamic_5_0
Note: Make sure that theDEVICES
used in the original make is the same as what was used for compilationIn this flow, this will run the previous command, and also run the application.
-
If the application runs successfully, the following messages appear in the terminal:
[sdaccel@localhost vadd]$ make check TARGETS=sw_emu DEVICES=xilinx_kcu1500_dynamic_5_0 <install location>/SDx/2017.4/bin/emconfigutil --platform xilinx_kcu1500_dynamic_5_0 --nd 1 ****** configutil v2017.4 (64-bit) **** SW Build 2064444 on Sun Nov 19 18:07:27 MST 2017 ** Copyright 1986-2017 Xilinx, Inc. All Rights Reserved. INFO: [ConfigUtil 60-895] Target platform: <install location>/SDx/2017.4/platforms/xilinx_kcu1500_dynamic_5_0/xilinx_kcu1500_dynamic_5_0.xpfm emulation configuration file `emconfig.json` is created in current working directory ... platform Name: Intel(R) OpenCL Vendor Name : Xilinx platform Name: Xilinx Vendor Name : Xilinx Found Platform XCLBIN File Name: krnl_vadd INFO: Importing xclbin/krnl_vadd.sw_emu.xilinx_kcu1500_dynamic.xclbin Loading: 'xclbin/krnl_vadd.sw_emu.xilinx_kcu1500_dynamic.xclbin' Result Match: i = 0 CPU result = 0 Krnl Result = 0 Result Match: i = 1 CPU result = 3 Krnl Result = 3 Result Match: i = 2 CPU result = 6 Krnl Result = 6 Result Match: i = 3 CPU result = 9 Krnl Result = 9 Result Match: i = 4 CPU result = 12 Krnl Result = 12 Result Match: i = 5 CPU result = 15 Krnl Result = 15 ... Result Match: i = 1018 CPU result = 3054 Krnl Result = 3054 Result Match: i = 1019 CPU result = 3057 Krnl Result = 3057 Result Match: i = 1020 CPU result = 3060 Krnl Result = 3060 Result Match: i = 1021 CPU result = 3063 Krnl Result = 3063 Result Match: i = 1022 CPU result = 3066 Krnl Result = 3066 Result Match: i = 1023 CPU result = 3069 Krnl Result = 3069 TEST PASSED
- The application generates a profiling summary report called
sdaccel_profile_summary in the format
of CSV.You can convert this into a report shown in the Lab 1 profile summary and explore it in the SDx™ IDE. To do this, run the following command:This generates an sdaccel_profile_summary.xprf file. To view this report, open the SDx IDE, select File > Open File and click the file from the menu. The report is shown below.
[sdaccel@localhost vadd]$ sdx_analyze profile sdaccel_profile_summary.csv
Note: For viewing these reports, you do not need to use the workspace you previously used in Lab 1. You can use this command to create a workspace locally for viewing these reports:sdx -workspace ./lab2
. You may also need to close the Welcome Window to view the report.Figure: SDx Profile Summary in SDx GUI
Note: Software Emulation does not provide all the profiling information (data transfer between kernel and global memory). This information will be available in Hardware Emulation and System. - The System Estimate report (system_estimate.xtxt) is also generated. This is from the
--report switch used when compiling using
the xocc command.
Figure: SDx Makefile System Estimate
- If you want to generate additional reports you will need to set
either environment variables or create a file called sdaccel.ini with appropriate information and permissions. In this tutorial, you want to create the sdaccel.ini file in the vadd directory, and add the following contents:
[Debug] timeline_trace = true device_profile = true
Run the same command as before:make check TARGETS=sw_emu DEVICES=xilinx_kcu1500_dynamic_5_0
After the application completes, there is an additional timeline trace file called sdaccel_timeline_trace.csv. To view this trace report in the GUI, you need to convert the CSV file into a WDB file using this command:sdx_analyze trace sdaccel_timeline_trace.csv
As you did earlier, launch SDx IDE and using the File > Open File, locate the file: sdaccel_timeline_trace.wdb. You should get the report shown in the following figure:Figure: SDx Makefile Application Timeline GUI