1.检查自己电脑支持的cuda
lhw@lhw-Dell-G15-5511:~$ nvidia-smi Wed Oct 20 00:00:21 2021 +-----------------------------------------------------------------------------+ | NVIDIA-SMI 470.63.01 Driver Version: 470.63.01 CUDA Version: 11.4 | |-------------------------------+----------------------+----------------------+ | 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 NVIDIA GeForce ... Off | 00000000:01:00.0 On | N/A | | N/A 49C P8 16W / N/A | 633MiB / 5938MiB | 16% Default | | | | N/A | +-------------------------------+----------------------+----------------------+ +-----------------------------------------------------------------------------+ | Processes: | | GPU GI CI PID Type Process name GPU Memory | | ID ID Usage | |=============================================================================| | 0 N/A N/A 988 G /usr/lib/xorg/Xorg 35MiB | | 0 N/A N/A 1586 G /usr/lib/xorg/Xorg 345MiB | | 0 N/A N/A 1724 G /usr/bin/gnome-shell 57MiB | | 0 N/A N/A 164717 G ...AAAAAAAAA= --shared-files 144MiB | | 0 N/A N/A 164726 G ...AAAAAAAAA= --shared-files 38MiB | +-----------------------------------------------------------------------------+
显示支持的cuda版本为11.4
2.去nvidia官网下载最新的cuda11.4.2
wget https://developer.download.nvidia.com/compute/cuda/11.4.2/local_installers/cuda_11.4.2_470.57.02_linux.run sudo sh cuda_11.4.2_470.57.02_linux.run
出来提示后,依次操作
1.是否接受EULA? 输入accept 2.cuda安装? 选择不安装驱动,其他默认安装install 直至安装完成
添加环境变量:
gedit ~/.bashrc
cuDNN Library for Linux (x86_64)