DPU Shared Library - 1.2 English

Vitis AI User Guide (UG1414)

Document ID
UG1414
Release Date
2020-07-21
Version
1.2 English

Under some scenarios, DPU ELF files cannot 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, you can use the 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/2020.1/environment-setup-aarch64-xilinx-linux
aarch64-xilinx-linux-gcc \
--sysroot=$SDKTARGETSYSROOT \
-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.