To use the Xilinx runtime (XRT) environment properly, the software application needs to identify the accelerator card, or target platform, and the device ID that the kernel will run on. Then it needs to load the device binary (.xclbin) into the device to program the PL kernels.
The XRT API includes a Device class (
xrt::device
) that can be used to specify the device ID on the target
platform, and an XCLBIN class (xrt::xclbin
) that
defines the hardware and PL kernels for the runtime. You must use the following
#include
statement in your source code to load these classes:
#include <xrt/xrt_kernel.h>
The following code snippet creates a device object by specifying the device ID from the target platform, and then loads the .xclbin into the device, returning the UUID for the program.
//Setup the Environment
unsigned int device_index = 0;
std::string binaryFile = parser.value("kernel.xclbin");
std::cout << "Open the device" << device_index << std::endl;
auto device = xrt::device(device_index);
std::cout << "Load the xclbin " << binaryFile << std::endl;
auto uuid = device.load_xclbin(binaryFile);
Tip: The device ID can be obtained
using the
xbutil
command for a specific accelerator
card or hardware platform.