Installation and Setup
Downloading Vitis AI Development Kit
The Vitis™ AI software is made available through Docker Hub. Vitis AI consists of the following two packages:
- Vitis AI tools docker xilinx/vitis-ai:latest
- Vitis AI runtime package for Edge
The tools container contains the Vitis AI quantizer, AI compiler, and AI runtime for cloud DPU. The Vitis AI runtime package for edge is for edge DPU development, which holds Vitis AI runtime installation package for Xilinx® evaluation boards and Arm® GCC cross-compilation toolchain.
Xilinx FPGA devices and evaluation boards supported by the Vitis AI development kit v1.4 release are:
- Cloud
- Alveo™ U200, U250, U280, U50, and U50LV Data Center accelerator cards
- Versal ACAP VCK5000 board
- Edge
- Zynq® UltraScale+™ MPSoC ZCU102 and ZCU104 evaluation boards
- Kria™ KV260 Vision AI starter kit
- Versal ACAP VCK190 board
Setting Up the Host
- Pre-built containers on Docker Hub: xilinx/vitis-ai
- Build containers locally with Docker recipes: Docker Recipes
Installing the Tools
- Install Docker, if Docker is not installed on your machine.
- Follow the Post-installation steps for Linux to ensure that your Linux user is in the group Docker.
- Clone the Vitis AI repository
to obtain the examples, reference code, and
scripts.
git clone --recurse-submodules https://github.com/Xilinx/Vitis-AI cd Vitis-AI
- Run Docker Container
Refer to https://github.com/Xilinx/Vitis-AI for the dedicated docker version number.
- Run the CPU image from Docker
Hub:
docker pull xilinx/vitis-ai:<x.y.z> ./docker_run.sh xilinx/vitis-ai
- Build the CPU image locally and run
it:
cd setup/docker ./docker_build_cpu.sh # After build finished cd .. ./docker_run.sh xilinx/vitis-ai-cpu:<x.y.z>
- Build the GPU image locally and run
it:
cd setup/docker ./docker_build_gpu.sh # After build finished cd .. ./docker_run.sh xilinx/vitis-ai-gpu:<x.y.z>
- Run the CPU image from Docker
Hub:
Setting Up the Host (Using VART)
For Edge
Use the following steps to set up the host for Edge:
- Install the cross-compilation system
environment.
cd Vitis-AI/setup/mpsoc/VART ./host_cross_compiler_setup.sh
Note: The ~/petalinux_sdk_2021.1 path is recommended for the installation. Regardless of the path you choose for the installation, make sure the path has read-write permissions. In this section, it is installed in ~/petalinux_sdk_2021.1.Note: The KV260 starter kit is based on the 2020.2 in VAI1.4.0. Use host_cross_compiler_setup_2020.2.sh to install the cross-compiler.Note: The VCK190 evaluation kit is based on the 2020.2 in VAI1.4.0. Use the following commands to install the cross-compiler.cd Vitis-AI/setup/vck190 ./host_cross_compiler_setup_2020.2.sh
- When the installation is complete, follow the prompts and enter the following
command.
source ~/petalinux_sdk_2021.1/environment-setup-cortexa72-cortexa53-xilinx-linux
Note: If you close the current terminal, you need to re-execute the above instructions in the new terminal to set up the environment. - Cross compile the sample taking resnet50 as an
example.
cd Vitis-AI/demo/VART/resnet50 bash –x build.sh
If the compilation process does not report any error and the executable file resnet50 is generated, then the host environment is installed correctly.
For Cloud
Use the following steps to set up the host for the Cloud. These steps apply to the Versal ACAP VCK5000 board and the Alveo U50, U50LV, U200, U250, and U280 cards.
- Start the Docker container. After the Docker image is loaded and running, the Vitis AI runtime is automatically installed in the docker system.
- Follow the instructions to set up the Alveo accelerator card here to install the XRT/XRM platform and the DPU xclbin file. For VCK5000 card, refer to here for setup.
- To use device 0 for the DPU, set export XLNX_ENABLE_DEVICES=0.
- To use device 0, device 1, and device 2 for the DPU, set export XLNX_ENABLE_DEVICES=0,1,2.
- By default, all available devices are used for the DPU if you do not set this environment variable.
For more information, see Answer Record 75975.
Setting Up the Evaluation Board
Setting Up the ZCU102/ZCU104/KV260/VCK190 Evaluation Board
The Xilinx ZCU102 evaluation board uses the mid-range ZU9 Zynq® UltraScale+™ MPSoC to enable you to jumpstart your machine learning applications. For more information on the ZCU102 board, see the ZCU102 product page on the Xilinx website: https://www.xilinx.com/ products/boards-and-kits/ek-u1-zcu102-g.html.
The main connectivity interfaces for ZCU102 are shown in the following figure.
The Xilinx ZCU104 evaluation board uses the mid-range ZU7 Zynq UltraScale+ device to enable you to jumpstart your machine learning applications. For more information on the ZCU104 board, see the Xilinx website: https://www.xilinx.com/products/boards-and-kits/zcu104.html.
The main connectivity interfaces for ZCU104 are shown in the following figure.
The KV260 Starter Kit is fully featured and optimized for the K26 SOM. Designed for Vision AI applications, the KV260 is the fastest way to develop unique solutions for production volume deployment with the K26 SOM. For more information on the KV260 board, see the KV260 product page on the Xilinx website: https://www.xilinx.com/ products/som/kria/kv260-vision-starter-kit.html.
The VCK190 kit is the first Versal AI Core series evaluation kit, enabling designers to develop solutions using AI and DSP engines capable of delivering over 100X greater compute performance than today's server-class CPUs.
With a range of connectivity options and standardized development flows, the VCK190 kit features the Versal AI Core series VC1902 device, providing the portfolio's highest AI inference and signal processing throughput.
For more information on the VCK190 board, see the VCK190 product page on the Xilinx website: https://www.xilinx.com/ products/boards-and-kits/vck190.html.
Flashing the OS Image to the SD Card
- For ZCU102, download from here
- For ZCU104, download from here
- For KV260, download from here
- For VCK190, download from here
- Download Etcher from: https://etcher.io/ and save the file
as shown in the following figure.
- Install Etcher, as shown in the following figure.
- Eject any external storage devices such as USB flash drives and backup hard disks. This makes it easier to identify the SD card. Then, insert the SD card into the slot on your computer, or into the reader.
- Run the Etcher program by double clicking on the Etcher icon shown in the
following figure, or select it from the Start menu.
Etcher launches, as shown in the following figure.
- Select the image file by clicking Select Image. You can select a .zip or .gz compressed file.
- Etcher tries to detect the SD drive. Verify the drive designation and the image size.
- Click Flash!.
Booting the Evaluation Board
- Connect the power supply (12V ~ 5A).
- Connect the UART debug interface to the host and other peripherals as required.
- Turn on the power and wait for the system to boot.
- Log in to the system.
- The system performs some configurations on the initial boot. Reboot the board for these configurations to take effect.
Accessing the Evaluation Board
There are three ways to access the ZCU102 board:
- UART port
- Ethernet connection
- Standalone
UART Port
Apart from monitoring the boot process and checking Linux kernel messages for debugging, you can log in to the board through the UART. The configuration parameters of the UART are shown in the following example. Log in to the system with username “root” and password “root.”
- baud rate: 115200 bps
- data bit: 8
- stop bit: 1
- no parity
Using the Ethernet Interface
The ZCU102 board has an Ethernet interface, and SSH service is enabled by default. You can log into the system using an SSH client after the board has booted.
Use the ifconfig
command via the UART
interface to set the IP address of the board, then use the SSH client to log into the
system.
Using the Board as a Standalone Embedded System
The ZCU102 board allows a keyboard, mouse, and monitor to be connected. After a successful boot, a Linux GUI desktop is displayed. You can then access the board as a standalone embedded system.
Installing Vitis AI Runtime on the Evaluation Board
To improve the user experience, the Vitis AI Runtime packages, VART samples, Vitis-AI-Library samples and models have been built into the board image. The examples are pre-compiled. Therefore, you do not need to install Vitis AI Runtime packages and model package on the board separately. However, you can still install the model or Vitis AI Runtime on your own image or on the official image by following these steps.
Establish an Ethernet connection and copy the Vitis™ AI runtime (VART) package from GitHub to the evaluation board. Then, set up a Vitis AI running environment for the ZCU102 board.
- Download the vitis-ai-runtime-1.4.x.tar.gz from here. Untar it and copy the following
files to the board using
scp.
tar -xzvf vitis-ai-runtime-1.4.x.tar.gz scp -r vitis-ai-runtime-1.4.x/aarch64/centos root@IP_OF_BOARD:~/
Note: You can take the rpm package as a normal archive, and extract the contents on the host side, if you only need some of the libraries. Only model libraries can be independent, while the others are common libraries. The operation command is as follows.rpm2cpio libvart-1.4.0-r<x>.aarch64.rpm | cpio -idmv
- Log in to the board using ssh. You can also use the serial port to log in.
- Install the Vitis AI runtime. Execute the
following commands in
order.
You can also execute the following command to install the library one by one.cd ~/centos bash setup.sh
cd ~/centos rpm -ivh --force libunilog-1.4.0-r<x>.aarch64.rpm rpm -ivh --force libxir-1.4.0-r<x>.aarch64.rpm rpm -ivh --force libtarget-factory-1.4.0-r<x>.aarch64.rpm rpm -ivh --force libvart-1.4.0-r<x>.aarch64.rpm rpm -ivh --force libvitis_ai_library-1.4.0-r<x>.aarch64.rpm
After the installation is complete, the Vitis AI Runtime library will be installed under /usr/lib.
Setting Up the Custom Board
Vitis AI supports the official ZCU102/ZCU104 as well as user-defined boards.
If you want to run Vitis AI on your custom board, follow these steps. Ensure that you complete a step before proceeding to the next step.
- Create the platform system of your custom board. For more information, see Vitis Unified Software Platform Documentation: Embedded Software Development (UG1400) and https://github.com/Xilinx/Vitis_Embedded_Platform_Source/tree/master/Xilinx_Official_Platforms.
- Integrate the DPU IP. See https://github.com/Xilinx/Vitis-AI/tree/master/dsa/DPU-TRD for more information.Note: After this step is completed, an sd_card directory and an sd_card.img image with DPU are created. For known issues, see Known issues.
- Install the dependent libraries of Vitis AI.
There are two ways to install the dependent libraries of Vitis AI. One is to rebuild the system by configuring PetaLinux and the other is to install the Vitis AI-dependent libraries online.
- To rebuild the system by configuring PetaLinux:To obtain the recipes of VAI1.4 and rebuild the system, refer to the PetaLinux Tools Documentation: Reference Guide (UG1144).Note: If you want to compile the example on the target, select the
packagegroup-petalinux-vitisai-dev
andpackagegroup-petalinux-self-hosted
and recompile the system. (The name of thepackagegroup-petalinux-vitisai-dev
option may change in future PetaLinux releases). - To install the Vitis AI-dependent
libraries online, execute
dnf install packagegroup-petalinux-vitisai
to complete the installation, as shown in the following code:root@xilinx-zcu104-2020_1:/media/sd-mmcblk0p1# dnf install packagegroup-petalinux-vitisai Last metadata expiration check: 1 day, 18:12:25 ago on Wed Jun 17 09:35:01 2020. Package packagegroup-petalinux-vitisai-1.0-r0.noarch is already installed. Dependencies resolved. Nothing to do. Complete!
Note: If you use this method, ensure that the board is connected to the Internet.For the latest installation commands, see https://github.com/Xilinx/Vitis-AI/tree/master/setup/mpsoc/VART#step2-setup-the-target.
This installs the latest version of VART on the system. The system image for Vitis AI is available.
- To rebuild the system by configuring PetaLinux:
- Flash the image to the SD card.
See Flashing the OS Image to the SD Card to flash the new image to the SD card.
- Update the Vitis AI Runtime libraries to
VAI1.4, if needed. To upgrade to Vitis AI
1.4, update the following library packages.
- libunilog
- libxir
- libtarget-factory
- libvart
- libvitis_ai_library
See Installing Vitis AI Runtime on the Evaluation Board to install the Vitis AI Runtime libraries.
After you install the Vitis AI Runtime, a vart.conf file is generated in the /etc directory. This contains the location of the dpu.xclbin file, as shown below. The Vitis AI examples fetch the dpu.xclbin file by reading the vart.conf file. If the dpu.xclbin file on your board is not in the same location as the default, change the dpu.xclbin path in the vart.conf file.root@xilinx-zcu102-2021_1:~# cat /etc/vart.conf firmware: /media/sd-mmcblk0p1/dpu.xclbin
Note: This step generates a system that can run the Vitis AI examples. - Run the Vitis AI examples. See Running Examples to run the Vitis AI examples.