Search code examples
google-colaboratory

Google-colaboratory: No backend with GPU available


Here it is described how to use gpu with google-colaboratory:

Simply select "GPU" in the Accelerator drop-down in Notebook Settings (either through the Edit menu or the command palette at cmd/ctrl-shift-P).

However, when I select gpu in Notebook Settings I get a popup saying:

Failed to assign a backend No backend with GPU available. Would you like to use a runtime with no accelerator?

When I run:

import tensorflow as tf
device_name = tf.test.gpu_device_name()
if device_name != '/device:GPU:0':
    raise SystemError('GPU device not found')
print('Found GPU at: {}'.format(device_name))

Of course, I get GPU device not found. It seems the description is incomplete. Any ideas what needs to be done?


Solution

  • You'll need to try again later when a GPU is available. The message indicates that all available GPUs are in use.

    The FAQ provides additional info:

    How may I use GPUs and why are they sometimes unavailable?

    Colaboratory is intended for interactive use. Long-running background computations, particularly on GPUs, may be stopped. Please do not use Colaboratory for cryptocurrency mining. Doing so is unsupported and may result in service unavailability. We encourage users who wish to run continuous or long-running computations through Colaboratory’s UI to use a local runtime.

    There seems to be a cooldown on continuous training with GPUs. So, if you encounter the error dialog, try again later, and perhaps try to limit long-term training in subsequent sessions.