无法在 Ubuntu 16.04.3 上安装 CUDA 8.0

无法在 Ubuntu 16.04.3 上安装 CUDA 8.0

这是我根据网上的信息做的。/etc/modprobe.d 中有 3 个文件“blacklist-nouveau.conf”,内容如下

blacklist nouveau
blacklist lbm-nouveau
options nouveau modeset=0
alias nouveau off
alias lbm-nouveau off

“nouveau-kms.conf”

options nouveau modeset=0

和“nvidia-installer-disable-nouveau.conf”(由 cuda runfile 生成)具有

blacklist nouveau
options nouveau modeset=0

我的 /usr/src 有以下目录:

linux-headers-4.10.0-28          linux-hwe-4.10.0
linux-headers-4.10.0-28-generic  linux-source-4.4.0
linux-headers-4.10.0-40          linux-source-4.4.0.tar.bz2
linux-headers-4.10.0-40-generic

我已经表演过

sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade
sudo apt-get install linux-source
sudo apt-get source linux-image-$(uname -r)
sudo apt-get install linux-headers-$(uname -r)
sudo update-initramfs -u

当我跑步时

sudo ./cuda_8.0.61_375.26_linux.run --kernel-source-path=/usr/src/linux-hwe-4.10.0

我收到以下日志中的 --kernel-source-path 无效错误。

nvidia-installer log file '/var/log/nvidia-installer.log'
creation time: Thu Dec  7 01:45:55 2017
installer version: 375.26

PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin

nvidia-installer command line:
    ./nvidia-installer
    --ui=none
    --no-questions
    --accept-license
    --disable-nouveau
    --kernel-source-path=/usr/src/linux-hwe-4.10.0

Using built-in stream user interface
-> Detected 2 CPUs online; setting concurrency level to 2.
-> License accepted by command line option.
-> Installing NVIDIA driver version 375.26.
-> Running distribution scripts
   executing: '/usr/lib/nvidia/pre-install'...
-> done.
-> The distribution-provided pre-install script failed!  Are you sure you want to continue? (Answer: Continue installation)
WARNING: One or more modprobe configuration files to disable Nouveau are already present at: /etc/modprobe.d/nvidia-installer-disable-nouveau.conf.  Please be sure you have rebooted your system since these files were written.  If you have rebooted, then Nouveau may be enabled for other reasons, such as being included in the system initial ramdisk or in your X configuration file.  Please consult the NVIDIA driver README and your Linux distribution's documentation for details on how to correctly disable the Nouveau kernel driver.
-> For some distributions, Nouveau can be disabled by adding a file in the modprobe configuration directory.  Would you like nvidia-installer to attempt to create this modprobe file for you? (Answer: Yes)
-> One or more modprobe configuration files to disable Nouveau have been written.  For some distributions, this may be sufficient to disable Nouveau; other distributions may require modification of the initial ramdisk.  Please reboot your system and attempt NVIDIA driver installation again.  Note if you later wish to reenable Nouveau, you will need to delete these files: /etc/modprobe.d/nvidia-installer-disable-nouveau.conf
-> Performing CC sanity check with CC="/usr/bin/cc".
-> Using the kernel source path '/usr/src/linux-hwe-4.10.0' as specified by the '--kernel-source-path' commandline option.
ERROR: Neither the '/usr/src/linux-hwe-4.10.0/include/linux/version.h' nor the '/usr/src/linux-hwe-4.10.0/include/generated/uapi/linux/version.h' kernel header file exists.  The most likely reason for this is that the kernel source files in '/usr/src/linux-hwe-4.10.0' have not been configured.
ERROR: Installation has failed.  Please see the file '/var/log/nvidia-installer.log' for details.  You may find suggestions on fixing installation problems in the README available on the Linux driver download page at www.nvidia.com.

我尝试提供每个版本的内核源代码,/usr/src但仍然遇到同样的问题。

我理解,由于找不到“version.h”,内核源可能不正确。但我不确定我必须提供什么位置,或者我必须下载一些其他源。我重新安装了 Ubuntu 16.04.3,但没有成功。请帮忙,我被困了很长时间。提前谢谢。

答案1

Ubuntu 16.04 上的硬件支持堆栈为您提供了内核 4.10...但是英特尔的 CUDA 文档(指示) 声明支持内核 4.4... 的 Ubuntu 16.04(适用于 CUDA 9,因此 8 类似)。Ubuntu
14.01.1 ISO 附带内核 4.4... 系列。如果您从该 ISO 开始重新安装,您将获得受支持的内核。这可能比在当前系统上安装 4.4 系列然后尝试解开 HWE 堆栈带来的任何其他东西更容易。

尽管如此,如果您符合以下条件,它可能会起作用:

1) 首先安装 Nvidia 专有驱动程序。让它们正常工作,然后再处理 CUDA。

2) 使用 .deb(本地)文件进行安装,而不是 .run 文件。cuda 8.0 下载现已过时,可在以下位置找到:https://developer.nvidia.com/cuda-80-ga2-download-archive cudnn 下载地址为https://developer.nvidia.com/cudnn

 dpkg -i ...deb 

应该这么做。

3) 从 Ubuntu 存储库安装 cuda 包。这样应该会引入 cuda-toolkit 包和您需要的大多数 CUDA 库包。请注意,某些示例可能需要额外的库,但大多数都可以通过上述方法运行。

您似乎缺少必要的内核头文件——它们通常位于 /usr/src/linux-headers-4.... 下,而不是您指定的。.deb 安装没有指定任何内容,所以我不知道您在那里需要什么(一些 .run 文件要求?)。无论如何,上面的链接有关于更改 PATH 和 LD_LIBRARY_PATH 变量以获取必要的 CUDA 二进制文件和库的说明。

相关内容