louishsu@dl:~$ cat /proc/version Linux version 5.15.0-52-generic (buildd@lcy02-amd64-045) (gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #58~20.04.1-Ubuntu SMP Thu Oct 13 13:09:46 UTC 2022
查看系统位数
1 2
louishsu@dl:~$ uname -a Linux dl 5.15.0-52-generic #58~20.04.1-Ubuntu SMP Thu Oct 13 13:09:46 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
louishsu@dl:~$ nvidia-smi Sat Nov 19 17:55:20 2022 +-----------------------------------------------------------------------------+ | NVIDIA-SMI 515.76 Driver Version: 515.76 CUDA Version: 11.7 | |-------------------------------+----------------------+----------------------+ | 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 | | 0% 46C P3 62W / 350W | 1270MiB / 24576MiB | 19% Default | | | | N/A | +-------------------------------+----------------------+----------------------+ +-----------------------------------------------------------------------------+ | Processes: | | GPU GI CI PID Type Process name GPU Memory | | ID ID Usage | |=============================================================================| | 0 N/A N/A 1504 G /usr/lib/xorg/Xorg 686MiB | | 0 N/A N/A 1797 G /usr/bin/gnome-shell 275MiB | | 0 N/A N/A 2312 G ...AAAAAAAAA= --shared-files 241MiB | +-----------------------------------------------------------------------------+
然后安装CUDA,注意因为驱动已手动安装,不要再安装驱动了,在复选框取消勾选驱动
1 2 3 4 5 6 7 8 9 10 11 12 13
louishsu@dl:~$ sudo sh cuda_11.7.1_515.65.01_linux.run
... (协议等,省略若干字……)
- [ ] Driver [ ] 515.65.01 + [X] CUDA Toolkit 11.7 [X] CUDA Demo Suite 11.7 [X] CUDA Documentation 11.7 - [ ] Kernel Objects [ ] nvidia-fs Options Install
安装结束后,显示
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
louishsu@dl:~$ sudo sh cuda_11.7.1_515.65.01_linux.run [sudo] password for louishsu: =========== = Summary = ===========
Driver: Not Selected Toolkit: Installed in /usr/local/cuda-11.7/
Please make sure that - PATH includes /usr/local/cuda-11.7/bin - LD_LIBRARY_PATH includes /usr/local/cuda-11.7/lib64, or, add /usr/local/cuda-11.7/lib64 to /etc/ld.so.conf and run ldconfig as root
To uninstall the CUDA Toolkit, run cuda-uninstaller in /usr/local/cuda-11.7/bin ***WARNING: Incomplete installation! This installation did not install the CUDA Driver. A driver of version at least 515.00 is required for CUDA 11.7 functionality to work. To install the driver using this installer, run the following command, replacing <CudaInstaller> with the name of this run file: sudo <CudaInstaller>.run --silent --driver
Logfile is /var/log/cuda-installer.log
再将CUDA路径添加到.bashrc环境变量
1 2 3 4
# >>> cuda & cudnn >>> export PATH="/usr/local/cuda/bin:$PATH" export LD_LIBRARY_PATH="/usr/local/cuda/lib64:$LD_LIBRARY_PATH" # <<< cuda & cudnn <<<
如果CUDA编译器NVCC的版本查询指令nvcc -V能正确输出以下内容,则安装完成
1 2 3 4 5 6 7
louishsu@dl:~$ source .bashrc louishsu@dl:~$ nvcc -V nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2022 NVIDIA Corporation Built on Wed_Jun__8_16:49:14_PDT_2022 Cuda compilation tools, release 11.7, V11.7.99 Build cuda_11.7.r11.7/compiler.31442593_0