TensorFlow:调用 cuInit 失败:CUDA_ERROR_NO_DEVICE [英] TensorFlow : failed call to cuInit: CUDA_ERROR_NO_DEVICE

查看:50
本文介绍了TensorFlow:调用 cuInit 失败:CUDA_ERROR_NO_DEVICE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的测试:

import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()`

错误:

c:\l\work\tensorflow-1.1.0\tensorflow\stream_executor\cuda\cuda_driver.cc:405]

c:\l\work\tensorflow-1.1.0\tensorflow\stream_executor\cuda\cuda_driver.cc:405]

调用 cuInit 失败:CUDA_ERROR_NO_DEVICE

failed call to cuInit: CUDA_ERROR_NO_DEVICE

-> 但 "/cpu:0" 工作正常

-> but "/cpu:0" works fine

配置:

nvidia-smi :

nvidia-smi :

  • CUDA 9.1 版
  • tensorflow-1.1.0
  • Windows 10
  • cudnn64_7.dll(安装在 C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.1\bin)
  • 我的 Conda 环境中仅安装了 tensorflow-gpu

为什么 Tensorflow 检测不到我的 GPU?

Why can't Tensorflow detect my GPU ?

推荐答案

问题已解决 on GitHub.如果您为 CUDA_VISIBLE_DEVICES 环境变量设置了无效值,则会显示此错误消息,例如当您只有一个 GPU(ID 0)并设置 CUDA_VISIBLE_DEVICES=1CUDA_VISIBLE_DEVICES=2 时.

The issue was solved on GitHub. This error message will be shown if you set an invalid value for the CUDA_VISIBLE_DEVICES environment variable, e.g. when you only have a single GPU (which has ID 0) and set CUDA_VISIBLE_DEVICES=1 or CUDA_VISIBLE_DEVICES=2.

这篇关于TensorFlow:调用 cuInit 失败:CUDA_ERROR_NO_DEVICE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆