1, dark view
2,470-server can't install 11.4
3,cuda.run and tensorRT.dpkg can't
# 安装
$ 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
CUDA安装完成后,需要配置变量环境才能正常使用。首先在终端输入sudo gedit ~/.bashrc
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-11.4/lib64
export PATH=$PATH:/usr/local/cuda-11.4/bin
export CUDA_HOME=$CUDA_HOME:/usr/local/cuda-11.4
卸载前请把环境删除 vim ~/.bashrc sudo vi ~/.bashrccd /usr/local/cuda-xx.x/bin/
sudo ./cuda-uninstaller
sudo rm -rf /usr/local/cuda-xx.xeg:
sudo /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*dpkgStep 1:查看系统中所有的CUDA版本,使用以下命令:
$ dpkg -l | grep cuda
Step 2:选择需要卸载的CUDA版本,使用以下命令:
$ sudo apt-get --purge remove cuda-[版本号]
eg :$ sudo apt-get --purge remove cuda-10-0
Step 3:最后,我们需要清除所有相关的软件包和依赖项。使用以下命令:
$ sudo apt-get autoremove
wget https://developer.download.nvidia.com/compute/cuda/11.0.2/local_installers/cuda_11.0.2_450.51.05_linux.run
sudo sh cuda_11.0.2_450.51.05_linux.run
sudo apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev
可以安装多个版本CUDA,根据需要,切换cuda 的软连接即可。
sudo ln -snf /usr/local/cuda-11.8 /usr/local/cuda
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/
- 进入到下载文件的目录
2. 解压并安装
## sudo dpkg -i cudnn-local-repo-${distro}-8.x.x.x_1.0-1_amd64.deb
sudo dpkg -i cudnn-local-repo-ubuntu2204-8.9.3.28_1.0-1_amd64.deb
3. 按照提示复制输入命令,导入 CUDA GPG key.
## sudo cp /var/cudnn-local-repo-*/cudnn-local-*-keyring.gpg /usr/share/keyrings/
sudo cp /var/cudnn-local-repo-ubuntu2204-8.9.3.28/cudnn-local-*-keyring.gpg /usr/share/keyrings/
4. 更新源
sudo apt-get update
5. 安装
semple install
sudo apt-get install libcudnn8
## 1. Install the runtime library.
## sudo apt-get install libcudnn8=8.x.x.x-1+cudaX.Y
sudo apt-get install libcudnn8=8.9.3.28-1+cuda11.8
## 2. Install the developer library.
## sudo apt-get install libcudnn8-dev=8.x.x.x-1+cudaX.Y
sudo apt-get install libcudnn8-dev=8.9.3.28-1+cuda11.8
## 3. Install the code samples.
## sudo apt-get install libcudnn8-samples=8.x.x.x-1+cudaX.Y
sudo apt-get install libcudnn8-samples=8.9.3.28-1+cuda11.8
安装运行环境
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版本