我正在尝试使用GPU在Google Colab中训练模型
我做到了:
Edit→Notebook Settings
select GPU from the Hardware Accelerator drop-down
我安装了我的项目需要的特定版本:
tensorboard==1.12.2
tensorflow==1.12.0
Keras==2.2.4
Keras-Applications==1.0.6
Keras-Preprocessing==1.0.5
然后,当我跑步时:
from tensorflow.python.client import device_lib
import tensorflow as to
print(device_lib.list_local_devices())
tf.test.is_gpu_available()
我得到:
[name: "/device:CPU:0"
device_type: "CPU"
memory_limit: 268435456
locality {
}
incarnation: 14765383507671724357
, name: "/device:XLA_CPU:0"
device_type: "XLA_CPU"
memory_limit: 17179869184
locality {
}
incarnation: 9874560735213287977
physical_device_desc: "device: XLA_CPU device"
]
False
如何使用GPU?
答案 0 :(得分:0)
安装以下内容可以解决问题:
!wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_9.0.176-1_amd64.deb
!wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/libcudnn7_7.0.5.15-1+cuda9.0_amd64.deb
!wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/libcudnn7-dev_7.0.5.15-1+cuda9.0_amd64.deb
!wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/libnccl2_2.1.4-1+cuda9.0_amd64.deb
!wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/libnccl-dev_2.1.4-1+cuda9.0_amd64.deb
!wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/libcudnn7_7.1.4.18-1+cuda9.0_amd64.deb
!sudo dpkg -i cuda-repo-ubuntu1604_9.0.176-1_amd64.deb
!sudo dpkg -i libcudnn7_7.0.5.15-1+cuda9.0_amd64.deb
!sudo dpkg -i libcudnn7-dev_7.0.5.15-1+cuda9.0_amd64.deb
!sudo dpkg -i libnccl2_2.1.4-1+cuda9.0_amd64.deb
!sudo dpkg -i libnccl-dev_2.1.4-1+cuda9.0_amd64.deb
!sudo apt-get update
!sudo apt-get install cuda=9.0.176-1
!sudo apt-get install libcudnn7-dev
!sudo dpkg -i libcudnn7_7.1.4.18-1+cuda9.0_amd64.deb
!sudo apt-get install libnccl-dev