您现在的位置是:首页 >技术交流 >项目环境整理, 驱动,docker, 镜像网站首页技术交流

项目环境整理, 驱动,docker, 镜像

智障学AI 2024-06-14 17:20:20
简介项目环境整理, 驱动,docker, 镜像

1. 更新最新的Nvidia驱动

# 检查机器驱动建议
ubuntu-drivers devices

# 装12.0驱动
sudo apt install nvidia-driver-525

# 重启
sudo reboot
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 525.105.17   Driver Version: 525.105.17   CUDA Version: 12.0     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  Tesla T4            On   | 00000000:00:08.0 Off |                    0 |
| N/A   38C    P8     9W /  70W |      2MiB / 15360MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

2. Docker的安装官方版本

https://docs.docker.com/engine/install/ubuntu/

Set Up

# 删掉之前的docker
sudo apt-get remove docker docker-engine docker.io containerd runc

# Update the apt package index and install packages to allow apt to use a repository over HTTPS:
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg

# Add Docker’s official GPG key:
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg

# Use the following command to set up the repository:
echo 
  "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu 
  "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | 
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Install Docker Engine

# Update the apt package index:
sudo apt-get update

# To install the latest version, run:
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

# Verify that the Docker Engine installation is successful by running the hello-world image.
sudo docker run hello-world

安装nvidia cuda tookit

# 安装nvidia tookit
distribution=$(. /etc/os-release;echo $ID$VERSION_ID) 
      && curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg 
      && curl -s -L https://nvidia.github.io/libnvidia-container/$distribution/libnvidia-container.list | 
            sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | 
            sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list

sudo apt-get update
sudo apt-get install -y nvidia-container-toolkit

把docker加入User Group

 sudo usermod -aG docker $USER

sudo reboot

4. 拉取Pytorch训练的镜像

docker run --gpus all -it --name env_pyt_1.12 -v $(pwd):/app nvcr.io/nvidia/pytorch:22.03-py3 

5. 拉取TensorRT的镜像

docker run --gpus all -it --name env_trt -v $(pwd):/app nvcr.io/nvidia/tensorrt:22.08-py3

6. 拉取DeepStream的镜像

docker run --gpus all -v `pwd`:/app -p 8556:8554  --name deepstream_env -it nvcr.io/nvidia/deepstream:6.1.1-devel bash
风语者!平时喜欢研究各种技术,目前在从事后端开发工作,热爱生活、热爱工作。