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.xzcd cudnn-linux-x86_64-8.4.0.27_cuda11.6-archivesudo 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博客

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

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

秋招季的策略与行动指南:提前布局,高效备战,精准出击

6月即将进入尾声&#xff0c;一年一度的秋季招聘季正在热火进行中。对于即将毕业的学生和寻求职业发展的职场人士来说&#xff0c;秋招是一个不容错过的黄金时期。 秋招的序幕通常在6月至9月间拉开&#xff0c;名企们纷纷开启网申的大门。在此期间&#xff0c;求职备战是一个系…

【ai】 梳理一下yolov4及 trition部署的心路历程

yolov4是darknetv5开始逐渐采用pytorchjetson上部署darknet比较直接因此这里采用的是yolov4 版本。isarsoft/yolov4-triton-tensorrt1. 2024-06-20 : 2.17.0 在jetson4.6 上可以跑 2.17版本server 在 jetson 运行 ./tritonserver --model-repository=…/docs/examples/model_r…

2.linux操作系统CPU使用率和平均负载区别

目录 概述cpu使用率区别 结束 概述 linux操作系统CPU 使用率 和 平均负载 区别 负载高并不一定使用率高&#xff0c;有可能 cpu 被占用&#xff0c;但不干活。 cpu使用率 cpu使用率&#xff1a;cpu非空闲态运行的时间占比&#xff0c;反映cpu的繁忙程度&#xff0c;和平均负载…

使用Vue3和Tailwind CSS快速搭建响应式布局

### 第一部分&#xff1a;初始化Vue3项目并安装Tailwind CSS 首先&#xff0c;在你的开发环境中打开终端&#xff0c;然后通过Vue CLI来创建一个新的Vue3项目。输入如下命令&#xff1a; vue create my-vue-app 按照提示选择Vue3的相关选项&#xff0c;创建完毕后&#xff0…

Flask模板和wtforms

Flask模板和wtforms 一、模板 在 Jinja2 模板引擎中&#xff0c;可以使用各种功能来渲染变量、进行循环和逻辑判断&#xff0c;这与 Django 的模板系统有很多相似之处&#xff0c;但也存在一些差异。 1.渲染变量 在 Jinja2 中&#xff0c;可以通过使用双大括号 {{ }} 来渲染…

python编程题2

1. 编写函数isodd(x)&#xff0c;若x不是整数&#xff0c;给出提示后退出程序&#xff1b;如果x为奇数&#xff0c;返回True&#xff0c;如果x为偶数&#xff0c;返回False。 def isodd(x):if int(x)!x:print("x不是整数&#xff0c;程序退出")returnelif x//2 ! x/…

如何使用VScode创建和上传Arduino项目

Visual Studio Code &#xff08;VS Code&#xff09; 是一种非常流行的通用集成开发环境 &#xff08;IDE&#xff09;。IDE 是一种将文本编辑器、编程界面、调试视图和项目管理集成在一个地方的软件。这个开源项目由微软领导&#xff0c;可以在所有操作系统上运行。使 VS Cod…

如何在CSS中设置px值

在CSS中设置px&#xff08;像素&#xff09;值非常简单。px是CSS中最常用的长度单位之一&#xff0c;用于指定元素的大小、位置、间距等。 以下是一些示例&#xff0c;展示如何在CSS中使用px值&#xff1a; 设置元素宽度和高度 css复制代码 .box { width: 200px; /* 设置元素…

8-Pandas iteration遍历

Pandas iteration遍历 遍历是众多编程语言中必备的一种操作&#xff0c;比如 Python 语言通过 for 循环来遍历列表结构。那么 Pandas 是如何遍历 Series 和 DataFrame 结构呢&#xff1f;我们应该明确&#xff0c;它们的数据结构类型不同的&#xff0c;遍历的方法必然会存在差…

介绍两个压测工具pgbench\sysbench,可视化监控工具NMON

性能评估做不好&#xff0c;开会又领导点名叼了。/(ㄒoㄒ)/~~ /(ㄒoㄒ)/~~ /(ㄒoㄒ)/~~ 挨叼了&#xff0c;也要写文章&#xff0c;记录下我的笔记。 写篇文章 对数据库、OS性能的性能评估&#xff0c;需要选择合适的压测工具&#xff0c;给找出数据库的运行瓶颈 pgbench 这是…

AI音乐的何去何从

引言 在过去的一个月里&#xff0c;多个先进的音乐生成大模型相继上线。这些AI模型不仅降低了普通人创作音乐的门槛&#xff0c;还在音乐圈内引发了关于AI是否会彻底颠覆传统音乐创作的广泛讨论。在短暂的兴奋过后&#xff0c;人们开始理性地审视这些AI产品的版权归属问题&…

【图像超分辨率】一个简单的总结

文章目录 图像超分辨率(Image Super-Resolution, ISR)1 什么是图像超分辨率&#xff1f;2 图像超分辨率通常有哪些方法&#xff1f;&#xff08;1&#xff09;基于插值的方法&#xff08;2&#xff09;基于重建的方法&#xff08;3&#xff09;基于学习的方法&#xff08;LR im…

Leetcode 78 数组子集

题目描述&#xff1a; 给你一个整数数组 nums &#xff0c;数组中的元素 互不相同 。返回该数组所有可能的 子集&#xff08;幂集&#xff09;。 解集 不能 包含重复的子集。你可以按 任意顺序 返回解集。 示例 1&#xff1a; 输入&#xff1a;nums [1,2,3] 输出&#xff1…

docker拉取Redis

拉取Redis redis的读写分离&#xff1a;https://blog.csdn.net/qq_51076413/article/details/123462448 Java整合Jedis&#xff1a;https://blog.csdn.net/qq_51076413/article/details/123462857 Java整合Redis&#xff1a;https://blog.csdn.net/qq_51076413/article/details…

动手学深度学习(Pytorch版)代码实践 -计算机视觉-46语义分割和数据集

46语义分割和数据集 # 图像分割和实例分割 """ 图像分割将图像划分为若干组成区域&#xff0c;这类问题的方法通常利用图像中像素之间的相关性。 它在训练时不需要有关图像像素的标签信息&#xff0c;在预测时也无法保证分割出的区域具有我们希望得到的语义。 图…

企业im(即时通讯)作为安全专属的移动数字化平台的重要工具

企业IM即时通讯作为安全专属的移动数字化平台的重要工具&#xff0c;正在越来越多的企业中发挥着重要的作用。随着移动技术和数字化转型的发展&#xff0c;企业对于安全、高效的内部沟通和协作工具的需求也越来越迫切。本文将探讨企业IM即时通讯作为安全专属的移动数字化平台的…

JAVA学习笔记-JAVA基础语法-DAY19-File类、递归

第一章 File类 1.1 概述 java.io.File 类是文件和目录路径名的抽象表示&#xff0c;主要用于文件和目录的创建、查找和删除等操作。 1.2 构造方法 public File(String pathname) &#xff1a;通过将给定的路径名字符串转换为抽象路径名来创建新的 File实例。public File(St…

【Science重磅】以纳米级分辨率重建的人类大脑皮层颗粒片段

翻查五月的Science发现一个有意思的项目《A petavoxel fragment of human cerebral cortex reconstructed at nanoscale resolution》由美国哈佛大学Jeff W. Lichtman 和美国谷歌研究中心 Viren Jain 共同合作 据介绍&#xff0c;充分了解人类大脑是如何工作的机理&#xff0c…

[Redis]主从模式

启动主从复制 由于我们只有一台机器&#xff0c;所以我们只能在机器上开多个redis程序来演示不同的机器 因为一个端口号只能被一个进程绑定&#xff0c;所以我们需要修改配置&#xff0c;绑定不同的端口号&#xff0c;并且还要修改工作目录&#xff08;数据持久化的位置&#…

七天速通javaSE:第六天 对象:类与对象

文章目录 前言一、认识对象1. 编程思想1.1 面向过程1.2 面向对象 2. 面向对象编程&#xff08;oop&#xff09; 二、再识方法1. 修饰符2. 参数的传递与赋值2.1 值传递2.2 引用传递 总结&#xff1a; 三、创建与初始化对象1. 类与对象的关系2. 创建与初始化对象 四、构造函数1. …