In the Vitis™ core development kit, host code is written in C or C++ language using the Xilinx® runtime (XRT) API or industry standard OpenCL™ API. The XRT native API is described on the XRT site at https://xilinx.github.io/XRT/master/html/xrt_native_apis.html. The Vitis core development kit supports the OpenCL 1.2 API as described at https://www.khronos.org/registry/OpenCL/specs/opencl-1.2.pdf. XRT extensions to OpenCL are described at https://xilinx.github.io/XRT/master/html/opencl_extension.html.
Tip: The code examples shown in
this text use the OpenCL C language API.
In general, the structure of the host code can be divided into three sections:
- Setting up the environment.
- Core command execution including executing one or more kernels.
- Post processing and release of resources.
Tip: The Vitis core development kit supports the OpenCL Installable Client Driver (ICD) extension (
cl_khr_icd
). This extension allows multiple implementations of OpenCL to co-exist on the same system. For details and
installation instructions, refer to OpenCL Installable Client Driver Loader.Note: For multithreading the host program,
exercise caution when calling a
fork()
system call from
a Vitis core development kit application. The
fork()
does not duplicate all the runtime threads.
Hence, the child process cannot run as a complete application in the Vitis core development kit. It is advisable to use the
posix_spawn()
system call to launch another process
from the Vitis software platform application.