当前位置:   article > 正文

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

dpu pynq-z2

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*
  • 1
  • 2
  • 3
  • 4
  • 5
  • 替换sources.list加快更新速度
sudo vim /etc/apt/sources.list
  • 1

输入如下内容

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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 更新
sudo apt update
sudo apt upgrade -y
  • 1
  • 2
  • 安装依赖
# 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 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

安装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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15

测试环境

cd PYNQ-Z2/samples/resnet50
make
cd model
gcc -fPIC -shared dpu_resnet50_0.elf -o libdpumodelresnet50.so
sudo cp libdpumodelresnet50.so /usr/lib
  • 1
  • 2
  • 3
  • 4
  • 5
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/凡人多烦事01/article/detail/489916
推荐阅读
相关标签
  

闽ICP备14008679号