我正在尝试在Google Colab上使用GPU运行笔记本,但它没有为我提供GPU。然而,当我使用tensorflow 1.15.0运行笔记本时,GPU是可用的。
tf.test.gpu_device_name()
在tensorflow 1.15.0中,该函数输出'/device:GPU:0'
但是,在tensorflow 2.0.0中,相同的函数返回''
。
我正在尝试在Google Colab上使用GPU运行笔记本,但它没有为我提供GPU。然而,当我使用tensorflow 1.15.0运行笔记本时,GPU是可用的。
tf.test.gpu_device_name()
在tensorflow 1.15.0中,该函数输出'/device:GPU:0'
但是,在tensorflow 2.0.0中,相同的函数返回''
。
!pip install tensorflow-gpu
!pip install tf-nightly
现在运行 tf.test.gpu_device_name()
,输出结果是 /device:GPU:0
。
但是,TensorFlow自动升级到了版本2.1.0-dev20191120
%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')))
这是一个与Colab最近升级的CUDA 10.1不兼容的2.0相关的错误。
关注相关的GitHub问题: https://github.com/googlecolab/colabtools/issues/864