结果进来使用Densenet121图像分类,发现很慢,1个epoch要2700s,实在是无法忍受,采用平台是linux的高性能计算机,不该这么慢啊!如下图所示。
检查设备使用cpu情况:
from tensorflow.python.client import device_lib
print(device_lib.list_local_devices())
结果如下图,应该有GPU可以用。检查软件版本:
pip3 list
结果显示:
缺少tensorflow-gpu版软件,那就安装一下吧。采用国内豆瓣镜像资源能快些
pip3 install --index-url http://pypi.douban.com/simple --trusted-host pypi.douban.com --upgrade tensorflow-gpu
再次检查设备情况:
显示:RuntimeError: CUDA runtime implicit initialization on GPU:0 failed. Status: out of memory
用下面命令检查:
import tensorflow as tf
print(tf.__version__)
print(tf.test.is_built_with_cuda())
print(tf.test.is_gpu_available())
结果如下:
用nvidia-msi 命令检查:
内存被占满了,进程PID :28582,进行杀死。
kill -9 28582
再次检查: