cuda安装
安装cuda
CUDA Toolkit Archive:https://developer.nvidia.com/cuda-toolkit-archive
wget https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda-repo-rhel7-11-8-local-11.8.0_520.61.05-1.x86_64.rpm
sudo rpm -i cuda-repo-rhel7-11-8-local-11.8.0_520.61.05-1.x86_64.rpm
sudo yum -y install nvidia-driver-latest-dkms
sudo yum -y install cuda
sudo yum clean all
# 查看板卡信息
lspci | grep -i nvidia
# 查看驱动程序是否安装
nvidia-smi
# 查看nvcc版本
nvcc --version
# 此时可能nvcc已经安装,但是没有配置环境变量
查看GPU加速CUDA是否生效
# 单次查看
nvidia-smi
# 监视查看
watch -n 10 nvidia-smi
docker支持nvidia gpu
# 主机安装docker
# 主机安装nvidia-container-toolkit
curl -s -L https://nvidia.github.io/libnvidia-container/centos7/libnvidia-container.repo | sudo tee /etc/yum.repos.d/nvidia-container-toolkit.repo
yum install -y nvidia-container-toolkit
# 配置docker运行时支持gpu
nvidia-ctk runtime configure --runtime=docker
# 命令行运行使容器支持gpu
docker run -itd --gpus all python:3.10.14