Re-Compile NPU IP Software Components#

By default, all NPU IP software components are built as PetaLinux recipes and included in the generated SD card image. If you need to recompile the NPU software components due to any changes, follow these steps:

  1. Download sdk-vai-2025.1.sh from the Vitis AI lounge and install it to the <dest_directory>.

  2. Source sysroot path if not done already:

    $ source <dest_directory>/environment-setup-cortexa72-cortexa53-xilinx-linux
    
  3. Build NPU Stack and sample application:

    $ cd <path_to_Vitis-AI>/src/vart_ml/zebra_embedded/
    $ make clean
    $ make
    $ make install-sdk    # This populates the Petalinux SDK sysroot which is exported in the environment with compiled libraries and headers. This is used when the   same SDK is used for compiling applications based on this repo.
    $ make install-tar    # This install rule compresses all installable components into a tar, which one can copy to the target and untar to place each component in their respective locations. `vart_ml_install.tar.gz` is generated in the current directory. Use the command `tar -xvf vart_ml_install.tar.gz -C /`
    
    • This generates all necessary shared objects and the simple CPP demo application in their respective folders.

    Note

    Currently, the zebra_embedded_py_api module is disabled from compilation due to issues while compiling against Petalinux, related to the required Python and binder dependencies.

  4. Copy the compiled components to the target board using the below commands. Ensure the target board is connected to Ethernet and has acquired an IP address.

    $ cd <path_to_Vitis-AI_source_code>/Vitis-AI/src/vart_ml/zebra_embedded/
    $ scp demo/npu_runner_demo root@<target_ip>:/usr/bin/
    $ scp zebra_embedded_utils/libzebra_embedded_utils.so root@<target_ip>:/usr/lib/
    $ scp zebra_embedded_c_api/libzebra_embedded_c_api.so root@<target_ip>:/usr/lib/
    $ scp zebra_embedded_io/libzebra_embedded_io.so root@<target_ip>:/usr/lib/
    

    After copying the compiled application (npu_runner_demo) and libraries to target board, refer to the Execute Sample Model for usage and sample commands of npu_runner_demo application to run the model.

    The npu_runner_demo application supports running multiple models in multiple threads within the same application context.

    Following is the example command to run multiple multiple models by using npu_runner_demo application.

    npu_runner_demo --imgPath /root/imagenet/ILSVRC2012_img_val/ --snapshot /run/media/mmcblk0p1/snapshot.$NPU_IP.resnet50.TF+/run/media/mmcblk0p1/snapshot.$NPU_IP.resnet50.TF --labels /etc/vai/labels/labels --goldFile /root/imagenet/ILSVRC_2012_val_GroundTruth_10p.txt  --nbImages 3
    

    You can provide multiple snapshots path with + sybmol as shown in above command.