【问题标题】:cudaGetDevice() failed. Status: CUDA driver version is insufficient for CUDA runtime version (on GCP - Ubuntu 18 LTS running in VNC GUI)cudaGetDevice() 失败。状态:CUDA 驱动程序版本对于 CUDA 运行时版本不足(在 GCP 上 - 在 VNC GUI 中运行的 Ubuntu 18 LTS)
【发布时间】:2020-01-22 16:52:32
【问题描述】:

我已经按照link 来按顺序获取我的所有版本:

我需要将 Tensorflow_GPU_1.14.0 用于遗留代码。

因此:

tensorflow_gpu-1.14.0
Python:2.7、3.3-3.7
cuDnn:7.4
库达:10.0

import tensorflow as tf; print(tf.__version__)

返回 1.14.0

我的 nvcc 版本是:

nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2018 NVIDIA Corporation
Built on Sat_Aug_25_21:08:01_CDT_2018
Cuda compilation tools, release 10.0, V10.0.130

我的 nvidia-smi 是:

nvidia-smi
Wed Jan 22 16:47:10 2020       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 410.104      Driver Version: 410.104      CUDA Version: 10.0     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  Tesla K80           Off  | 00000000:00:04.0 Off |                    0 |
| N/A   47C    P8    31W / 149W |     27MiB / 11441MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0      2524      G   /usr/lib/xorg/Xorg                             9MiB |
|    0      2574      G   /usr/bin/gnome-shell                           6MiB |
+-----------------------------------------------------------------------------+

我的 Cudnn 版本是:

cat /usr/include/cudnn.h | grep CUDNN_MAJOR -A 2
#define CUDNN_MAJOR 7
#define CUDNN_MINOR 4
#define CUDNN_PATCHLEVEL 2
--
#define CUDNN_VERSION (CUDNN_MAJOR * 1000 + CUDNN_MINOR * 100 + CUDNN_PATCHLEVEL)
#include "driver_types.h"

我的python版本:

import sys

print(sys.version)
3.6.10 |Anaconda, Inc.| (default, Jan  7 2020, 21:14:29) 
[GCC 7.3.0]

我使用的是 Ubuntu 18.04 LTS

【问题讨论】:

  • 为您的 GPU 安装最新的驱动程序。 410.104 不是 Tesla K80 的最新版本。我将无法辩论版本或“这应该有效”。很明显,您已经或正在尝试使用 410.104(可能是 CUDA 10.1 或 CUDA 10.2 - 它们不受 410.xx 驱动程序支持)不支持的 CUDA 版本(同样,可能通过 anaconda)。另一种可能性是您的 GPU 驱动程序是从 NVIDIA 以外的来源安装的,它可能没有打包 CUDA 计算任务所需的所有内容。无论哪种情况,建议都是一样的。
  • @RobertCrovella 请接受我拖累这个的道歉。我非常感谢您在这方面的投入和时间。我现在已将其更新为 440 并修复了该问题。先生,感谢您的宝贵时间。

标签: python ubuntu cuda nvidia


【解决方案1】:

为了在下面的评论部分扩展 Robert 的答案,我首先使用卸载了现有的 nvidia

sudo apt-get purge nvidia-*

然后使用安装最新版本

sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update
sudo apt upgrade
ubuntu-drivers list

然后从我选择的列表中

sudo apt install nvidia-driver-VERSION_NUMBER_HERE

然后我sudo reboot我的实例,并在 Jupyter notebook 中执行了以下代码。

import tensorflow as tf
print(('Is your GPU available for use?\n{0}').format(
    'Yes, your GPU is available: True' if tf.test.is_gpu_available() == True else 'No, your GPU is NOT available: False'
))

print(('\nYour devices that are available:\n{0}').format(
    [device.name for device in tf.config.experimental.list_physical_devices()]
))

成功了

【讨论】:

    猜你喜欢
    • 2019-02-20
    • 1970-01-01
    • 2017-05-15
    • 2011-03-16
    • 2019-12-31
    • 2017-04-14
    • 2021-02-07
    • 1970-01-01
    • 2017-03-07
    相关资源
    最近更新 更多