Linux服务器上安装CUDA11.2和对应的cuDNN 8.4.0

一、检查

检查本机是否有CUDA工具包,输入nvcc -V:

如图所示,服务器上有CUDA,但版本为9.1.85,版本过低,因此博主要重装一个新的。

二、安装CUDA

1.查看服务器最高支持的CUDA版本

在命令行输入nvidia-smi查看显卡驱动版本也就是最高支持的CUDA工具包版本。
例如,本机可安装11.7及以下的CUDA工具包:

2.官网下载CUDA安装包

在NVIDIA官网选择对应版本的CUDA工具包并选择你的机器配置,我们就选择11.2.0版本下载

在终端执行如下命令:

wget https://developer.download.nvidia.com/compute/cuda/11.2.0/local_installers/cuda_11.2.0_460.27.04_linux.run
sudo sh cuda_11.2.0_460.27.04_linux.run

3.安装CUDA 

如果出现以下提示,选择continue并在下面取消安装驱动即可。

 根据提示一步步安装,手动输入accept确认。

 我们已经有驱动了,这里取消安装驱动,上下键跳转选项,回车键选择是否安装。

因为我服务器上之前安装过CUDA12,所以会出现这个提示。它表示已经找到了一个现有的CUDA Toolkit 11.2安装,并询问用户是否要升级所有组件或者选择要升级的组件。如果用户不想继续安装,可以选择"No, abort installation"来中止安装过程。我这里选择选择Upgrade all

稍作等待,出现以下提示信息就安装好了,可以看到CUDA安装到了/usr/local/cuda-11.2/

 注意看提示 make sure that:  意思是要添加环境变量 

4.配置环境变量

 输入如下指令查看PATH和LD_LIBRARY_PATH中环境变量

echo $PATH
echo $LD_LIBRARY_PATH

查看有无添加上述两个环境变量,若无,则采用如下两种方法添加环境变量 

 法1: 直接运行export命令定义变量【只对当前shell(BASH)有效(临时的)】  

export PATH=$PATH:/usr/local/cuda-11.2/bin
export LD_LIBRARY_PATH=/usr/local/cuda-11.2/lib64

 法二:在用户目录下的.bashrc文件中增加变量【(永久的)】

sudo vim ~/.bashrc

 点i进入编辑模式,在最后一行输入

export PATH=$PATH:/usr/local/cuda-11.2/bin
export LD_LIBRARY_PATH=/usr/local/cuda-11.2/lib64

 输入好了按Esc退出编辑模式,然后输入:wq 保存退出就好

 保存好了之后注意,这个时候如果查看环境变量会发现还是没有添加好的,所以我们需要更新一下bashrc文件。更新指令如下:

source ~/.bashrc

输入nvcc -V查看cuda版本

图示为安装成功。 

我出现的问题:

安装了新的cuda后nvcc -V依然显示旧版本

输入nvcc -V任显示旧版本的v9.1

但查看环境路径却已经配好

 解决办法是:
1.执行sudo apt-get remove nvidia-*卸载原驱动。
2.这时候nvcc -V就会显示下方的图片的错误。

3.下载驱动

  • 输入下条命令,查看你的显卡驱动所使用的内核版本
cat /proc/driver/nvidia/version

 可以看出内核版本为515.105.01

  • 输入下条命令,查看电脑驱动
cat /var/log/dpkg.log | grep nvidia

 2022-05-22 06:24:13 upgrade libnvidia-common-470:all 470.103.01-0ubuntu0.18.04.1 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:24:13 status half-configured libnvidia-common-470:all 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:24:13 status unpacked libnvidia-common-470:all 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:24:13 status half-installed libnvidia-common-470:all 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:24:14 status half-installed libnvidia-common-470:all 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:24:14 status unpacked libnvidia-common-470:all 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:24:14 status unpacked libnvidia-common-470:all 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:24:14 configure libnvidia-common-470:all 470.129.06-0ubuntu0.18.04.1 <无>
2022-05-22 06:24:14 status unpacked libnvidia-common-470:all 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:24:14 status half-configured libnvidia-common-470:all 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:24:14 status installed libnvidia-common-470:all 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:25:58 upgrade nvidia-driver-460:amd64 470.103.01-0ubuntu0.18.04.1 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:25:58 status half-configured nvidia-driver-460:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:25:58 status unpacked nvidia-driver-460:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:25:58 status half-installed nvidia-driver-460:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:25:58 status half-installed nvidia-driver-460:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:25:58 status unpacked nvidia-driver-460:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:25:58 status unpacked nvidia-driver-460:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:25:58 configure nvidia-driver-460:amd64 470.129.06-0ubuntu0.18.04.1 <无>
2022-05-22 06:25:58 status unpacked nvidia-driver-460:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:25:59 status half-configured nvidia-driver-460:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:25:59 status installed nvidia-driver-460:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:30:36 upgrade nvidia-driver-470:amd64 470.103.01-0ubuntu0.18.04.1 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:30:36 status half-configured nvidia-driver-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:30:36 status unpacked nvidia-driver-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:30:37 status half-installed nvidia-driver-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:30:37 status half-installed nvidia-driver-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:30:37 status unpacked nvidia-driver-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:30:37 status unpacked nvidia-driver-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:30:37 upgrade libnvidia-gl-470:amd64 470.103.01-0ubuntu0.18.04.1 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:30:37 status half-configured libnvidia-gl-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:30:37 status unpacked libnvidia-gl-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:30:37 status half-configured libnvidia-gl-470:i386 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:30:37 status half-installed libnvidia-gl-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:00 status half-installed libnvidia-gl-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:00 status unpacked libnvidia-gl-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:31:00 status unpacked libnvidia-gl-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:31:01 upgrade libnvidia-gl-470:i386 470.103.01-0ubuntu0.18.04.1 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:31:01 status half-configured libnvidia-gl-470:i386 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:01 status unpacked libnvidia-gl-470:i386 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:01 status half-installed libnvidia-gl-470:i386 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:04 status half-installed libnvidia-gl-470:i386 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:05 status unpacked libnvidia-gl-470:i386 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:31:05 status unpacked libnvidia-gl-470:i386 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:31:05 upgrade nvidia-dkms-470:amd64 470.103.01-0ubuntu0.18.04.1 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:31:05 status half-configured nvidia-dkms-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:38 status unpacked nvidia-dkms-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:38 status half-installed nvidia-dkms-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:39 status half-installed nvidia-dkms-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:39 status unpacked nvidia-dkms-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:31:39 status unpacked nvidia-dkms-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:31:39 upgrade nvidia-kernel-source-470:amd64 470.103.01-0ubuntu0.18.04.1 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:31:39 status half-configured nvidia-kernel-source-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:39 status unpacked nvidia-kernel-source-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:39 status half-installed nvidia-kernel-source-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:41 status half-installed nvidia-kernel-source-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:41 status unpacked nvidia-kernel-source-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:31:42 status unpacked nvidia-kernel-source-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:31:42 upgrade nvidia-kernel-common-470:amd64 470.103.01-0ubuntu0.18.04.1 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:31:42 status half-configured nvidia-kernel-common-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:42 status unpacked nvidia-kernel-common-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:42 status half-installed nvidia-kernel-common-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:43 status half-installed nvidia-kernel-common-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:44 status unpacked nvidia-kernel-common-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:31:44 status unpacked nvidia-kernel-common-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:31:44 upgrade libnvidia-decode-470:i386 470.103.01-0ubuntu0.18.04.1 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:31:44 status half-configured libnvidia-decode-470:i386 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:44 status unpacked libnvidia-decode-470:i386 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:44 status half-configured libnvidia-decode-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:44 status half-installed libnvidia-decode-470:i386 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:44 status half-installed libnvidia-decode-470:i386 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:45 status unpacked libnvidia-decode-470:i386 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:31:45 status unpacked libnvidia-decode-470:i386 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:31:45 upgrade libnvidia-decode-470:amd64 470.103.01-0ubuntu0.18.04.1 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:31:45 status half-configured libnvidia-decode-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:45 status unpacked libnvidia-decode-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:45 status half-installed libnvidia-decode-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:45 status half-installed libnvidia-decode-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:45 status unpacked libnvidia-decode-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:31:45 status unpacked libnvidia-decode-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:31:46 upgrade libnvidia-compute-470:amd64 470.103.01-0ubuntu0.18.04.1 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:31:46 status half-configured libnvidia-compute-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:46 status unpacked libnvidia-compute-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:46 status half-configured libnvidia-compute-470:i386 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:46 status half-installed libnvidia-compute-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:51 status half-installed libnvidia-compute-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:51 status unpacked libnvidia-compute-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:31:51 status unpacked libnvidia-compute-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:31:52 upgrade libnvidia-compute-470:i386 470.103.01-0ubuntu0.18.04.1 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:31:52 status half-configured libnvidia-compute-470:i386 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:52 status unpacked libnvidia-compute-470:i386 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:52 status half-installed libnvidia-compute-470:i386 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:56 status half-installed libnvidia-compute-470:i386 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:56 status unpacked libnvidia-compute-470:i386 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:31:56 status unpacked libnvidia-compute-470:i386 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:31:56 upgrade libnvidia-extra-470:amd64 470.103.01-0ubuntu0.18.04.1 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:31:56 status half-configured libnvidia-extra-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:56 status unpacked libnvidia-extra-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:56 status half-installed libnvidia-extra-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:56 status half-installed libnvidia-extra-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:57 status unpacked libnvidia-extra-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:31:57 status unpacked libnvidia-extra-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:31:57 upgrade nvidia-compute-utils-470:amd64 470.103.01-0ubuntu0.18.04.1 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:31:57 status half-configured nvidia-compute-utils-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:57 status unpacked nvidia-compute-utils-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:57 status half-installed nvidia-compute-utils-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:57 status half-installed nvidia-compute-utils-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:58 status unpacked nvidia-compute-utils-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:31:58 status unpacked nvidia-compute-utils-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:31:58 upgrade libnvidia-encode-470:amd64 470.103.01-0ubuntu0.18.04.1 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:31:58 status half-configured libnvidia-encode-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:58 status unpacked libnvidia-encode-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:58 status half-configured libnvidia-encode-470:i386 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:58 status half-installed libnvidia-encode-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:58 status half-installed libnvidia-encode-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:58 status unpacked libnvidia-encode-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:31:58 status unpacked libnvidia-encode-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:31:58 upgrade libnvidia-encode-470:i386 470.103.01-0ubuntu0.18.04.1 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:31:58 status half-configured libnvidia-encode-470:i386 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:58 status unpacked libnvidia-encode-470:i386 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:58 status half-installed libnvidia-encode-470:i386 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:59 status half-installed libnvidia-encode-470:i386 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:59 status unpacked libnvidia-encode-470:i386 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:31:59 status unpacked libnvidia-encode-470:i386 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:31:59 upgrade nvidia-utils-470:amd64 470.103.01-0ubuntu0.18.04.1 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:31:59 status half-configured nvidia-utils-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:59 status unpacked nvidia-utils-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:59 status half-installed nvidia-utils-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:59 status half-installed nvidia-utils-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:59 status unpacked nvidia-utils-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:31:59 status unpacked nvidia-utils-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:31:59 upgrade xserver-xorg-video-nvidia-470:amd64 470.103.01-0ubuntu0.18.04.1 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:31:59 status half-configured xserver-xorg-video-nvidia-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:59 status unpacked xserver-xorg-video-nvidia-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:31:59 status half-installed xserver-xorg-video-nvidia-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:32:00 status half-installed xserver-xorg-video-nvidia-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:32:00 status unpacked xserver-xorg-video-nvidia-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:00 status unpacked xserver-xorg-video-nvidia-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:00 upgrade libnvidia-ifr1-470:amd64 470.103.01-0ubuntu0.18.04.1 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:00 status half-configured libnvidia-ifr1-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:32:00 status unpacked libnvidia-ifr1-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:32:00 status half-configured libnvidia-ifr1-470:i386 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:32:00 status half-installed libnvidia-ifr1-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:32:00 status half-installed libnvidia-ifr1-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:32:01 status unpacked libnvidia-ifr1-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:01 status unpacked libnvidia-ifr1-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:01 upgrade libnvidia-ifr1-470:i386 470.103.01-0ubuntu0.18.04.1 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:01 status half-configured libnvidia-ifr1-470:i386 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:32:01 status unpacked libnvidia-ifr1-470:i386 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:32:01 status half-installed libnvidia-ifr1-470:i386 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:32:01 status half-installed libnvidia-ifr1-470:i386 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:32:01 status unpacked libnvidia-ifr1-470:i386 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:01 status unpacked libnvidia-ifr1-470:i386 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:02 upgrade libnvidia-fbc1-470:amd64 470.103.01-0ubuntu0.18.04.1 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:02 status half-configured libnvidia-fbc1-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:32:02 status unpacked libnvidia-fbc1-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:32:02 status half-configured libnvidia-fbc1-470:i386 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:32:02 status half-installed libnvidia-fbc1-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:32:02 status half-installed libnvidia-fbc1-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:32:02 status unpacked libnvidia-fbc1-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:02 status unpacked libnvidia-fbc1-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:02 upgrade libnvidia-fbc1-470:i386 470.103.01-0ubuntu0.18.04.1 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:02 status half-configured libnvidia-fbc1-470:i386 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:32:02 status unpacked libnvidia-fbc1-470:i386 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:32:02 status half-installed libnvidia-fbc1-470:i386 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:32:02 status half-installed libnvidia-fbc1-470:i386 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:32:03 status unpacked libnvidia-fbc1-470:i386 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:03 status unpacked libnvidia-fbc1-470:i386 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:03 upgrade libnvidia-cfg1-470:amd64 470.103.01-0ubuntu0.18.04.1 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:03 status half-configured libnvidia-cfg1-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:32:03 status unpacked libnvidia-cfg1-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:32:03 status half-installed libnvidia-cfg1-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:32:03 status half-installed libnvidia-cfg1-470:amd64 470.103.01-0ubuntu0.18.04.1
2022-05-22 06:32:03 status unpacked libnvidia-cfg1-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:03 status unpacked libnvidia-cfg1-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:03 configure nvidia-kernel-common-470:amd64 470.129.06-0ubuntu0.18.04.1 <无>
2022-05-22 06:32:03 status unpacked nvidia-kernel-common-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:03 status half-configured nvidia-kernel-common-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:30 status installed nvidia-kernel-common-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:30 configure libnvidia-gl-470:amd64 470.129.06-0ubuntu0.18.04.1 <无>
2022-05-22 06:32:30 status unpacked libnvidia-gl-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:30 status half-configured libnvidia-gl-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:30 status installed libnvidia-gl-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:30 configure libnvidia-gl-470:i386 470.129.06-0ubuntu0.18.04.1 <无>
2022-05-22 06:32:30 status unpacked libnvidia-gl-470:i386 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:30 status half-configured libnvidia-gl-470:i386 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:30 status installed libnvidia-gl-470:i386 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:30 configure libnvidia-fbc1-470:i386 470.129.06-0ubuntu0.18.04.1 <无>
2022-05-22 06:32:30 status unpacked libnvidia-fbc1-470:i386 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:30 status half-configured libnvidia-fbc1-470:i386 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:30 status installed libnvidia-fbc1-470:i386 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:30 configure libnvidia-fbc1-470:amd64 470.129.06-0ubuntu0.18.04.1 <无>
2022-05-22 06:32:30 status unpacked libnvidia-fbc1-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:30 status half-configured libnvidia-fbc1-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:30 status installed libnvidia-fbc1-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:30 configure libnvidia-compute-470:i386 470.129.06-0ubuntu0.18.04.1 <无>
2022-05-22 06:32:30 status unpacked libnvidia-compute-470:i386 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:31 status half-configured libnvidia-compute-470:i386 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:31 status installed libnvidia-compute-470:i386 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:31 configure libnvidia-compute-470:amd64 470.129.06-0ubuntu0.18.04.1 <无>
2022-05-22 06:32:31 status unpacked libnvidia-compute-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:31 status unpacked libnvidia-compute-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:31 status half-configured libnvidia-compute-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:31 status installed libnvidia-compute-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:31 configure libnvidia-cfg1-470:amd64 470.129.06-0ubuntu0.18.04.1 <无>
2022-05-22 06:32:31 status unpacked libnvidia-cfg1-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:31 status half-configured libnvidia-cfg1-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:31 status installed libnvidia-cfg1-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:31 configure libnvidia-ifr1-470:i386 470.129.06-0ubuntu0.18.04.1 <无>
2022-05-22 06:32:31 status unpacked libnvidia-ifr1-470:i386 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:31 status half-configured libnvidia-ifr1-470:i386 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:31 status installed libnvidia-ifr1-470:i386 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:31 configure libnvidia-ifr1-470:amd64 470.129.06-0ubuntu0.18.04.1 <无>
2022-05-22 06:32:31 status unpacked libnvidia-ifr1-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:31 status half-configured libnvidia-ifr1-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:31 status installed libnvidia-ifr1-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:31 configure xserver-xorg-video-nvidia-470:amd64 470.129.06-0ubuntu0.18.04.1 <无>
2022-05-22 06:32:31 status unpacked xserver-xorg-video-nvidia-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:31 status half-configured xserver-xorg-video-nvidia-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:31 status installed xserver-xorg-video-nvidia-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:31 configure libnvidia-extra-470:amd64 470.129.06-0ubuntu0.18.04.1 <无>
2022-05-22 06:32:31 status unpacked libnvidia-extra-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:31 status half-configured libnvidia-extra-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:31 status installed libnvidia-extra-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:31 configure nvidia-kernel-source-470:amd64 470.129.06-0ubuntu0.18.04.1 <无>
2022-05-22 06:32:31 status unpacked nvidia-kernel-source-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:31 status half-configured nvidia-kernel-source-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:32 status installed nvidia-kernel-source-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:32 configure nvidia-utils-470:amd64 470.129.06-0ubuntu0.18.04.1 <无>
2022-05-22 06:32:32 status unpacked nvidia-utils-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:32 status half-configured nvidia-utils-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:32 status installed nvidia-utils-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:32 configure libnvidia-decode-470:i386 470.129.06-0ubuntu0.18.04.1 <无>
2022-05-22 06:32:32 status unpacked libnvidia-decode-470:i386 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:32 status half-configured libnvidia-decode-470:i386 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:32 status installed libnvidia-decode-470:i386 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:32 configure libnvidia-decode-470:amd64 470.129.06-0ubuntu0.18.04.1 <无>
2022-05-22 06:32:32 status unpacked libnvidia-decode-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:32 status half-configured libnvidia-decode-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:32 status installed libnvidia-decode-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:32 configure nvidia-dkms-470:amd64 470.129.06-0ubuntu0.18.04.1 <无>
2022-05-22 06:32:32 status unpacked nvidia-dkms-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:32:32 status half-configured nvidia-dkms-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:35:03 status installed nvidia-dkms-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:35:03 configure nvidia-compute-utils-470:amd64 470.129.06-0ubuntu0.18.04.1 <无>
2022-05-22 06:35:03 status unpacked nvidia-compute-utils-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:35:03 status half-configured nvidia-compute-utils-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:35:03 status installed nvidia-compute-utils-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:35:03 configure libnvidia-encode-470:i386 470.129.06-0ubuntu0.18.04.1 <无>
2022-05-22 06:35:03 status unpacked libnvidia-encode-470:i386 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:35:03 status half-configured libnvidia-encode-470:i386 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:35:03 status installed libnvidia-encode-470:i386 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:35:03 configure libnvidia-encode-470:amd64 470.129.06-0ubuntu0.18.04.1 <无>
2022-05-22 06:35:03 status unpacked libnvidia-encode-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:35:03 status half-configured libnvidia-encode-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:35:03 status installed libnvidia-encode-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:35:03 configure nvidia-driver-470:amd64 470.129.06-0ubuntu0.18.04.1 <无>
2022-05-22 06:35:03 status unpacked nvidia-driver-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:35:04 status half-configured nvidia-driver-470:amd64 470.129.06-0ubuntu0.18.04.1
2022-05-22 06:35:04 status installed nvidia-driver-470:amd64 470.129.06-0ubuntu0.18.04.1

 可以看到由470.103.01升级到了515.105.01

  • 输入下条命令,查看电脑所有驱动
sudo dpkg --list | grep nvidia-*
  • 卸载现有驱动,重新安装

sudo /usr/bin/nvidia-uninstall
sudo apt-get --purge remove nvidia-*
sudo apt-get purge nvidia*
sudo apt-get purge libnvidia*

 其中第二行可能会出现:

那就按他说的做 

sudo apt autoremove nvidia-*
  • 直到命令不输出任何内容
sudo dpkg --list | grep nvidia-*
  • 查找可用的驱动版本
ubuntu-drivers devices

那我就安装515吧,带有server的是针对没有图形化界面的服务器的。

  • 重新安装
sudo apt-get install nvidia-driver-515 nvidia-settings nvidia-prime

3.然后按照安装cuda的步骤安装后再nvcc -V就可以显示安装的cuda版本信息。

三、安装cuDNN

1.根据安装的CUDA工具包版本在官网选择适合版本的cuDNN,本文安装的CUDA版本是11.2,就选择与之对应的cuDNN v8.4.0,选择Local Installer for Linux x86_64 (Tar)

2. 复制cuDNN库的链接,使用wget下载或者下载到自己电脑之后再传到服务器上。

  • 我的服务器网速有点慢,所以选择先下到自己电脑再传上去,速度很快啊。

 

 3.解压cuDNN文件,并进入解压出的文件夹,拷贝文件到/usr/local/cuda-11.2中

	tar -xvf cudnn-linux-x86_64-8.4.0.27_cuda11.6-archive.tar.xz
	cd cudnn-linux-x86_64-8.4.0.27_cuda11.6-archive
	sudo cp lib/* /usr/local/cuda-11.2/lib64/
	sudo cp include/* /usr/local/cuda-11.2/include/
	sudo chmod a+r /usr/local/cuda-11.2/lib64/*
	sudo chmod a+r /usr/local/cuda-11.2/include/*

 4. 

查看cuDNN版本,旧版本指令为cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A2,新版本有更新,将cuDNN版本信息单拉了一个文件名为cudnn_version.h,所以新版本查看cuDNN版本的命令为cat /usr/local/cuda/include/cudnn_version.h | grep CUDNN_MAJOR -A 2

 上述教程为这台机器上的所有用户安装了CUDA和cuDNN,我们查看nvcc是否能用。

好的,安装完成。 

参考文章:Failed to initialize NVML: Driver/library version mismatch_failed to initialize nvidia driver-CSDN博客

Linux安装CUDA & 添加环境变量 & 多版本CUDA切换 (软链接)-CSDN博客

【Linux】安装CUDA 11.2 和 cuDNN 8.4.0并检查是否安装成功_linux查看cudnn是否安装成功-CSDN博客

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/760448.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

Mining Engineering First Aid Riding

4个最主要的日常技能&#xff1a;Mining 采矿 Engineering 工程 First Aid 急救 Riding 骑术 4个最主要的日常技能

C# 信号量的使用

学习来源&#xff1a;《.net core 底层入门》 第六章第9节&#xff1a;信号量 案例&#xff1a;主线程负责添加数据&#xff0c;子线程负责获取数据 使用SemaphoreSlim&#xff08;轻信号量&#xff09;实现&#xff1a; using System; using System.Collections.Generic; us…

AI写作变现指南:从项目启动到精通

项目启动 1. 确定目标客户群体 首先&#xff0c;明确谁是我们的目标客户。以下是一些潜在的客户群体&#xff1a; 大学生&#xff1a;他们需要写论文、报告、演讲稿等。 职场人士&#xff1a;包括需要撰写商业计划书、市场分析报告、项目提案等的专业人士。 自媒体从业者&…

TiDB-从0到1-BR工具

TiDB从0到1系列 TiDB-从0到1-体系结构TiDB-从0到1-分布式存储TiDB-从0到1-分布式事务TiDB-从0到1-MVCCTiDB-从0到1-部署篇TiDB-从0到1-配置篇TiDB-从0到1-集群扩缩容 一、BR工具 BR工具全称backup & restore&#xff0c;如同MySQL可以通过mysqldump和xtrabackup进行备份…

入门JavaWeb之 JDBC 连接数据库

JDBC&#xff1a;Java Database Connectivity&#xff0c;Java 数据库连接 需要 jar 包支持&#xff1a; java.sql javax.sql mysql-connector-java&#xff08;连接驱动&#xff0c;必须导入&#xff09; 在 MySQL 先建个 jdbc 数据库后 USE jdbc; 执行后再 CREATE TABLE…

Java_日志

日志技术 可以将系统执行的信息&#xff0c;方便的记录到指定的位置(控制台、文件中、数据库中) 可以随时以开关的形式控制日志启停&#xff0c;无需侵入到源代码中去进行修改。 日志技术的体系结构 日志框架&#xff1a;JUL、Log4j、Logback、其他实现。 日志接口&#xf…

youlai-boot项目的学习(3) 本地redis、MinIO的安装与配置

youlai-boot项目除了使用mysql数据库、还有redis&#xff0c;以及OSS服务&#xff0c;OSS除了云OSS服务&#xff0c;还有自部署的MinIO服务。 前面我们已经安装好了mysql数据库&#xff0c;那么我们来看看本地redis、MinIO服务怎么部署 环境 mac OS&#xff0c; iterm2&#…

线性结构之栈结构

栈是一种只能从一端存取数据并且遵循“后进先出”原则的线性存储结构。这句话中体现了栈结构的三个特征——只能从一端存取数据&#xff0c;遵循“后进先出”的原则和线性存储结构。因此如果我们要实现一个栈结构的数据结构&#xff0c;就必须要满足这三点要求。提到线性结构&a…

产品经理系列1—如何实现一个电商系统

具体笔记如下&#xff0c;主要按获客—找货—下单—售后四个部分进行模块拆解

ubuntu 系统中 使用docker 制作 Windows 系统,从此告别 vmware虚拟机

我的系统是 ubuntu 24 前期准备工作&#xff1a; 安装dockerdocker pull 或者 手动制作镜像 docker build 的话 必须要 科学上网&#xff0c; 好像阿里镜像都下不下来。需要 知道 docker 和docker compose 命令的使用方式 我是给docker 挂了 http代理 如果你能pull下来镜像 …

大家都在跳槽,我需要跳槽吗?

文章目录 1. 前言2. 最初的跳槽想法萌芽3. 跳槽想法的再次萌芽4. 我是否需要跳槽呢?5. 那些跳槽的同学怎么样了&#xff1f;6. 小结 1. 前言 两周前&#xff0c;看到研究生同班同学发的一条朋友圈&#xff0c;内容为”下一站 杭州~”&#xff0c;配图是拍的北京开往杭州的列车…

同步的问题及解决方案

同步 同步的问题 当给狗狗食物的同时&#xff0c;狗狗又在吃&#xff0c;这会导致在运行过程中会出现食物的数据的错乱&#xff0c;有时候会多出数据&#xff0c;有时候会少出数据&#xff0c;这就让狗狗有时候会很吃亏&#xff0c;那么该如何解决呢&#xff1f; 实验体现 pa…

实验6 形态学图像处理

1. 实验目的 ①掌握数字图像处理中&#xff0c;形态学方法的基本思想&#xff1b; ②掌握膨胀、腐蚀、开运算、闭运算等形态学基本运算方法&#xff1b; ③能够利用形态学基本运算方法&#xff0c;编程实现图像去噪&#xff0c;边界提取等功能。 2. 实验内容 ①调用Matlab /…

Excel 数据筛选难题解决

人不走空 &#x1f308;个人主页&#xff1a;人不走空 &#x1f496;系列专栏&#xff1a;算法专题 ⏰诗词歌赋&#xff1a;斯是陋室&#xff0c;惟吾德馨 目录 &#x1f308;个人主页&#xff1a;人不走空 &#x1f496;系列专栏&#xff1a;算法专题 ⏰诗词歌…

一个中文和越南语双语版本的助贷平台开源源码

一个中文和越南语双语版本的助贷平台开源源码。后台试nodejs。 后台 代理 前端均为vue源码&#xff0c;前端有中文和越南语。 前端ui黄色大气&#xff0c;逻辑操作简单&#xff0c;注册可对接国际短信&#xff0c;可不对接。 用户注册进去填写资料&#xff0c;后台审批&…

职场必备:三大神器助你完美驾驭工作与生活;从 GTD 到SMART再到OKR:提升效率的终极指南;告别拖延,高效工作的秘密武器!

在现代职场和个人生活中&#xff0c;有效的时间管理和目标设定是成功的关键。我们每天都面临着无数的任务和目标。如何在纷繁复杂的日常中保持专注&#xff0c;高效地完成工作&#xff1f; GTD&#xff08;Getting Things Done&#xff09; GTD&#xff08;Getting Things Don…

10款好用不火的PC软件,真的超好用!

AI视频生成&#xff1a;小说文案智能分镜智能识别角色和场景批量Ai绘图自动配音添加音乐一键合成视频https://aitools.jurilu.com/市场上有很多软件&#xff0c;除了那些常见的大众化软件&#xff0c;还有很多不为人知的小众软件&#xff0c;它们的作用非常强大&#xff0c;简洁…

web全屏api,实现元素放大全屏,requestFullscreen,exitFullscreen

全屏api 主要方法 document.exitFullscreen(); 退出页面全屏状态&#xff0c;document是全局文档对象 dom.requestFullscreen(); 使dom进入全屏状态&#xff0c;异步&#xff0c;dom是一个dom元素 dom.onfullscreenchange&#xff08;&#xff09;; 全…

imx6ull/linux应用编程学习(6)jpeg和png的图片显示

1.JPEG图片显示 JPEG&#xff08;Joint Photographic Experts Group&#xff09;是由国际标准组织为静态图像所建立的第一个国际数字图像压缩标准&#xff0c;也是至今一直在使用的、应用最广的图像压缩标准。JPEG 由于可以提供有损压缩&#xff0c;因此压缩比可以达到其他传统…

SpringBoot | 使用jwt令牌实现登录认证,使用Md5加密实现注册

对于登录认证中的令牌&#xff0c;其实就是一段字符串&#xff0c;那为什么要那么麻烦去用jwt令牌&#xff1f;其实对于登录这个业务&#xff0c;在平常我们实现这个功能时&#xff0c;可能大部分都是通过比对用户名和密码&#xff0c;只要正确&#xff0c;就登录成功&#xff…