Skip to content

Instantly share code, notes, and snippets.

@Quasimondo
Last active November 19, 2024 13:12
Show Gist options
  • Select an option

  • Save Quasimondo/7e1068e488e20f194d37ba80696b55d8 to your computer and use it in GitHub Desktop.

Select an option

Save Quasimondo/7e1068e488e20f194d37ba80696b55d8 to your computer and use it in GitHub Desktop.

Revisions

  1. Quasimondo revised this gist Dec 30, 2020. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,9 @@ Typcially it looks like this:
    2020-12-30 17:31:42.150368: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcuda.so.1
    2020-12-30 17:31:42.176643: E tensorflow/stream_executor/cuda/cuda_driver.cc:328] failed call to cuInit: CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected

    Here is a solution that currently seems to work on my system, with Cuda 11.0 and Tensorflow 2.4.0, you can try it if all the other 500 proposed fixes did not work for you:
    Here is a solution that currently seems to work on my system,
    with Cuda 11.0 and Tensorflow 2.4.0, you can try it if all the
    other 500 proposed fixes did not work for you:

    Add these two lines at the very top of your script BEFORE any call to "import tensorflow":

    @@ -15,3 +17,6 @@ device_lib.list_local_devices()

    That's all suddenly it works. I have no clue why.

    If that did not help, here are a few other things you can try:
    https://victorwyee.com/engineering/failed-call-to-cuinit-cuda-error-unknown/

  2. Quasimondo revised this gist Dec 30, 2020. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,12 +1,12 @@
    This is a dreaded error that seems pop up its ugly head again and again, in particular after uprading CUDA or Tensorflow.
    This is a dreaded error that seems pop up its ugly head again and again, in particular after upgrading CUDA or Tensorflow.
    Typcially it looks like this:

    2020-12-30 17:31:40.829615: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudart.so.11.0
    2020-12-30 17:31:42.149768: I tensorflow/compiler/jit/xla_cpu_device.cc:41] Not creating XLA devices, tf_xla_enable_xla_devices not set
    2020-12-30 17:31:42.150368: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcuda.so.1
    2020-12-30 17:31:42.176643: E tensorflow/stream_executor/cuda/cuda_driver.cc:328] failed call to cuInit: CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected

    Here is a solution that currently seems to work on my system, with Cuda 11-0 and Tensorflow 2.4.0, you can try it if all the other 500 proposed fixes did not work for you:
    Here is a solution that currently seems to work on my system, with Cuda 11.0 and Tensorflow 2.4.0, you can try it if all the other 500 proposed fixes did not work for you:

    Add these two lines at the very top of your script BEFORE any call to "import tensorflow":

  3. Quasimondo created this gist Dec 30, 2020.
    17 changes: 17 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    This is a dreaded error that seems pop up its ugly head again and again, in particular after uprading CUDA or Tensorflow.
    Typcially it looks like this:

    2020-12-30 17:31:40.829615: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudart.so.11.0
    2020-12-30 17:31:42.149768: I tensorflow/compiler/jit/xla_cpu_device.cc:41] Not creating XLA devices, tf_xla_enable_xla_devices not set
    2020-12-30 17:31:42.150368: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcuda.so.1
    2020-12-30 17:31:42.176643: E tensorflow/stream_executor/cuda/cuda_driver.cc:328] failed call to cuInit: CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected

    Here is a solution that currently seems to work on my system, with Cuda 11-0 and Tensorflow 2.4.0, you can try it if all the other 500 proposed fixes did not work for you:

    Add these two lines at the very top of your script BEFORE any call to "import tensorflow":

    from tensorflow.python.client import device_lib
    device_lib.list_local_devices()

    That's all suddenly it works. I have no clue why.