Reputation: 39
I am trying to run my notebook using a GPU on Google Colab, but it doesn't provide me a GPU, however when I run the notebook with tensorflow 1.15.0, the GPU is available.
tf.test.gpu_device_name()
gives the output
'/device:GPU:0'
for tensorflow 1.15.0
But when I do the same with tensorflow 2.0.0 the function returns ''
.
Upvotes: 4
Views: 12480
Reputation: 1
According to https://colab.research.google.com/notebooks/gpu.ipynb#scrollTo=oM_8ELnJq_wd
You'll need to enable GPUs for the notebook:
Upvotes: 0
Reputation: 51
try
%tensorflow_version 2.x
import tensorflow as tf
print(tf.__version__)
print(tf.test.gpu_device_name())
print("Num GPUs Available: ", len(tf.config.experimental.list_physical_devices('GPU')))
Upvotes: 5
Reputation: 38674
This is a bug related to 2.0 being incompatible with a recent CUDA 10.1 upgrade on Colab.
The relevant GitHub issue to follow is: https://github.com/googlecolab/colabtools/issues/864
Upvotes: 2
Reputation: 141
I solved installing in google colab
!pip install tensorflow-gpu
and
!pip install tf-nightly
So now tf.test.gpu_device_name()
, the output is /device:GPU:0
But, TensorFlow automatically upgrade its version to 2.1.0-dev20191120
Upvotes: 7