# 安装
$ ubuntu-drivers devices$ sudo apt-get install nvidia-driver-470-server # 推荐是server,都可以。#delelt
sudo apt --purge remove nvidia-*
CUDA Toolkit Archive | NVIDIA Developerhttps://developer.nvidia.com/cuda-toolkit-archive
CUDA Toolkit 11.3 Downloads | NVIDIA Developerhttps://developer.nvidia.com/cuda-11.3.0-download-archive
https://developer.nvidia.com/cuda-11-4-0-download-archivehttps://developer.nvidia.com/cuda-11-4-0-download-archive
11.3wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin
sudo mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget https://developer.download.nvidia.com/compute/cuda/11.3.0/local_installers/cuda-repo-ubuntu2004-11-3-local_11.3.0-465.19.01-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu2004-11-3-local_11.3.0-465.19.01-1_amd64.deb
sudo apt-key add /var/cuda-repo-ubuntu2004-11-3-local/7fa2af80.pub
sudo apt-get update
sudo apt-get -y install cuda11.4wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin
sudo mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget https://developer.download.nvidia.com/compute/cuda/11.4.0/local_installers/cuda-repo-ubuntu2004-11-4-local_11.4.0-470.42.01-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu2004-11-4-local_11.4.0-470.42.01-1_amd64.deb
sudo apt-key add /var/cuda-repo-ubuntu2004-11-4-local/7fa2af80.pub
sudo apt-get updatesudo apt-get -y install cuda
cd /usr/local/cuda-xx.x/bin/
sudo ./cuda-uninstaller
sudo rm -rf /usr/local/cuda-xx.xsudo /usr/local/cuda-11.0/bin/cuda-uninstaller # 卸载cuda# 卸载显卡驱动,后面还要再做一边
# (1)卸载现有的显卡驱动
sudo apt-get purge nvidia*# (2)如果是离线安装的
卸载驱动和安装一样,首先ctrl+Alt+F2进入命令行状态,然后停止lightdm
sudo service lightdm stop
或者
sudo /etc/init.d/lightdm stop# 卸载
sudo /usr/bin/nvidia-uninstall也可以
sudo apt-get install autoremove --purge nvidia*卸载前请把环境删除 vim ~/.bashrc sudo vi ~/.bashrc
cuDNN Archive | NVIDIA Developerhttps://developer.nvidia.com/rdp/cudnn-archive
wget
Log in | NVIDIA Developerhttps://developer.nvidia.com/downloads/compute/cudnn/secure/8.9.6/local_installers/11.x/cudnn-local-repo-ubuntu2004-8.9.6.50_1.0-1_amd64.deb/
安装运行环境
sudo dpkg -i libcudnn7_7.6.0.64-1+cuda10.0_amd64.deb
安装开发包
sudo dpkg -i libcudnn7-dev_7.6.0.64-1+cuda10.0_amd64.deb
安装示例
sudo dpkg -i libcudnn7-doc_7.6.0.64-1+cuda10.0_amd64.deb
拷贝文件到环境配置的Home路径下
cp -r /usr/src/cudnn_samples_v7/ $HOME
Log in | NVIDIA Developerhttps://developer.nvidia.com/nvidia-tensorrt-8x-download
https://developer.nvidia.com/downloads/compute/machine-learning/tensorrt/secure/8.6.1/local_repos/nv-tensorrt-local-repo-ubuntu2004-8.6.1-cuda-11.8_1.0-1_amd64.debhttps://developer.nvidia.com/downloads/compute/machine-learning/tensorrt/secure/8.6.1/local_repos/nv-tensorrt-local-repo-ubuntu2004-8.6.1-cuda-11.8_1.0-1_amd64.deb
sudo dpkg -i nv-tensorrt-repo-ubuntu1804-cuda10.0-trt7.0.0.11-ga-20191216_1-1_amd64.deb
sudo apt-key add /var/nv-tensorrt-repo-cuda10.0-trt7.0.0.11-ga-20191216/7fa2af80.pub
sudo apt-get update
sudo apt-get install tensorrt
- uname -a // 查看ubuntu发行版本信息
- ls -l /usr/local/ | grep cuda // 查看cuda版本
- cat /usr/local/cuda/include/cudnn_version.h | grep CUDNN_MAJOR -A 2 // 查看cudnn版本
- cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2 // 查看cudnn版本