Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TensorFlow : failed call to cuInit: CUDA_ERROR_NO_DEVICE

My test :

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

Error :

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

failed call to cuInit: CUDA_ERROR_NO_DEVICE

-> but "/cpu:0" works fine

Config :

nvidia-smi : enter image description here

  • CUDA Version 9.1
  • tensorflow-1.1.0
  • Windows 10
  • cudnn64_7.dll (installed in C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.1\bin)
  • Only tensorflow-gpu is installed in my Conda environment

Why can't Tensorflow detect my GPU ?

like image 629
Vincent Roye Avatar asked Feb 07 '18 07:02

Vincent Roye


1 Answers

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.

like image 193
mrry Avatar answered Oct 12 '22 14:10

mrry