cudaGetDevice()失败了。状态:CUDA驱动程序版本不足以用于CUDA运行时版本

问题描述 投票:3回答:4

当我在GPU中运行tensorflow时,我收到以下错误。

2018-09-15 18:56:51.011724: E tensorflow/core/common_runtime/direct_session.cc:158] Internal: cudaGetDevice() failed. Status: CUDA driver version is insufficient for CUDA runtime version
Traceback (most recent call last):
  File "evaluate_sample.py", line 160, in <module>
    tf.app.run(main)
  File "/anaconda3/envs/tf/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 125, in run
    _sys.exit(main(argv))
  File "evaluate_sample.py", line 123, in main
    with tf.Session() as sess:
  File "/anaconda3/envs/tf/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1494, in __init__
    super(Session, self).__init__(target, graph, config=config)
  File "/anaconda3/envs/tf/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 626, in __init__
    self._session = tf_session.TF_NewSession(self._graph._c_graph, opts)
tensorflow.python.framework.errors_impl.InternalError: Failed to create session.

以下错误来自哪里?

E tensorflow/core/common_runtime/direct_session.cc:158] Internal: cudaGetDevice() failed. Status: CUDA driver version is insufficient for CUDA runtime version

和tensorflow.python.framework.errors_impl.InternalError:无法创建会话。

这样我的版本:

tensorflow是:1.10

cat /proc/driver/nvidia/version

NVRM版本:NVIDIA UNIX x86_64内核模块390.77 Tue Jul 10 18:28:52 PDT 2018

GCC版本:gcc版本7.3.0(Debian 7.3.0-28)

nvcc --version

nvcc:NVIDIA(R)Cuda编译器驱动程序

版权所有(c)2005-2016 NVIDIA Corporation

建立在Sun_Sep__4_22:14:01_CDT_2016之上

Cuda编译工具,8.0版,V8.0.44

python-2.7 tensorflow cuda
4个回答
4
投票

在刚刚解决的情况下,它将GPU驱动程序更新为最新版并安装cuda工具包。您的错误告诉您CUDA驱动程序版本太旧了。我相信我们看到的nvcc版本是7.5,你有7.3。

我想你要做的就是:sudo apt install nvidia-cuda-toolkit然后重启。

以下是我针对无法找到libcuda.so.1文件的问题所采取的步骤。

首先,添加了ppa并安装了更新的GPU驱动程序:

sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update
sudo apt install nvidia-390

添加ppa后,它显示了驱动程序版本的选项,而390是显示的最新“稳定”版本。

然后安装cuda工具包:

sudo apt install nvidia-cuda-toolkit

然后重启:

sudo reboot

它将驱动程序更新为比第一步中最初安装的390更新的版本(它是410;这是AWS上的p2.xlarge实例)。


2
投票

出现此错误的原因是您安装的Cuda Toolkit版本与python包cudatoolkit的版本不匹配,后者通常作为tensorflow-gpu的依赖项安装。

为了解决这个问题,你必须首先将你的tensorflow版本与已安装的Cuda Toolkit版本匹配,如图所示here

然后你必须检查你的cudatoolkit包的版本。这必须匹配主要版本和次要版本,例如如果你安装了Cuda Toolkit 9.0并安装了cudatoolkit9_1,你需要通过你的python降级到cudatoolkit9。


2
投票

更新nvidia驱动程序解决了这个问题。

你可以查看你的cuda工具包兼容性qazxsw poi。然后从qazxsw poi下载更新你的nvidia驱动程序。


-1
投票

对于Ubuntu 18.04和Tensorflow 1.13.1

首先确保系统符合数据:

here

安装以后的驱动:

here

打开软件和更新,然后选择其他驱动程序选项卡:

选择nvidia-driver-396,然后单击Apply Changes

现在重启:

sudo apt update
sudo apt dist-upgrade
sudo reboot now

要验证哪个NVIDIA驱动程序396处于活动状态:

sudo add-apt-repository ppa:graphics-drivers/ppa
© www.soinside.com 2019 - 2024. All rights reserved.