Check if the graphics card driver is installed
Check whether the NVIDIA graphics card is installed
lspci | grep -i nvidia
View graphics card information
nvidia-smi
drive?
If there is no driver, then you need to manually install the graphics card driver.
First add the source:
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update
Check for installable drivers:
ubuntu-drivers devices
sudo apt install nvidia-driver-XXX
The installation system recommends which
sudo ubuntu-drivers autoinstall
reboot.
Install CUDA
https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html
https://developer.nvidia.com/cuda-downloads
install cudnn
way 1
This method is not suitable for installation under "update-alternatives".
https://docs.nvidia.com/deeplearning/cudnn/install-guide/index.html#install-linux
https://developer.nvidia.com/rdp/cudnn-download
sudo dpkg -i cudnn-local-repo-ubuntu2004-8.9.2.26_1.0-1_amd64.deb
The program will be unpacked to the var directory
cd /var/cudnn-local-repo-ubuntu2004-8.9.2.26
sudo dpkg -i libcudnn8_8.9.2.26-1+cuda12.1_amd64.deb libcudnn8-dev_8.9.2.26-1+cuda12.1_amd64.deb libcudnn8-samples_8.9.2.26-1+cuda12.1_amd64.deb
uninstall deb file
Uninstall in turn
sudo dpkg -r libcudnn8-samples
sudo dpkg -r libcudnn8-dev
sudo dpkg -r libcudnn8
Install and uninstall deb files on ubuntu
Install the software via the deb package:
sudo dpkg -i package_file.deb
Uninstall:
sudo dpkg -r package_name
Note that when uninstalling, it is the package name corresponding to package_file.deb
If you don't know the package name, you can pass
dpkg -l search, if you want to find the corresponding package, you can add wildcards, such as searching for packages containing fox
dpkg -l *fox*
But here it is not suitable for libcudnn8, don't know why.
dpkg -l *libcudnn8
dpkg -l libcudnn8
Once found, you can run
dpkg -r package_name
uninstall
way 2
Install under "update-alternatives".
Unzip:
tar -xvJf cudnn-linux-x86_64-8.9.3.28_cuda12-archive.tar.xz
copy:
sudo cp cudnn-linux-x86_64-8.9.3.28_cuda12-archive/include/cudnn* /usr/local/cuda-12.2/include/
sudo cp cudnn-linux-x86_64-8.9.3.28_cuda12-archive/lib/libcudnn* /usr/local/cuda-12.2/lib64/
sudo chmod a+r /usr/local/cuda-12.2/include/cudnn*
sudo chmod a+r /usr/local/cuda-12.2/lib64/libcudnn*
Check out the version information:
cat /usr/local/cuda/include/cudnn_version.h | grep CUDNN_MAJOR -A 2