For Cloud (Alveo U50LV/U55C Cards, Versal VCK5000 Card) - For Cloud (Alveo U50LV/U55C Cards, Versal VCK5000 Card) - 2.5 English - UG1354

Vitis AI Library User Guide (UG1354)

Document ID
UG1354
Release Date
2022-06-15
Version
2.5 English
Set up the host on the Cloud by running the Docker image.
  1. Clone the Vitis AI repository.
    $ git clone --recurse-submodules https://github.com/Xilinx/Vitis-AI
    $ cd Vitis-AI
  2. Run the Docker container according to the instructions in the Docker installation guide.
    $ ./docker_run.sh -X xilinx/vitis-ai-cpu:<x.y.z>
    Note: A workspace folder is created by the Docker runtime system and is mounted in the /workspace folder of the Docker runtime system.
  3. Place the program, data, and other files to be developed in the workspace folder. After the Docker system starts, locate them in the /workspace folder of the Docker system.

    Do not put the files in any other path of the Docker system. They will be erased after you exit the Docker system.

  4. Select the model for your platform. You can find the download links for the latest models in the yaml files of the model in the Vitis-AI/model_zoo location.
    • If the /usr/share/vitis_ai_library/model folder does not exist, create it first.
      $ sudo mkdir -p /usr/share/vitis_ai_library/models
    • For DPUCAHX8H of the Alveo U50LV card, take resnet_v1_50_tf as an example.
      $ wget https://www.xilinx.com/bin/public/openDownload?filename=resnet_v1_50_tf-u50lv-DPUCAHX8H-r2.5.0.tar.gz -O resnet_v1_50_tf-u50lv-DPUCAHX8H-r2.5.0.tar.gz
      $ tar -xzvf resnet_v1_50_tf-u50lv-DPUCAHX8H-r2.5.0.tar.gz
      $ sudo cp resnet_v1_50_tf /usr/share/vitis_ai_library/models -r
  5. Download the cloud xclbin package from here. Untar it, select the Alveo data center accelerator card, and install it. For DPUCAHX8H, take U50lv as an example.
    $ sudo tar -xzvf alveo_xclbins_2_5_0.tar.gz -C /
    $ export XLNX_VART_FIRMWARE=/opt/xilinx/overlaybins/DPUCAHX8H/\
    dpu_DPUCAHX8H_10PE275_xilinx_u50lv_gen3x4_xdma_base_2.xclbin
  6. If there is more than one card installed on the server and you want to specify some cards to run the program, you can set XLNX_ENABLE_DEVICES to achieve this function. The following is the usage of XLNX_ENABLE_DEVICES:
    • export XLNX_ENABLE_DEVICES=0 --only use device 0 for DPU.
    • export XLNX_ENABLE_DEVICES=0,1,2 --select device 0, device 1, and device 2 to be used for DPU.
    • If you do not set this environment variable, use all devices for DPU, by default.
  7. To compile the library sample in the Vitis AI Library, take classification for example, execute the following command:
    $ cd /workspace/examples/Vitis-AI-Library/samples/classification
    $ bash -x build.sh

    The executable program is now produced.

  8. To modify the library source code, view, and modify them under /workspace/src/Vitis-AI-Library.

    Before compiling the Vitis AI Libraries, confirm the compiled output path. The default output path is $HOME/build.

    If you want to change the default output path, modify the build_dir_default in cmake.sh. Such as, change from build_dir_default=$HOME/build/build.${target_info}/${project_name} to build_dir_default=/workspace/build/build.${target_info}/${project_name}.

    Note: If you want to modify the build_dir_default, modify $HOME only.

    Execute the following command to build the libraries all at once:

    $ cd /workspace/src/Vitis-AI-Library
    $ ./cmake.sh --clean

    After compiling, you can find the generated Vitis AI Libraries under build_dir_default. If you want to change the compilation rules, check and change the cmake.sh in the library’s directory.