参考视频 Bili
参考blog CSDN
安装的版本为vitis ai 3.0
特别鸣谢ChatGPT

启动docker获得的报错

走完上述步骤后,启动docker

./docker_run.sh xilinx/vitis-ai-pytorch-gpu:latest

报错如下:

Error response from daemon: pull access denied for xilinx/vitis-ai-pytorch-gpu, repository does not exist or may require 'docker login': denied: requested access to the resource is denied

==========
== CUDA ==
==========

CUDA Version 11.3.1

Container image Copyright (c) 2016-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.

This container image and its contents are governed by the NVIDIA Deep Learning Container License.
By pulling and using the container, you accept the terms and conditions of this license:
https://developer.nvidia.com/ngc/nvidia-deep-learning-container-license

A copy of this license is made available in this container at /NGC-DL-CONTAINER-LICENSE for your convenience.

Setting up qhy 's environment in the Docker container...
usermod: no changes
Running as vitis-ai-user with ID 0 and group 0 

bash: /usr/local/bin/gosu: No such file or directory

这里的第一个ERROR是由于docker pull导致的,由于gpu的image是自己生成的,所以不需要docker pull,所以需要把docker_run.sh中的docker pull注释掉

touch .confirm 
# docker pull $IMAGE_NAME 
if [[ $IMAGE_NAME == *"gpu"* ]]; then

第二个错误是没有安装gosu,这个首先需要进入docker,需要把docker_run.sh中的执行终端都改为sh。共有三处需要修改

#!/bin/sh
# Copyright 2022 Xilinx Inc.

DEFAULT_COMMAND="sh"

if [[ $# -gt 0 ]]; then
  shift 1;
  DEFAULT_COMMAND="$@"
  if [[ -z "$1" ]]; then
    DEFAULT_COMMAND="sh"
  fi
fi

改完之后再执行

./docker_run.sh xilinx/vitis-ai-pytorch-gpu:latest

就能够进入sh的终端,这个时候再手动安装gosu即可使用bash。

安装GOSU

❯ ./docker_run.sh xilinx/vitis-ai-pytorch-gpu:latest

==========
== CUDA ==
==========

CUDA Version 11.3.1

Container image Copyright (c) 2016-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.

This container image and its contents are governed by the NVIDIA Deep Learning Container License.
By pulling and using the container, you accept the terms and conditions of this license:
https://developer.nvidia.com/ngc/nvidia-deep-learning-container-license

A copy of this license is made available in this container at /NGC-DL-CONTAINER-LICENSE for your convenience.


执行

GOSU_VERSION=1.12
wget -O gosu "https://github.com# /tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)"
wget -O gosu.asc "https://github.com/tianon/gosu/releases/download/$GO--2023-05-18 01:46:09--  https://github.com/tianon/gosu/releases/download/1.12/gosu-amd64
SU_VERSION/gosu-$(dpkg --print-architecture).asc"

输出如下

  1. 从 GitHub 下载 Gosu 的二进制文件和签名文件。首先,找到要下载的版本号。可以在 Gosu 的发布页面上找到。假设你要下载的版本号是1.12,那么你可以运行以下命令来下载它:
GOSU_VERSION=1.12
wget -O gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)"
wget -O gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc"

  1. 导入 Gosu 的 GPG 密钥。运行以下命令:
    export GNUPGHOME="$(mktemp -d)" gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4
  1. 验证下载的 Gosu 二进制文件。运行以下命令:
gpg --batch --verify gosu.asc gosu

如果该命令的输出表示签名是有效的,那么 Gosu 二进制文件就是安全的。

  1. 给下载的 Gosu 二进制文件赋予可执行权限,然后将其移动到 /usr/local/bin,这样所有用户都可以使用它。运行以下命令:
chmod +x gosu sudo mv gosu /usr/local/bin
  1. 清理你在步骤4中创建的临时GPG目录。运行以下命令:
rm -r "$GNUPGHOME"
  1. 测试 Gosu 是否正确安装。运行以下命令:
gosu root id

你应该会看到关于 root 用户的信息,这表明 Gosu 已经正确安装了。

执行

bash

得到如下输出


Setting up xxx 's environment in the Docker container...
usermod: no changes
Running as vitis-ai-user with ID 0 and group 0 


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

Docker Image Version: latest   (GPU) 
Vitis AI Git Hash: 2057c588c 
Build Date: 2023-05-18
WorkFlow: pytorch

vitis-ai-user@spin3090:/workspace$ conda activate vitis-ai-pytorch
Logo

GitCode 天启AI是一款由 GitCode 团队打造的智能助手,基于先进的LLM(大语言模型)与多智能体 Agent 技术构建,致力于为用户提供高效、智能、多模态的创作与开发支持。它不仅支持自然语言对话,还具备处理文件、生成 PPT、撰写分析报告、开发 Web 应用等多项能力,真正做到“一句话,让 Al帮你完成复杂任务”。

更多推荐