Vitis AI 环境搭建 & KV260 PYNQ 安装 & 要点总结

目录

[1. 环境](#1. 环境)

[2. 工具及版本介绍](#2. 工具及版本介绍)

[2.1 工具版本兼容性](#2.1 工具版本兼容性)

[2.2 DPU结构](#2.2 DPU结构)

[2.3 DPU命名规则](#2.3 DPU命名规则)

[3. Vitis AI 配置要点](#3. Vitis AI 配置要点)

[3.1 配置安装 Docker 库](#3.1 配置安装 Docker 库)

[3.2 Install Docker Engine](#3.2 Install Docker Engine)

[3.3 添加 Docker 用户组并测试](#3.3 添加 Docker 用户组并测试)

[3.4 克隆 Vitis AI 库](#3.4 克隆 Vitis AI 库)

[3.5 构建 Docker (直接抓取)](#3.5 构建 Docker (直接抓取))

[3.6 运行 Docker](#3.6 运行 Docker)

[3.7 安装 Jupyter Lab](#3.7 安装 Jupyter Lab)

[4. PYNQ for KV260 配置要点](#4. PYNQ for KV260 配置要点)

[4.1 烧录 Ubuntu 22.04 LTS](#4.1 烧录 Ubuntu 22.04 LTS)

[4.2 配置网络](#4.2 配置网络)

[4.3 关闭图形桌面](#4.3 关闭图形桌面)

[4.4 添加 AMD 软件源并更新升级 Kernel](#4.4 添加 AMD 软件源并更新升级 Kernel)

[4.5 配置 Docker (optional)](#4.5 配置 Docker (optional))

[4.6 安装 xrt zocl driver (optional)](#4.6 安装 xrt zocl driver (optional))

[4.7 安装 Pynq (需配置代理)](#4.7 安装 Pynq (需配置代理))

[4.8 Jupyter Lab 安装中文支持包](#4.8 Jupyter Lab 安装中文支持包)

[4.9 域名解析](#4.9 域名解析)


1. 环境

Host: Ubuntu 22.04.4 LTS

Embeded: kv260 with Ubuntu 22.04

AMD KV260 starts with Ubuntu 22.04 https://www.amd.com/zh-cn/products/system-on-modules/kria/k26/kv260-vision-starter-kit/getting-started-ubuntu/getting-started.html

2. 工具及版本介绍

GitHub - Xilinx/Vitis-AI at 2.5Vitis AI is Xilinx's development stack for AI inference on Xilinx hardware platforms, including both edge devices and Alveo cards. - GitHub - Xilinx/Vitis-AI at 2.5https://github.com/Xilinx/Vitis-AI/tree/2.5

2.1 工具版本兼容性

IP and Tool Version Compatibility --- Vitis™ AI 3.0 documentation

|-----------------------------------|----------------------|--------------------------|
| Software Tools Version | DPUCDZX8G IP Version | ViTis AI Release Version |
| Vivado / Vitis / Petalinux 2022.2 | 4.1 | v3.0 |
| Vivado / Vitis / Petalinux 2022.1 | 4 | v2.5 |
| Vivado / Vitis / Petalinux 2021.2 | 3.4 | v2.0 |
| Vivado / Vitis / Petalinux 2021.1 | 3.3 | v1.4 |
| Vivado / Vitis / Petalinux 2020.2 | 3.3 | v1.3 |
| Vivado / Vitis / Petalinux 2020.1 | 3.2 | v1.2 |
| Vivado / Vitis / Petalinux 2019.2 | 3.2 | v1.1 |
| Vivado / Vitis / Petalinux 2019.1 | 3.1 | v1.0 |
| Vivado / Petalinux 2019.1 | 3 | N/A |
| Vivado / Petalinux 2018.2 | 2 | N/A |
| Vivado / Petalinux 2018.1 | 1 | First Release |

PYNQ for Kria SOMs:

PYNQ for Kria SOMsPYNQ support and examples for Kria SOMs. Contribute to Xilinx/Kria-PYNQ development by creating an account on GitHub.https://github.com/Xilinx/Kria-PYNQ

DPU-PYNQ (v2.5)

This overlay contains a Vitis-AI 2.5.0 Deep Learning Processor Unit (DPU) and comes with a variety of notebook examples with pre-trained ML models.

Supported boards: KV260, KR260, KD240

从官方给的信息可以看出,KV260 PYNQ Installation 使用的是 Vitis-AI 2.5.0,对应的工具版本Vivado / Vitis / Petalinux 2022.1。

2.2 DPU结构

2.3 DPU命名规则

KV260使用DPUCZDX8G IP,表示:

应用领域:CNN

硬件平台:Zynq DDR

量化方法:decent

Decent:一种量化与优化工具,主要用于对神经网络模型进行压缩和量化,以适配于赛灵思的DPU硬件。Decent支持多种量化策略,包括定点量化(通常为INT8量化)。这种工具的目的是通过减小模型的存储与计算需求来优化执行效率,同时尽量保持推理精度。

Integer threshold:一种量化方法,使用整数阈值来确定量化的位宽和位置。

Float threshold:这种方法使用浮点数阈值来进行量化,与整数阈值类似,但使用的是浮点数。

RNN:循环神经网络(Recurrent Neural Network)的缩写,这是一种用于处理序列数据的神经网络结构,通常在量化时需要特别考虑,因为它们的时间依赖性。

量化精度:8 bit

设计目标:通用

3. Vitis AI 配置要点

3.1 配置安装 Docker 库

  1. sudo apt update
  2. sudo apt install ca-certificates curl gnupg
  3. sudo install -m 0755 -d /etc/apt/keyrings
  4. curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
  5. sudo chmod a+r /etc/apt/keyrings/docker.gpg
  6. echo "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  7. "(. /etc/os-release \&\& echo "VERSION_CODENAME")" stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
  8. sudo apt update

参考:Install Docker Engine on Ubuntu | Docker Docs

3.2 Install Docker Engine

  1. sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
  • docker-ce: 这是Docker社区版(Community Edition)的包名。
  • docker-ce-cli: 这是Docker社区版的命令行界面工具的包名,允许用户通过命令行与Docker交互。
  • containerd.io: 这是一个开源容器运行时,Docker用它来管理容器的生命周期。它负责镜像的传输和存储、容器的执行和监控以及任务的分配。
  • docker-buildx-plugin: 这是Docker的一个插件,允许用户通过使用Buildx构建功能,构建多平台镜像、利用缓存等高级构建功能。
  • docker-compose-plugin: 这是Docker Compose的插件,Docker Compose是一个用于定义和运行多容器Docker应用程序的工具。通过一个YAML文件来配置应用服务,然后使用一个单一的命令,就可以创建并启动所有的服务。

3.3 添加 Docker 用户组并测试

  1. sudo groupadd docker
  2. sudo usermod -aG docker $USER
  3. newgrp docker

运行:docker run hello-world,进行测试,打印 "hello world" 则成功。

3.4 克隆 Vitis AI 库

  1. git clone https://github.com/Xilinx/Vitis-AI/tree/2.5
  2. cd Vitis-AI

3.5 构建 Docker (直接抓取)

  1. docker pull xilinx/vitis-ai-cpu:latest

3.6 运行 Docker

  1. ./docker_run.sh xilinx/vitis-ai-cpu:latest
bash 复制代码
ubuntu@ubuntu:$ ./docker_run.sh xilinx/vitis-ai-cpu:latest
Setting up ubuntu's environment in the Docker container...
usermod: no changes
Running as vitis-ai-user with ID 0 and group 0 


==========================================
 
__      ___ _   _                   _____
\ \    / (_) | (_)            /\   |_   _|
 \ \  / / _| |_ _ ___ ______ /  \    | |
  \ \/ / | | __| / __|______/ /\ \   | |
   \  /  | | |_| \__ \     / ____ \ _| |_
    \/   |_|\__|_|___/    /_/    \_\_____|
 
==========================================

Docker Image Version: 2.5.0.1260   (CPU) 
Vitis AI Git Hash: 502703c 
Build Date: 2022-06-12

For TensorFlow 1.15 Workflows do:
     conda activate vitis-ai-tensorflow 
For PyTorch Workflows do:
     conda activate vitis-ai-pytorch 
For TensorFlow 2.8 Workflows do:
     conda activate vitis-ai-tensorflow2 
For WeGo Tensorflow 1.15 Workflows do:
     conda activate vitis-ai-wego-tf1 
For WeGo Tensorflow 2.8 Workflows do:
     conda activate vitis-ai-wego-tf2 
For WeGo Torch Workflows do:
     conda activate vitis-ai-wego-torch 
Vitis-AI /workspace > 

出现如上结果,表示启动docker成功,注意版本信息。

3.7 安装 Jupyter Lab

  • jupyter --version # 查看是否安装jupyterlab
bash 复制代码
jupyter --version
Selected Jupyter core packages...
IPython          : 8.12.2
ipykernel        : 6.23.3
ipywidgets       : 8.0.6
jupyter_client   : 8.3.0
jupyter_core     : 5.3.0
jupyter_server   : 2.6.0
jupyterlab       : not installed
nbclient         : 0.8.0
nbconvert        : 7.6.0
nbformat         : 5.9.0
notebook         : 6.5.4
qtconsole        : 5.4.3
traitlets        : 5.9.0
  1. pip install jupyterlab
  2. jupyter lab # 进入jupyterlab
  3. pip install jupyterlab-language-pack-zh-CN

4. PYNQ for KV260 配置要点

4.1 烧录 Ubuntu 22.04 LTS

烧录 Ubuntu 22.04 LTShttps://www.amd.com/zh-cn/products/system-on-modules/kria/k26/kv260-vision-starter-kit/getting-started-ubuntu/getting-started.html

4.2 配置网络

4.3 关闭图形桌面

  1. xmutil desktop_disable

4.4 添加 AMD 软件源并更新升级 Kernel

  1. sudo add-apt-repository ppa:xilinx-apps
  2. sudo add-apt-repository ppa:ubuntu-xilinx/sdk
  3. sudo apt update
  4. sudo apt upgrade

4.5 配置 Docker (optional)

  1. sudo groupadd docker
  2. sudo usermod -a -G docker $USER
  3. newgrp docker

4.6 安装 xrt zocl driver (optional)

  1. sudo apt install xrt-dkms

4.7 安装Pynq(需配置代理)

  1. git clone https://github.com/Xilinx/Kria-PYNQ.git
  2. cd Kria-PYNQ
  3. 需要修改install.sh文件
  4. sudo bash install.sh -b KV260

4.8 JupyterLab安装中文支持包

  1. pip install jupyterlab-language-pack-zh-CN

4.9 域名解析

  1. C:\Windows\System32\drivers\etc\hosts
  2. 添加:192.168.101.224 kria
相关推荐
FL162386312924 分钟前
AI健身体能测试之基于paddlehub实现引体向上计数个数统计
人工智能
黑客-雨27 分钟前
构建你的AI职业生涯:从基础知识到专业实践的路线图
人工智能·产品经理·ai大模型·ai产品经理·大模型学习·大模型入门·大模型教程
子午29 分钟前
动物识别系统Python+卷积神经网络算法+TensorFlow+人工智能+图像识别+计算机毕业设计项目
人工智能·python·cnn
千穹凌帝40 分钟前
SpinalHDL之结构(二)
开发语言·前端·fpga开发
大耳朵爱学习1 小时前
掌握Transformer之注意力为什么有效
人工智能·深度学习·自然语言处理·大模型·llm·transformer·大语言模型
TAICHIFEI1 小时前
目标检测-数据集
人工智能·目标检测·目标跟踪
qq_15321452641 小时前
【2023工业异常检测文献】SimpleNet
图像处理·人工智能·深度学习·神经网络·机器学习·计算机视觉·视觉检测
洛阳泰山1 小时前
如何使用Chainlit让所有网站快速嵌入一个AI聊天助手Copilot
人工智能·ai·llm·copilot·网站·chainlit·copliot
儿创社ErChaungClub1 小时前
解锁编程新境界:GitHub Copilot 让效率翻倍
人工智能·算法
乙真仙人1 小时前
AIGC时代!AI的“iPhone时刻”与投资机遇
人工智能·aigc·iphone