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:

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

The following two options are available for installing the containers with the Vitis AI tools and resources.
  1. Pre-built containers on Docker Hub: xilinx/vitis-ai
  2. Build containers locally with Docker recipes: Docker Recipes

Installing the Tools

Use the following steps for installation:
  1. Install Docker, if Docker is not installed on your machine.
  2. Follow the Post-installation steps for Linux to ensure that your Linux user is in the group Docker.
  3. 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
  4. Run Docker Container

    Refer to https://github.com/Xilinx/Vitis-AI for the dedicated docker version number.

    1. Run the CPU image from Docker Hub:
      docker pull xilinx/vitis-ai:<x.y.z>
      ./docker_run.sh xilinx/vitis-ai
    2. 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>
    3. 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>

Setting Up the Host (Using VART)

For Edge

Use the following steps to set up the host for Edge:

  1. 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 
  2. 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.
  3. 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.

  1. Start the Docker container. After the Docker image is loaded and running, the Vitis AI runtime is automatically installed in the docker system.
  2. 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.
Note: If there is more than one card installed on the server and you want to specify some cards to run the program, set XLNX_ENABLE_DEVICES. It takes the following options:
  • 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.

Figure 1: Xilinx ZCU102 Evaluation Board and Peripheral Connections

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.

Figure 2: Xilinx ZCU104 Evaluation Board and Peripheral Connections

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.

IMPORTANT: In the following sections, ZCU102 is used as an example.

Flashing the OS Image to the SD Card

Download the system images from the following download links:
  • For ZCU102, download from here
  • For ZCU104, download from here
  • For KV260, download from here
  • For VCK190, download from here
Note: For flashing the SD card, use Etcher. It is a cross-platform tool for flashing OS images to SD cards, available for Windows, Linux, and Mac systems. The following example uses Windows.
  1. Download Etcher from: https://etcher.io/ and save the file as shown in the following figure.

  2. Install Etcher, as shown in the following figure.

  3. 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.
  4. 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.



  5. Select the image file by clicking Select Image. You can select a .zip or .gz compressed file.
  6. Etcher tries to detect the SD drive. Verify the drive designation and the image size.
  7. Click Flash!.

Booting the Evaluation Board

This example uses a ZCU102 board to illustrate how to boot a Vitis AI evaluation board. Follow these steps to boot the evaluation board.
  1. Connect the power supply (12V ~ 5A).
  2. Connect the UART debug interface to the host and other peripherals as required.
  3. Turn on the power and wait for the system to boot.
  4. Log in to the system.
  5. 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
Note: On a Linux system, you can use Minicom to connect to the target board directly; for a Windows system, a USB to UART driver is needed before connecting to the board through a serial port.

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.

  1. 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
  2. Log in to the board using ssh. You can also use the serial port to log in.
  3. Install the Vitis AI runtime. Execute the following commands in order.
    cd ~/centos
    bash setup.sh
    You can also execute the following command to install the library one by one.
    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.

  1. 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.
  2. 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.
  3. 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.

    1. 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 and packagegroup-petalinux-self-hosted and recompile the system. (The name of the packagegroup-petalinux-vitisai-dev option may change in future PetaLinux releases).
    2. 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.

  4. 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.

  5. 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.
  6. Run the Vitis AI examples. See Running Examples to run the Vitis AI examples.