Ubuntu 17.04上安装CUDA出现错误

4
   abigail@abilina:~/Downloads$ sudo dpkg -i cuda-repo-ubuntu1604_8.0.61-1_amd64.deb
Selecting previously unselected package cuda-repo-ubuntu1604.
(Reading database ... 205999 files and directories currently installed.)
Preparing to unpack cuda-repo-ubuntu1604_8.0.61-1_amd64.deb ...
Unpacking cuda-repo-ubuntu1604 (8.0.61-1) ...
Setting up cuda-repo-ubuntu1604 (8.0.61-1) ...
Warning: The postinst maintainerscript of the package cuda-repo-ubuntu1604
Warning: seems to use apt-key (provided by apt) without depending on gnupg or gnupg2.
Warning: This will BREAK in the future and should be fixed by the package maintainer(s).
Note: Check first if apt-key functionality is needed at all - it probably isn't!
Warning: apt-key should not be used in scripts (called from postinst maintainerscript of the package cuda-repo-ubuntu1604)
OK

abigail@abilina:~/Downloads$ sudo apt-get install cuda
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 cuda : Depends: cuda-8-0 (>= 8.0.61) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

我的Ubuntu版本是17.04,这是否意味着我的Linux无法安装CUDA?我希望能安装支持GPU的TensorFlow。
abigail@abilina:~/Downloads$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

2
如果你仔细阅读了发布说明,就会知道CUDA 8不支持Ubuntu 17。这个问题完全不属于[SO]的范畴,我已经投票将其关闭。 - talonmies
看起来支持cuda 8:https://launchpad.net/ubuntu/zesty/amd64/nvidia-cuda-toolkit。在版本列中显示为8.0.44-3,或者我漏掉了什么吗? - galath
5个回答

3

我已经成功地在Ubuntu 17.04上安装了CUDA 8.0和NVIDIA的最新补丁:

  1. https://developer.nvidia.com/cuda-downloads下载.run文件,选择Ubuntu 16.04 (基本安装程序)。
  2. 不能直接运行安装程序进行安装,因为它正在寻找一个名为InstallUtils.pm的文件,在Ubuntu 17.04中没有出现,但奇怪的是,在.run文件中出现了-所以:使用./cuda*.run --tar mxvf解压该文件。
  3. 将InstallUtils.pm(应该在/bin路径中)复制到/usr/lib/x86_64-linux-gnu/perl-base中。
  4. 运行安装程序(您可能想拒绝驱动程序安装步骤以保留通过apt安装的驱动程序-我正在使用381.22,因为由.run文件提供的375.26不支持我的1080ti)。
  5. GCC 6与CUDA不兼容,但是可以轻松解决编译样例文件的问题:只需将export EXTRA_NVCCFLAGS="-Xcompiler -std=c++98"添加到bashrc文件中,并注释掉其中一些头文件的代码。

(我认为是host_config.h,但当您尝试编译时,您会看到它)-注释掉这些行:

#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ > 3)
     #error -- unsupported GNU version! gcc versions later than 5.3 are not supported!

这些都是我凭记忆回答,希望足够准确。

感谢以下有用的帖子,我通过它们找到了解决方案:

https://devtalk.nvidia.com/default/topic/983777/can-t-locate-installutils-pm-in-inc/

https://devtalk.nvidia.com/default/topic/949770/cuda-8-0rc-supporting-gcc6-/


在执行“--tar”之前,您可能需要先执行“sudo chmod a+x cuda*”。 - wordsforthewise

3
以下是翻译的内容:

这里 是正确的链接。

apt-get install nvidia-cuda-toolkit

但请注意,通过apt安装的CUDA被安装在不同的位置。需要手动在 /usr/local/cuda 中创建符号链接,分别针对includelib64bin


有没有一种简单的方法可以知道哪些文件属于CUDA,以便创建这些符号链接?它似乎将CUDA文件放在通用的bin include和lib路径中...此外,是否有一种获取CUDA示例文件的方法? - Mr.WorshipMe
@Mr.WorshipMe,你可以从Nvidia CUDA下载页面解压捆绑软件包来获取样例。也可以使用dpkg -L package-name命令获取已安装位置(可能是一个很长的列表)。 - skywalkerytx

1

1
更精确地说,这是我做的事情:
在Ubuntu 17.04上安装CUDA 9.0 - 您目前可以下载beta版本https://developer.nvidia.com/cuda-release-candidate-download 我下载了.deb文件,并没有遇到任何问题 - 当您下载cuda 9.0时,请按照他们推荐的步骤进行操作
sudo dpkg -i cuda-repo-ubuntu1704-9-0-local-rc_9.0.103-1_amd64.deb
sudo apt-key add /var/cuda-repo-9.0-local-rc/7fa2af80.pub
sudo apt-get update sudo apt-get install cuda
然后按照nvidia指令的后续安装步骤进行操作(即设置PATH和LD_LIBRARY_PATH)http://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#post-installation-actions

export PATH=/usr/local/cuda-9.0/bin${PATH:+:${PATH}}

export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64 ${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

Cuda 9与gcc 6.3.0兼容(17.04自带)。我使用arch=sm_52,有时需要运行'make clean'来编译我的文件。


0

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接