赞
踩
lspci | grep -i nvidia
显卡型号是GTX 960
nvidia-smi
说明显卡驱动还没有安装
ubuntu-drivers devices
按照推荐安装nvidia-driver-535 - distro的驱动
sudo ubuntu-drivers autoinstall
安装完毕后再输入nvidia-smi,即可查看GPU信息,说明显卡驱动安装完毕。如果出现了NVIDIA-SMI has failed because it couldn‘t communicate with the NVIDIA driver报错,可以尝试重启。
上图右上角的CUDA Version:12.2 说明该GPU支持的最大CUDA版本号为12.2。接下来需要从官网手动安装不大于该版本号的CUDA。
去nvidia官网下载cuda,接下来以11.8版本为例。
CUDA Toolkit 11.8 Downloads | NVIDIA Developer
得到安装命令如下:
- wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-ubuntu2204.pin
- sudo mv cuda-ubuntu2204.pin /etc/apt/preferences.d/cuda-repository-pin-600
- wget https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda-repo-ubuntu2204-11-8-local_11.8.0-520.61.05-1_amd64.deb
- sudo dpkg -i cuda-repo-ubuntu2204-11-8-local_11.8.0-520.61.05-1_amd64.deb
- sudo cp /var/cuda-repo-ubuntu2204-11-8-local/cuda-*-keyring.gpg /usr/share/keyrings/
- sudo apt-get update
- sudo apt-get -y install cuda
sudo gedit ~/.bashrc
source ~/.bashrc
nvcc -V
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。