一:nvidia 查看显卡
nvidia-smi --query-gpu=gpu_name,gpu_bus_id --format=csv
二:nvidia-container-toolkit
##
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.repo | sudo tee /etc/yum.repos.d/nvidia-docker.repo
yum install -y nvidia-container-toolkit
yum install -y nvidia-docker2
systemctl restart docker
###
https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html#id5
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
&& curl -s -L https://nvidia.github.io/libnvidia-container/gpgkey | sudo apt-key add -
&& curl -s -L https://nvidia.github.io/libnvidia-container/$distribution/libnvidia-container.list | sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
sudo apt-get update
&& sudo apt-get install -y nvidia-container-toolkit
验证
sudo ctr image pull docker.io/nvidia/cuda:11.6.2-base-ubuntu20.04
sudo ctr run --rm -t \ --runc-binary=/usr/bin/nvidia-container-runtime \ --env NVIDIA_VISIBLE_DEVICES=all \ docker.io/nvidia/cuda:11.6.2-base-ubuntu20.04 \ cuda-11.6.2-base-ubuntu20.04 nvidia-smi
三:GPU使用技巧
Q3:下载tensorflow 对应版本镜像
#tensorflow 镜像
https://hub.docker.com/r/tensorflow/tensorflow/
docker pull tensorflow/tensorflow:1.5.0
docker pull tensorflow/tensorflow:1.5.0-gpu
Q2:验证GPU
lspci | grep -i nvidia
docker run --gpus all --rm nvidia/cuda:12.2.0-base-ubuntu22.04 nvidia-smi
Q1:安装指定tensorflow版本
lscpu 查看CPU是否支持avx 指令,1.6.0版本以上需要avx指令
https://tensorflow.google.cn/install/pip?hl=zh-cn
https://pypi.org/project/tensorflow/#files
https://tensorflow.google.cn/install/pip?skip_cache=true&hl=de
tensorflow-gpu==1.15:支持 GPU 的版本(适用于 Ubuntu 和 Windows)
pip3 install tensorflow-gpu==1.5.0
#tensorflow 镜像下载
https://hub.docker.com/r/tensorflow/tensorflow/
https://tensorflow.google.cn/install/docker?hl=zh-cn
https://tensorflow.google.cn/install/docker?hl=de&skip_cache=true#gpu_support
如:
docker pull tensorflow/tensorflow:2.1.0-gpu
微软资讯推荐
win10系统推荐
系统教程推荐