Note: Open weblinks on this page by Right clicking and selecting “Open link in a new tab”
Update: DPU on PYNQ v2.5 with Vitis AI 1.1 support is now available!
Read the Announcement Here
Now participants can use this Vitis AI 1.1 based flow in lieu of the Vitis AI 1.0 build flow below
DPU on PYNQ v2.5 Ultra96v2 Image (Build Scripts Download link)
The following steps help users make their own DPU design work with Ultra96v2 PYNQ image v2.5. To do that, we need to first upgrade PYNQ v2.5 image to be compatible with Vitis AI 1.0. Then we will introduce the steps to rebuild the hardware design. Finally we will cover steps to run DPU applications on the Ultra96 v2 board.
We have the following assumptions:
To make sure the image is correct (image v2.5), run the following on the board:
This should show:
Step 1: Upgrade PYNQ Image on Ultra96v2
The first step is to upgrade your image so we can install some libraries required by Vitis AI.
On your Ultra96 board, run su to use superuser. Password is xilinx. Copy the ultra96 folder over to your board.
Go to the ultra96 folder, and run:
chmod 777 upgrade.sh
The upgrade process can take up to 4 hours so please be patient.
At the same time, you can proceed to the next few steps.
By default, the upgrade.sh script will install / update the following packages:
Users can also disable any of them by setting the option to 0.
Step 2: Build Hardware Design on Host
Note: You can skip this step and download pre-compiled files here
While your board is being upgraded, we can take a look at the hardware design.
On your host machine, copy the host folder over to your host.
Source proper Vitis 2019.2 settings. Go to the host folder, and run
chmod u+x build.sh
The above step can take up to 2 hours. Please be patient.
The build.sh does the following things:
The released Vitis AI TRD is good for ZCU102 and ZCU104. You can check what we have changed in build.sh for Ultra96 so that the DPU IP can be successfully implemented on our Vitis platform. In general, Ultra96 has a smaller PL, so we can only target smaller DPU's on this platform.
After the building process is done, you should see some messages indicating the building is successful. 3 overlay files will be copied to the folder dpu_overlay: dpu.hwh, dpu.bit, and dpu.xclbin.
Now you have the DPU overlay files which can work with PYNQ!
Keep those 3 files in good hands.
Note: As long as we have those 3 files, we are done; please do NOT replace PYNQ SD card content!
Step 3: Build DPU Models on Host
Note: You can download pre-compiled example model binaries here
On your host machine, go to your host folder. If you have already run the build.sh in the previous step, you should be able to see (1) a Vitis AI Github repository has been cloned here, and (2) the dpu.hwh file has been generated under dpu_overlay folder.
If you have not installed docker on your host machine, please refer to the Vitis AI getting started page to install docker. If you have docker already installed, we can run the following commands now.
cp -rf Vitis-AI/docker_run.sh .
The docker_run.sh will download a Vitis AI docker image.
It may take a long time since the image is about 8GB. After the download is complete, the docker_run.sh script will help you log onto that docker image. The Vitis AI docker image gives users access to the Vitis AI utilities and compilation tools. If you have run docker_run.sh before, it will simply launch the docker image without downloading again. Once you are in the docker environment, you can run the compile.sh script that we provided.
Users can also check this compile.sh and make some adjustments based on their needs. In summary, this script does the following things:
If everything is successful, you should see a screen as shown below.
A new model file dpu_resnet50_0.elf should appear in your local working directory; you can deploy this file on the Ultra96 board later.
After you are done with the docker environment, type in:
Step 4: Run Application on Ultra96v2
On your Ultra96 board, go to your jupyter notebook root folder, and run
Put the following files in this pynq-dpu folder:
After that, you can create a new Jupyter notebook file in the same folder; add and run the following code:
from dpu import DpuOverlay
And check the DPU information in a Jupyter notebook cell.
If you have compiled the dpu_resnet50_0.elf as introduced in Step 3, you can load it now:
Then you should be able to play with a couple of applications!
For example, you can try to rebuild and run the resnet50 application on Vitis AI Github. The basic steps are:
There are other applications and models that you can explore in the Vitis AI Github.
We list some of the useful references:
Submission Format: _____________________________________________________________________________________________________________________________
Please download the submission notebook and scripts here. The steps to run the submission scripts are in the README file in the download.