Ubuntu 20.04 CUDA 11.3 安装问题

Ubuntu 20.04 CUDA 11.3 安装问题

我在安装 CUDA 11.3 时遇到问题,我按照 nvidia 的官方 CUDA 安装指南一步一步操作,多次尝试不同的 nvidia 驱动程序。但无论我怎么尝试,nvidia-smi 或 nvcc 都无法正常工作。

这是我在 CUDA 安装的最后一步得到的结果(sudo apt-get -y install cuda

INFO:Enable nvidia
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/dell_latitude
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/lenovo_thinkpad
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/put_your_quirks_here
Loading new nvidia-465.19.01 DKMS files...
Building for 5.15.0-58-generic
Building for architecture x86_64
Building initial module for 5.15.0-58-generic
ERROR: Cannot create report: [Errno 17] File exists: '/var/crash/nvidia-dkms-465.0.crash'
Error! Bad return status for module build on kernel: 5.15.0-58-generic (x86_64)
Consult /var/lib/dkms/nvidia/465.19.01/build/make.log for more information.
dpkg: error processing package nvidia-dkms-465 (--configure):
 installed nvidia-dkms-465 package post-installation script subprocess returned error exit status 10
Setting up libcusolver-dev-11-3 (11.1.2.109-1) ...
Setting up cuda-cupti-11-3 (11.3.111-1) ...
dpkg: dependency problems prevent configuration of cuda-drivers-465:
 cuda-drivers-465 depends on nvidia-dkms-465 (>= 465.19.01); however:
  Package nvidia-dkms-465 is not configured yet.

dpkg: error processing package cuda-drivers-465 (--configure):
 dependency problems - leaving unconfigured
Setting up cuda-cupti-dev-11-3 (11.3.111-1) ...
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          dpkg: dependency problems prevent configuration of cuda-drivers:
 cuda-drivers depends on cuda-drivers-465 (= 465.19.01-1); however:
  Package cuda-drivers-465 is not configured yet.

dpkg: error processing package cuda-drivers (--configure):
 dependency problems - leaving unconfigured
Setting up cuda-libraries-dev-11-3 (11.3.1-1) ...
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          dpkg: dependency problems prevent configuration of nvidia-driver-465:
 nvidia-driver-465 depends on nvidia-dkms-465 (= 465.19.01-0ubuntu1); however:
  Package nvidia-dkms-465 is not configured yet.

dpkg: error processing package nvidia-driver-465 (--configure):
 dependency problems - leaving unconfigured
Setting up cuda-visual-tools-11-3 (11.3.1-1) ...
No apport report written because MaxReports is reached already
                                                              dpkg: dependency problems prevent configuration of cuda-runtime-11-3:
 cuda-runtime-11-3 depends on cuda-drivers (>= 465.19.01); however:
  Package cuda-drivers is not configured yet.

dpkg: error processing package cuda-runtime-11-3 (--configure):
 dependency problems - leaving unconfigured
Setting up cuda-samples-11-3 (11.3.58-1) ...
No apport report written because MaxReports is reached already
                                                              Setting up cuda-command-line-tools-11-3 (11.3.1-1) ...
dpkg: dependency problems prevent configuration of cuda-demo-suite-11-3:
 cuda-demo-suite-11-3 depends on cuda-runtime-11-3; however:
  Package cuda-runtime-11-3 is not configured yet.

dpkg: error processing package cuda-demo-suite-11-3 (--configure):
 dependency problems - leaving unconfigured
Setting up cuda-documentation-11-3 (11.3.111-1) ...
No apport report written because MaxReports is reached already
                                                              dpkg: dependency problems prevent configuration of cuda-11-3:
 cuda-11-3 depends on cuda-runtime-11-3 (>= 11.3.1); however:
  Package cuda-runtime-11-3 is not configured yet.
 cuda-11-3 depends on cuda-demo-suite-11-3 (>= 11.3.58); however:
  Package cuda-demo-suite-11-3 is not configured yet.

dpkg: error processing package cuda-11-3 (--configure):
 dependency problems - leaving unconfigured
Setting up cuda-tools-11-3 (11.3.1-1) ...
No apport report written because MaxReports is reached already
                                                              dpkg: dependency problems prevent configuration of cuda:
 cuda depends on cuda-11-3 (>= 11.3.1); however:
  Package cuda-11-3 is not configured yet.

dpkg: error processing package cuda (--configure):
 dependency problems - leaving unconfigured
Setting up cuda-toolkit-11-3 (11.3.1-1) ...
No apport report written because MaxReports is reached already
                                                              Setting alternatives
Processing triggers for mime-support (3.64ubuntu1) ...
Processing triggers for gnome-menus (3.36.0-1ubuntu1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.9) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for desktop-file-utils (0.24-1ubuntu3) ...
Processing triggers for initramfs-tools (0.136ubuntu6.7) ...
update-initramfs: Generating /boot/initrd.img-5.15.0-58-generic
Errors were encountered while processing:
 nvidia-dkms-465
 cuda-drivers-465
 cuda-drivers
 nvidia-driver-465
 cuda-runtime-11-3
 cuda-demo-suite-11-3
 cuda-11-3
 cuda
E: Sub-process /usr/bin/dpkg returned an error code (1)

nvcc -V输出:

Copyright (c) 2005-2021 NVIDIA Corporation
Built on Mon_May__3_19:15:13_PDT_2021
Cuda compilation tools, release 11.3, V11.3.109
Build cuda_11.3.r11.3/compiler.29920130_0

但当我尝试时nvidia-smi我得到:

Failed to initialize NVML: Driver/library version mismatch

重启后:

NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.

重启也没有解决问题。有人知道解决办法吗?提前谢谢。

相关内容