显卡驱动
https://www.bilibili.com/video/BV1Zc41137tU/?spm_id_from=333.999.0.0&vd_source=d75fca5b05d8be06d13cfffd2f4f7ab5
使用recommended的驱动,open和无open的区别在于无open更适合发挥NVIDIA显卡的全部功能和性能,特别是GPU加速计算等任务
https://www.nvidia.cn/content/DriverDownloads/confirmation.php?url=/XFree86/Linux-x86_64/530.41.03/NVIDIA-Linux-x86_64-530.41.03.run&lang=us&type=TITAN
(base) dell@dell-Precision-3630-Tower:~$ nvidia-detector
nvidia-driver-530
(base) dell@dell-Precision-3630-Tower:~$ lspci -v | grep -A 1 -i "VGA"
00:02.0 VGA compatible controller: Intel Corporation Device 3e9a (rev 02) (prog-if 00 [VGA controller])
DeviceName: Onboard - Video
--
01:00.0 VGA compatible controller: NVIDIA Corporation Device 2504 (rev a1) (prog-if 00 [VGA controller])
Subsystem: ASUSTeK Computer Inc. Device 881d
----------------------------------------------------------------------------
根据您提供的信息,您的计算机上有两个显卡:
Intel Corporation Device 3e9a (rev 02)(设备名称:Onboard - Video):这是一块集成的显卡,通常用于处理基本图形任务。
NVIDIA Corporation Device 2504 (rev a1)(子系统:ASUSTeK Computer Inc. Device 881d):这是一块独立的NVIDIA显卡,通常用于处理更复杂的图形任务,如游戏或图形设计。
请注意,Intel的显卡通常被用作计算机的集成显卡,而独立显卡(如NVIDIA或AMD显卡)通常用于提供更高性能的图形处理能力。
计算机上的NVIDIA显卡是"NVIDIA Corporation Device 2504 (rev a1)",型号是"GeForce RTX 3060"
**因此选择驱动是530
----------------------------------------------------------------------------
(base) dell@dell-Precision-3630-Tower:/home$ find . -name "NVIDIA*"
./dell/Downloads/NVIDIA-Linux-x86_64-530.41.03.run
./dell/Downloads/NVIDIA-Linux-x86_64-535.54.03.run
./dell/dell-bak/dell/baum/NVIDIA-Linux-x86_64-530.41.03.run
./dell/dell-bak/dell/Downloads/NVIDIA-Linux-x86_64-530.41.03.run
./dell/dell-bak/dell/Documents/NVIDIA Nsight Systems
./dell/dell-bak/dell/anaconda3/lib/python3.10/site-packages/cmake/data/share/cmake-3.25/Modules/Compiler/NVIDIA-DetermineCompiler.cmake
./dell/dell-bak/dell/anaconda3/lib/python3.10/site-packages/cmake/data/share/cmake-3.25/Modules/Compiler/NVIDIA-CUDA.cmake
./dell/dell-bak/dell/anaconda3/pkgs/cudnn-7.6.5.32-h01f27c4_1/info/licenses/NVIDIA_SLA_cuDNN_Support.txt
./dell/dell-bak/dell/anaconda3/pkgs/cudatoolkit-10.2.89-h713d32c_11/info/licenses/NVIDIA_EULA
./dell/dell-bak/dell/anaconda3/pkgs/cudatoolkit-10.2.89-h713d32c_11/info/recipe/NVIDIA_EULA
./dell/a/NVIDIA-Linux-x86_64-525.78.01.run
./dell/a/NVIDIA-Linux-x86_64-515.65.01.run**
修改驱动为530并且nvidia-smi显示
重启后的结果如下图
cuda
https://developer.nvidia.com/cuda-11-8-0-download-archive?target_os=Linux&target_arch=x86_64&Distribution=Ubuntu&target_version=20.04&target_type=runfile_local
https://www.bilibili.com/video/BV1bW4y197Mo/?spm_id_from=333.788.recommend_more_video.-1&vd_source=d75fca5b05d8be06d13cfffd2f4f7ab5
wget https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run
sudo sh cuda_11.8.0_520.61.05_linux.run
以上问题是因为以下这步没有把文件下载完全
wget https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run
需要路径
/nvme/cudaspace
vim ~/.bashrc
export TMPDIR=/nvme/cudaspace
export PATH=/usr/local/cuda-11.8/bin:${PATH}
export LD_LIBRARY_PATH=/usr/local/cuda-11.8/lib64:${LD_LIBRARY_PATH}
source ~/.bashrc
#最后结果
(base) dell@dell-Precision-3630-Tower:~$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Wed_Sep_21_10:33:58_PDT_2022
Cuda compilation tools, release 11.8, V11.8.89
Build cuda_11.8.r11.8/compiler.31833905_0
cudnn
https://developer.nvidia.com/rdp/cudnn-download
sudo apt-get install zlib1g
#下载安装包到download
sudo dpkg -i cudnn-local-repo-ubuntu2004-8.9.2.26_1.0-1_amd64.deb
sudo cp /var/cudnn-local-repo-ubuntu2004-8.9.2.26/cudnn-local-6D0A7AE1-keyring.gpg /usr/share/keyrings/
sudo apt-get update
(base) dell@dell-Precision-3630-Tower:~$ sudo apt-get install libcudnn8=8.9.2.26-1+cuda11.8
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
libcudnn8
0 upgraded, 1 newly installed, 0 to remove and 15 not upgraded.
Need to get 0 B/465 MB of archives.
After this operation, 1,162 MB of additional disk space will be used.
Get:1 file:/var/cudnn-local-repo-ubuntu2004-8.9.2.26 libcudnn8 8.9.2.26-1+cuda11.8 [465 MB]
Selecting previously unselected package libcudnn8.
(Reading database ... 207154 files and directories currently installed.)
Preparing to unpack .../libcudnn8_8.9.2.26-1+cuda11.8_amd64.deb ...
Unpacking libcudnn8 (8.9.2.26-1+cuda11.8) ...
Setting up libcudnn8 (8.9.2.26-1+cuda11.8) ...
(base) dell@dell-Precision-3630-Tower:~$ sudo apt-get install libcudnn8-dev=8.9.2.26-1+cuda11.8
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
libcudnn8-dev
0 upgraded, 1 newly installed, 0 to remove and 15 not upgraded.
Need to get 0 B/455 MB of archives.
After this operation, 1,348 MB of additional disk space will be used.
Get:1 file:/var/cudnn-local-repo-ubuntu2004-8.9.2.26 libcudnn8-dev 8.9.2.26-1+cuda11.8 [455 MB]
Selecting previously unselected package libcudnn8-dev.
(Reading database ... 207171 files and directories currently installed.)
Preparing to unpack .../libcudnn8-dev_8.9.2.26-1+cuda11.8_amd64.deb ...
Unpacking libcudnn8-dev (8.9.2.26-1+cuda11.8) ...
Setting up libcudnn8-dev (8.9.2.26-1+cuda11.8) ...
update-alternatives: using /usr/include/x86_64-linux-gnu/cudnn_v8.h to provide /usr/include/cudnn.h (libcudnn) in auto mode
(base) dell@dell-Precision-3630-Tower:~$ sudo apt-get install libcudnn8-samples=8.9.2.26-1+cuda11.8
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
libcudnn8-samples
0 upgraded, 1 newly installed, 0 to remove and 15 not upgraded.
Need to get 0 B/1,665 kB of archives.
After this operation, 2,169 kB of additional disk space will be used.
Get:1 file:/var/cudnn-local-repo-ubuntu2004-8.9.2.26 libcudnn8-samples 8.9.2.26-1+cuda11.8 [1,665 kB]
Selecting previously unselected package libcudnn8-samples.
(Reading database ... 207204 files and directories currently installed.)
Preparing to unpack .../libcudnn8-samples_8.9.2.26-1+cuda11.8_amd64.deb ...
Unpacking libcudnn8-samples (8.9.2.26-1+cuda11.8) ...
Setting up libcudnn8-samples (8.9.2.26-1+cuda11.8) ...
#验证安装成功
$cp -r /usr/src/cudnn_samples_v8/ $HOME
$cd $HOME/cudnn_samples_v8/mnistCUDNN
$make clean && make
#出现以下问题
base) dell@dell-Precision-3630-Tower:~/cudnn_samples_v8/mnistCUDNN$ make clean && make
rm -rf *o
rm -rf mnistCUDNN
CUDA_VERSION is 11080
Linking agains cublasLt = true
CUDA VERSION: 11080
TARGET ARCH: x86_64
HOST_ARCH: x86_64
TARGET OS: linux
SMS: 35 50 53 60 61 62 70 72 75 80 86 87 90
test.c:1:10: fatal error: FreeImage.h: No such file or directory
1 | #include "FreeImage.h"
| ^~~~~~~~~~~~~
compilation terminated.
>>> WARNING - FreeImage is not set up correctly. Please ensure FreeImage is set up correctly. <<<
[@] /usr/local/cuda/bin/nvcc -I/usr/local/cuda/include -I/usr/local/cuda/include -IFreeImage/include -ccbin g++ -m64 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_53,code=sm_53 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_62,code=sm_62 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_72,code=sm_72 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_86,code=sm_86 -gencode arch=compute_87,code=sm_87 -gencode arch=compute_90,code=sm_90 -gencode arch=compute_90,code=compute_90 -o fp16_dev.o -c fp16_dev.cu
[@] g++ -I/usr/local/cuda/include -I/usr/local/cuda/include -IFreeImage/include -o fp16_emu.o -c fp16_emu.cpp
[@] g++ -I/usr/local/cuda/include -I/usr/local/cuda/include -IFreeImage/include -o mnistCUDNN.o -c mnistCUDNN.cpp
[@] /usr/local/cuda/bin/nvcc -ccbin g++ -m64 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_53,code=sm_53 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_62,code=sm_62 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_72,code=sm_72 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_86,code=sm_86 -gencode arch=compute_87,code=sm_87 -gencode arch=compute_90,code=sm_90 -gencode arch=compute_90,code=compute_90 -o mnistCUDNN fp16_dev.o fp16_emu.o mnistCUDNN.o -I/usr/local/cuda/include -I/usr/local/cuda/include -IFreeImage/include -L/usr/local/cuda/lib64 -L/usr/local/cuda/lib64 -L/usr/local/cuda/lib64 -lcublasLt -LFreeImage/lib/linux/x86_64 -LFreeImage/lib/linux -lcudart -lcublas -lcudnn -lfreeimage -lstdc++ -lm
$sudo apt-get install libfreeimage3 libfreeimage-dev
$./mnistCUDNN
#以上输出为以下,则安装成功
...
Result of classification: 1 3 5
Test passed!