当前位置: 首页>后端>正文

Xilinx Vitis AI安装步骤-包括Ubuntu、Docker安装

环境安装流程

Ubuntu 20.04 安装

  1. 下载镜像:ubuntu-20.04.6-desktop-amd64.iso
  2. 下载 rufus: 官网地址
  3. 制作USB启动盘
  4. 开机按 Delete 键进入 BIOS
  5. 启动项将首选项改为 USB 启动盘
  6. 重新启动进入安装程序
    • 选择 English
    • 有线网账号密码:psd
    • 选择 Mininal installation
    • 选择 Erase disk and install Ubuntu
    • 设置用户名密码是:psd
  7. 安装配置 ssh
sudo apt-get update
sudo apt install openssh-server
sudo apt-get install vim
sudo vim /etc/ssh/sshd_config

端口号修改为23321后保存,继续执行

sudo systemctl restart sshd
sudo ufw allow 23321
  1. 关闭自动锁屏:
    • 点击右上角 Settings
    • 点击 Privacy
    • 点击 Screen Lock
    • 关闭自动锁屏

CUDA 11.3 & cuDNN 安装

  1. 查看当前驱动
dpkg -l | grep nvidia
  1. 卸载原本的驱动并清理链接
sudo apt-get purge nvidia*
sudo apt autoremove
  1. 查询可用驱动
ubuntu-drivers devices
  1. 自动安装推荐的驱动
sudo ubuntu-drivers autoinstall
  1. 重启,然后验证驱动是否安装成功
sudo reboot
nvidia-smi
  1. 下载并运行 CUDA 11.3.1 安装程序
cd ~
wget https://developer.download.nvidia.com/compute/cuda/11.3.1/local_installers/cuda_11.3.1_465.19.01_linux.run
sudo apt install gcc
sudo sh cuda_11.3.1_465.19.01_linux.run
  1. 只勾选 CUDA Toolkit 11.3,然后安装
  2. 添加环境变量
sudo vim /etc/profile
export CUDA_HOME=/usr/local/cuda-11.3
export PATH=$PATH:$CUDA_HOME/bin
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/cuda-11.3/lib64
  1. 下载并安装 cuDNN 8.9.2.26
cd ~
wget https://developer.nvidia.com/downloads/compute/cudnn/secure/8.9.2/local_installers/11.x/cudnn-linux-x86_64-8.9.2.26_cuda11-archive.tar.xz
tar -xvf cudnn-linux-x86_64-8.9.2.26_cuda11-archive.tar.xz
cd cudnn-linux-x86_64-8.9.2.26_cuda11-archive
sudo cp -r ./bin/* /usr/local/cuda-11.3/bin
sudo cp -r ./lib/* /usr/local/cuda-11.3/lib64
  1. 验证是否安装成功
source /etc/profile
nvcc -V
nvidia-smi

docker & nvidia docker 安装

  1. 安装docker
sudo apt-get install -y docker.io
sudo systemctl start docker
sudo systemctl enable docker
docker version
  1. 安装 nvidia container toolkit
sudo apt-get install curl
wget https://download.docker.com/linux/ubuntu/gpg
sudo apt-key add gpg
vim installNvidiaContainer.sh
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
sudo curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
sudo curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list

保存后执行

./installNvidiaContainer.sh
sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit
sudo systemctl restart docker
rm installNvidiaContainer.sh
  1. 创建多个新用户并添加docker用户组权限
cd ~
vim addUsers.sh
for name in aifpga maomao yangyang lichangyv
do
    echo $name
    useradd -d /home/$name -m -s /bin/bash $name
    echo $name:$name | chpasswd
    usermod -aG docker ${name}
    # passwd --expire $name
    echo "$user add successfuly"
done

保存后执行

./addUsers.sh

Vitis & Vivado & Vitis HLS 安装

  1. 下载 Vitis 包并进入目录
  2. 配置 dash(键盘选择 No
sudo dpkg-reconfigure dash 
  1. 安装依赖包并执行安装程序
sudo apt-get install ocl-icd-libopencl1
sudo apt-get install opencl-headers
sudo apt-get install ocl-icd-opencl-dev
sudo apt install libstdc++6
sudo apt install libncurses5
sudo apt-get install libtinfo5
sudo chmod +x xsetup
sudo ./xsetup
  1. 选择安装内容(需在本机使用图形界面操作)
    1. 选择 Vitis
    2. 选择以下内容(共210.68GB)
      • Vitis Unified Software Platform
      • Vitis Model Composer
      • DocNav
      • Install devices for Alveo and edge acceleration platforms
      • Install Devices for Kria soMs and starter Kits
      • Devices for Custom Platforms
      • Engineering Sample Devices for Custom Platforms
    3. 其他配置默认,然后等待安装完成
  2. 配置环境
sudo vim /etc/profile
source /tools/Xilinx/Vivado/2023.1/settings64.sh
source /tools/Xilinx/Vitis/2023.1/settings64.sh
source /tools/Xilinx/Vitis_HLS/2023.1/settings64.sh
  1. 安装 USB 驱动
cd /tools/Xilinx/Vivado/2023.1/data/xicom/cable_drivers/lin64/install_script/install_drivers
sudo ./install_drivers
  1. 验证是否安装成功
source /etc/profile
vitis
vivado
vitis_hls

无论执行哪一个都有图形界面弹出

Vitis AI 安装

  1. 克隆 Vitis AI 仓库
cd ~
git clone https://github.com/Xilinx/Vitis-AI
  1. 构建基于 Pytorch-CUDA 的镜像
cd Vitis-AI/docker
./docker_build.sh -t gpu -f pytorch
  1. 验证是否安装成功
cd ../
./docker_run.sh xilinx/vitis-ai-pytorch-gpu:3.5.0.001-a350fc104

https://www.xamrdz.com/backend/3zc1944782.html

相关文章: