DPU on PYNQ-Z2系列—3.1 部署DPU—配置运行环境

环境要求

Quick Way

xilinx-pynqz2-dpu3.0-PYNQv2.5.img
提取码:s2fe
直接把img烧写进SD卡上电即可在jupyter notebook下调用DPU进行编程。

步骤

烧写SD卡

balenaEtcher
烧写成功后将上一步生成的image.ub及BOOT.bin复制到SD卡的fat32分区,复制之前建议备份一下原来的文件。而后上电并确认IP地址,ssh到板子。

安装依赖

  • 更新vim
    国内源的vim有些问题,锁定vim相关的包避免出问题
# 将xilinx用户添加进vim
sudo su
echo "xilinx ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
exit
sudo apt-mark hold vim*
  • 替换sources.list加快更新速度
sudo vim /etc/apt/sources.list

输入如下内容

deb https://mirrors.geekpie.club/ubuntu-ports/ bionic main restricted universe multiverse
# deb-src https://mirrors.geekpie.club/ubuntu-ports/ bionic main main restricted universe multiverse
deb https://mirrors.geekpie.club/ubuntu-ports/ bionic-updates main restricted universe multiverse
# deb-src https://mirrors.geekpie.club/ubuntu-ports/ bionic-updates main restricted universe multiverse
deb https://mirrors.geekpie.club/ubuntu-ports/ bionic-backports main restricted universe multiverse
# deb-src https://mirrors.geekpie.club/ubuntu-ports/ bionic-backports main restricted universe multiverse
deb https://mirrors.geekpie.club/ubuntu-ports/ bionic-security main restricted universe multiverse
# deb-src https://mirrors.geekpie.club/ubuntu-ports/ bionic-security main restricted universe multiversesudo
  • 更新
sudo apt update
sudo apt upgrade -y
  • 安装依赖
# DNNDK C++环境需要google-glog
sudo apt install libgoogle-glog-dev -y
# DNNDK C++环境需要opencv3.1,3.3或3.4,但是ubuntu18.04默认的是opencv3.2,需要卸载掉opencv3.2才能继续安装
sudo apt remove libopencv-dev -y
# DNNDK安装Python环境需要pip
sudo apt install python-pip -y
# 目前DNNDK的Python API是基于Python2的,为了让jupyter notebook支持python2需要安装ipython kernel
sudo pip install ipykernel matplotlib==2.2.0 pillow -i https://pypi.tuna.tsinghua.edu.cn/simple 

安装DNNDK

mkdir rootfs
tar -xvf rootfs.tar.gz -C rootfs
mkdir -p /usr/local/lib
mkdir -p /usr/local/bin

# 手动将opencv3.3相关的库复制到/usr/lib下
sudo cp -r rootfs/usr/include/openc* /usr/include
sudo cp -d rootfs/usr/lib/libopencv* /usr/lib
sudo cp -d rootfs/usr/lib/libwebp* /usr/lib
sudo cp rootfs/usr/lib/pkgconfig/opencv.pc /usr/lib/pkgconfig

cd PYNQ-Z2
sudo chmod +x install.sh
sudo ./install.sh
sudo reboot

测试环境

cd PYNQ-Z2/samples/resnet50
make
cd model
gcc -fPIC -shared dpu_resnet50_0.elf -o libdpumodelresnet50.so
sudo cp libdpumodelresnet50.so /usr/lib
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐