DPU Shared Library - 1.1 English

Vitis AI User Guide (UG1414)

Document ID
Release Date
1.1 English

Under some scenarios, DPU ELF files can’t be linked together with the host code into the final hybrid executable, such as DPU applications programmed with Python. After Caffe or TensorFlow models are compiled into DPU ELF files, the users can use Arm® GCC toolchain to transform them into DPU shared libraries so that they stay separate with Vitis AI applications and work as expected.

For Vitis AI evaluation boards, a 64-bit Arm GCC toolchain can be used to produce the DPU shared library. The following command links the DPU ELF file for ResNet50 into the shared library.

aarch64-xilinx-linux-gcc -fPIC -shared \
dpu_resnet50_*.elf -o libdpumodelresnet50.so

For host machine environment , 64-bit Arm GCC cross-compilation toolchain can be used as follows:

source /opt/petalinux/2019.2/environment-setup-aarch64-xilinx-linux
aarch64-xilinx-linux-gcc \
-fPIC -shared dpu_resnet50_*.elf -o libdpumodelresnet50.so	

With dpu_resnet50_*.elf, the DPU ELF file dpu_resnet50_0.elf for ResNet50 model is wrapped into libdpumodelresnet50.so. For each model, all its DPU ELF files generated by VAI_C should be linked together into one unique DPU shared library in the naming format of libdpumodelModelName.so. For ResNet50, ModelName should be replaced with resnet50. If there are more than one network model used in a Vitis AI application, the users must create one DPU shared library for each of them.

Note: To deploy model with Vitis AI low level APIs, DPU shared libraries should be placed in the same folder with DPU applications or folder /lib/ or /usr/lib/ or /usr/local/lib/. Otherwise, Vitis AI low level dpuLoadKernel() API reports an error.