环境安装流程
Ubuntu 20.04 安装
- 下载镜像:ubuntu-20.04.6-desktop-amd64.iso
- 下载 rufus: 官网地址
- 制作USB启动盘
- 开机按 Delete 键进入 BIOS
- 启动项将首选项改为 USB 启动盘
- 重新启动进入安装程序- 选择 English- 有线网账号密码:psd- 选择 Mininal installation- 选择 Erase disk and install Ubuntu- 设置用户名密码是:psd
- 安装配置 ssh
sudoapt-get update
sudoaptinstall openssh-server
sudoapt-getinstallvimsudovim /etc/ssh/sshd_config
端口号修改为23321后保存,继续执行
sudo systemctl restart sshd
sudo ufw allow 23321
- 关闭自动锁屏:- 点击右上角 Settings- 点击 Privacy- 点击 Screen Lock- 关闭自动锁屏
CUDA 11.3 & cuDNN 安装
- 查看当前驱动
dpkg -l|grep nvidia
- 卸载原本的驱动并清理链接
sudoapt-get purge nvidia*
sudoapt autoremove
- 查询可用驱动
ubuntu-drivers devices
- 自动安装推荐的驱动
sudo ubuntu-drivers autoinstall
- 重启,然后验证驱动是否安装成功
sudo reboot
nvidia-smi
- 下载并运行 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
sudoaptinstall gcc
sudosh cuda_11.3.1_465.19.01_linux.run
- 只勾选 CUDA Toolkit 11.3,然后安装
- 添加环境变量
sudovim /etc/profile
exportCUDA_HOME=/usr/local/cuda-11.3
exportPATH=$PATH:$CUDA_HOME/bin
exportLD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/cuda-11.3/lib64
- 下载并安装 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
sudocp-r ./bin/* /usr/local/cuda-11.3/bin
sudocp-r ./lib/* /usr/local/cuda-11.3/lib64
- 验证是否安装成功
source /etc/profile
nvcc -V
nvidia-smi
docker & nvidia docker 安装
- 安装docker
sudoapt-getinstall-y docker.io
sudo systemctl start dockersudo systemctl enabledockerdocker version
- 安装 nvidia container toolkit
sudoapt-getinstallcurlwget https://download.docker.com/linux/ubuntu/gpg
sudo apt-key add gpg
vim installNvidiaContainer.sh
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)sudocurl-s-L https://nvidia.github.io/nvidia-docker/gpgkey |sudo apt-key add -
sudocurl-s-L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list |sudotee /etc/apt/sources.list.d/nvidia-docker.list
保存后执行
./installNvidiaContainer.sh
sudoapt-get update &&sudoapt-getinstall-y nvidia-container-toolkit
sudo systemctl restart dockerrm installNvidiaContainer.sh
- 创建多个新用户并添加docker用户组权限
cd ~
vim addUsers.sh
fornamein aifpga maomao yangyang lichangyv
doecho$nameuseradd-d /home/$name-m-s /bin/bash $nameecho$name:$name| chpasswd
usermod-aGdocker${name}# passwd --expire $nameecho"$user add successfuly"done
保存后执行
./addUsers.sh
Vitis & Vivado & Vitis HLS 安装
- 下载 Vitis 包并进入目录
- 配置 dash(键盘选择 No)
sudo dpkg-reconfigure dash
- 安装依赖包并执行安装程序
sudoapt-getinstall ocl-icd-libopencl1
sudoapt-getinstall opencl-headers
sudoapt-getinstall ocl-icd-opencl-dev
sudoaptinstall libstdc++6
sudoaptinstall libncurses5
sudoapt-getinstall libtinfo5
sudochmod +x xsetup
sudo ./xsetup
- 选择安装内容(需在本机使用图形界面操作)1. 选择 Vitis2. 选择以下内容(共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 Platforms3. 其他配置默认,然后等待安装完成
- 配置环境
sudovim /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
- 安装 USB 驱动
cd /tools/Xilinx/Vivado/2023.1/data/xicom/cable_drivers/lin64/install_script/install_drivers
sudo ./install_drivers
- 验证是否安装成功
source /etc/profile
vitis
vivado
vitis_hls
无论执行哪一个都有图形界面弹出
Vitis AI 安装
- 克隆 Vitis AI 仓库
cd ~
git clone https://github.com/Xilinx/Vitis-AI
- 构建基于 Pytorch-CUDA 的镜像
cd Vitis-AI/docker
./docker_build.sh -t gpu -f pytorch
- 验证是否安装成功
cd../
./docker_run.sh xilinx/vitis-ai-pytorch-gpu:3.5.0.001-a350fc104
本文转载自: https://blog.csdn.net/qq_51555843/article/details/135291035
版权归原作者 哈萨克斯坦的羊 所有, 如有侵权,请联系我们删除。
版权归原作者 哈萨克斯坦的羊 所有, 如有侵权,请联系我们删除。