ref:https://github.com/Xilinx/Vitis-AI/tree/master/setup/vck5000
环境安装使用 此git 仓库中的 脚本安装: Vitis-AI,git clone 并check version。
1
2
cd ./setup/vck5000/
source ./install.sh
The following installation steps were performed in this script.
- Install XRT.
- Install XRM. The Xilinx Resource Manager (XRM) manages and controls FPGA resources on a machine. It is used by the runtime.
- Install the VCK5000-PROD Card Target Platform.
- Install DPU V4E xclbin for VCK5000-PROD.
主要步骤内容:
s1
获取系统版本 , 通过 /etc/os-release
文件获取当前系统发行版的版本,ubuntu 或 centos
s2
运行 install_xrt.sh 脚本,主要根据系统发行版指定 rpm或deb包的网络地址,并进行下载和安装对应包
1
2
3
4
5
6
7
8
9
10
# 脚本部分参考
XRT_URL="https://www.xilinx.com/bin/public/openDownload?filename=xrt_202120.2.12.427_18.04-amd64-xrt.deb"
XRT_INSTALLER=/tmp/xrt.deb
INSTALLER="apt"
# or
XRT_URL="https://www.xilinx.com/bin/public/openDownload?filename=xrt_202120.2.12.427_7.8.2003-x86_64-xrt.rpm"
XRT_INSTALLER=/tmp/xrt.rpm
INSTALLER="yum"
# install
wget $XRT_URL -O $XRT_INSTALLER && sudo ${INSTALLER} install $XRT_INSTALLER -y && rm $XRT_INSTALLER
自动安装后,可以粗略查看下,应为安装了以下包:
1
2
3
4
5
6
7
8
9
$ apt list --installed
#########################
xrt/now 2.8.0 amd64 [installed,local]
xrt-aws/now 2.8.0 amd64 [installed,local]
xrt-azure/now 2.8.0 amd64 [installed,local]
xrt-container/now 2.8.0 amd64 [installed,local]
# 可以查看包安装的具体内容:
$ dpkg -L xrt
补充:xrt的安装路径应该在 /opt/xilinx/xrt
s3
source XRT的环境:
1
source /opt/xilinx/xrt/setup.sh
用于设置 XRT的environment,主要就是导出环境变量,给xilinx工具配合使用。用户可以在shell中也方便使用XRT
1
2
3
4
export XILINX_XRT
export LD_LIBRARY_PATH=$XILINX_XRT/lib:$LD_LIBRARY_PATH
export PATH=$XILINX_XRT/bin:$PATH
export PYTHONPATH=$XILINX_XRT/python:$PYTHONPATH
s4
下载安装了一个应该是一个编译好的xclbin文件
1
2
3
4
5
6
7
XCLBIN_URL="https://www.xilinx.com/bin/public/openDownload?filename=DPUCVDX8H_xclbins_2_5_0.tar.gz"
XCLBIN_INSTALLER="/tmp/xclbins.tar.gz"
INSTALLER=tar
INSTALL_PATH=/
wget $XCLBIN_URL -O $XCLBIN_INSTALLER && sudo ${INSTALLER} -xzf $XCLBIN_INSTALLER --directory $INSTALL_PATH && rm $XCLBIN_INSTALLER
sudo ln -sf DPUCVDX8H /opt/xilinx/overlaybins/dpuv4e
s5
下载并安装了包中的内容,然后烧写了vck5000的卡,更新固件
1
2
3
4
5
6
7
8
9
DEPLOY_PLFM_URL="https://www.xilinx.com/bin/public/openDownload?filename=xilinx-vck5000-prod-gen3x16-platform-1-3_all.deb.tar.gz"
wget $DEPLOY_PLFM_URL -O shell.tgz
tar xfz shell.tgz
sudo apt install ./*sc-fw* -y
sudo apt install ./*validate* -y
sudo apt install ./*base* -y
# 更新flash
sudo /opt/xilinx/xrt/bin/xbmgmt flash --legacy --update --shell xilinx_vck5000_gen3x16_xdma_base_1
s6
下载并安装XRM 工具, The Xilinx Resource Manager (XRM) manages and controls FPGA resources on a machine. It is used by the runtime.
1
2
3
4
5
XRM_URL="https://www.xilinx.com/bin/public/openDownload?filename=xrm_202120.1.3.29_18.04-x86_64.deb"
XRM_INSTALLER=/tmp/xrm.deb
INSTALLER="apt"
wget $XRM_URL -O $XRM_INSTALLER && sudo ${INSTALLER} install $XRM_INSTALLER -y && rm $XRM_INSTALLER
安装完后:
1
2
$ apt list --installed
xrm/now 1.3.29 amd64 [installed,local]
部分log catch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
DKMS: install completed.
Finished DKMS common.postinst
Loading new XRT Linux kernel modules
Installing MSD / MPD daemons
Starting MPD daemon
XILINX_XRT : /opt/xilinx/xrt
PATH : /opt/xilinx/xrt/bin:/data/open_source/bitbake/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
LD_LIBRARY_PATH : /opt/xilinx/xrt/lib:
PYTHONPATH : /opt/xilinx/xrt/python:
Please flash card manually by running below command:
sudo /opt/xilinx/xrt/bin/xbmgmt program --base --device <bdf> --image xilinx_vck5000_gen3x16_xdma_base_1
To find <bdf>, run this command:
sudo /opt/xilinx/xrt/bin/xbmgmt examine
Starting XRM daemon
Enabling starting XRM daemon on boot
检查:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
$ sudo /opt/xilinx/xrt/bin/xbmgmt examine
System Configuration
OS Name : Linux
Release : 5.4.0-131-generic
Version : #147~18.04.1-Ubuntu SMP Sat Oct 15 13:10:18 UTC 2022
Machine : x86_64
CPU Cores : 20
Memory : 64070 MB
Distribution : Ubuntu 18.04.5 LTS
GLIBC : 2.27
Model : System Product Name
XRT
Version : 2.12.427
Branch : 2021.2
Hash : 2719b6027e185000fc49783171631db03fc0ef79
Hash Date : 2021-10-08 22:10:57
XOCL : 2.12.427, 2719b6027e185000fc49783171631db03fc0ef79
XCLMGMT : 2.12.427, 2719b6027e185000fc49783171631db03fc0ef79
Devices present
[0000:19:00.0] : xilinx_vck5000 mgmt(inst=6400)
$ sudo /opt/xilinx/xrt/bin/xbmgmt program --base --device 19:00.0 --image xilinx_vck5000_gen3x16_xdma_base_1
Device is up-to-date. No flashing to performed.
这里,XRT运行环境识别正确,vck5000设备也识别正确。
后补充
启动vitis-ai容器后,一定要设置对应的环境变量,否则有编译和运行错误。
1
2
3
4
5
6
7
8
9
10
11
# For 4PE 350Hz, you can select DPU IP via the following command.
source /workspace/setup/vck5000/setup.sh DPUCVDX8H_4pe_miscdwc
# For 6PE 350Hz with DWC, you can select DPU IP via the following command.
source /workspace/setup/vck5000/setup.sh DPUCVDX8H_6pe_dwc
# For 6PE 350Hz with MISC, you can select DPU IP via the following command.
source /workspace/setup/vck5000/setup.sh DPUCVDX8H_6PE_MISC
# For 8PE 350Hz, you can select DPU IP via the following command.
source /workspace/setup/vck5000/setup.sh DPUCVDX8H_8pe_normal
1
2
# 如在vitis-ai 容器中运行
Vitis-AI /workspace > source /workspace/setup/vck5000/setup.sh DPUCVDX8H_6pe_dwc