今天发现一个怪现象,在训练keras时,发现不使用GPU进行计算,而是采用CPU进行计算,导致计算速度很慢。

用如下代码可检测tensorflow的能使用设备情况:

from tensorflow.python.client import device_lib
print(device_lib.list_local_devices()) 

可用设备为:

[name: "/device:CPU:0"
device_type: "CPU"
memory_limit: 268435456
locality {
}]  

原来只有一个CPU设备可用了。于是检查下tensorflow的版本情况:

pip3 list

各应用版本为:

tensorflow          1.10.1
tensorflow-gpu 1.9.0

原来我升级了tensorflow版本,忘记了升级tensorflow-gpu版本,现在两个版本有代差,而tensorflow默认选择版本高的CPU版本来计算了。

那就升级tensorflow-gpu吧:

pip3 install --index-url http://pypi.douban.com/simple --trusted-host pypi.douban.com --upgrade tensorflow-gpu

再次检测可用设备情况,结果如下:

-- ::22.996654: I tensorflow/core/common_runtime/gpu/gpu_device.cc:] Found device  with properties:
name: GeForce GTX 5GB major: minor: memoryClockRate(GHz): 1.7085
pciBusID: ::00.0
totalMemory: .94GiB freeMemory: .23GiB
-- ::22.996666: I tensorflow/core/common_runtime/gpu/gpu_device.cc:] Adding visible gpu devices:
-- ::23.189923: I tensorflow/core/common_runtime/gpu/gpu_device.cc:] Device interconnect StreamExecutor with strength edge matrix:
-- ::23.189953: I tensorflow/core/common_runtime/gpu/gpu_device.cc:]
-- ::23.189959: I tensorflow/core/common_runtime/gpu/gpu_device.cc:] : N
-- ::23.190105: I tensorflow/core/common_runtime/gpu/gpu_device.cc:] Created TensorFlow device (/device:GPU: with MB memory) -> physical GPU (device: , name: GeForce GTX 5GB, pci bus id: ::00.0, compute capability: 6.1)
[name: "/device:CPU:0"
device_type: "CPU"
memory_limit:
locality {
}
incarnation:
, name: "/device:GPU:0"
device_type: "GPU"
memory_limit:
locality {
bus_id:
links {
}
}
incarnation:
physical_device_desc: "device: 0, name: GeForce GTX 1060 5GB, pci bus id: 0000:01:00.0, compute capability: 6.1"
]

tensorflow 使用CPU而不使用GPU的问题解决的更多相关文章

  1. tensorflow 使用 cpu 而不使用 gpu 问题

    查看 tensorflow 版本 conda list 例如发现 tensorflow 1.10.0 tensorflow-gpu 1.10.0 当两个版本相同时,默认会使用 cpu 版本 如果同时存 ...

  2. TensorFlow在Windows上的CPU版本和GPU版本的安装指南(亲测有效)

    安装说明 平台:Window.Ubuntu.Mac等操作系统 版本:支持GPU版本和CPU版本 安装方式:pip方式.Anaconda方式 attention: 在Windows上目前支持python ...

  3. 谈谈TensorFlow with CPU support or TensorFlow with GPU support(图文详解)

    不多说,直接上干货! You must choose one of the following types of TensorFlow to install: TensorFlow with CPU ...

  4. TensorFlow指定CPU和GPU方法

    TensorFlow指定CPU和GPU方法 TensorFlow 支持 CPU 和 GPU.它也支持分布式计算.可以在一个或多个计算机系统的多个设备上使用 TensorFlow. TensorFlow ...

  5. tensor搭建--windows 10 64bit下安装Tensorflow+Keras+VS2015+CUDA8.0 GPU加速

    windows 10 64bit下安装Tensorflow+Keras+VS2015+CUDA8.0 GPU加速 原文见于:http://www.jianshu.com/p/c245d46d43f0 ...

  6. 学习笔记TF046:TensoFlow开发环境,Mac、Ubuntu/Linux、Windows,CPU版本、GPU版本

    下载TensorFlow https://github.com/tensorflow/tensorflow/tree/v1.1.0 .Tags选择版本,下载解压. pip安装.pip,Python包管 ...

  7. Ubuntu16.04基于Anaconda(py3.6)安装TensorFlow(CPU)的方法

    安装tensorflow(cpu版) 对anaconda命令的熟悉,可以参考http://www.jianshu.com/p/d2e15200ee9b 官方的建议是即时你有gpu,但也可以先装一个cp ...

  8. windows10(64位)Anaconda3+Python3.6搭建Tensorflow(cpu版本)及keras

    转自:windows10(64位)Anaconda3+Python3.6搭建Tensorflow(cpu版本)及keras 1.本来电脑安装的是anaconda3 5.3.1,但安装的python版本 ...

  9. CentOS7.4,anaconda3,python3.6,tensorflow环境下gdal的编译和问题解决

    CentOS7.4,anaconda3,python3.6,tensorflow环境下gdal的编译和问题解决 这是gdal可能会用到的额外的包,按自己需要先提前编译. 这里的话我主要用了proj,L ...

随机推荐

  1. geeksforgeeks-Array-Rotation and deletion

      As usual Babul is again back with his problem and now with numbers. He thought of an array of numb ...

  2. 不修改加密文件名的勒索软件TeslaCrypt 4.0

    不修改加密文件名的勒索软件TeslaCrypt 4.0 安天安全研究与应急处理中心(Antiy CERT)近期发现勒索软件TeslaCrypt的最新变种TeslaCrypt 4.0,它具有多种特性,例 ...

  3. WPF开发中的多线程的问题

    今天帮助同事做了一个WPF版的多线程demo,分享给大家. 要实现的问题就是非主线程thread1 去后台不停的取新数据,当有新数据的时候就会展示到前台. 我给他做的demo实现一个按秒的计数器,随着 ...

  4. [转]GDB-----1.GDB概述

    作者: liigo原文链接: http://blog.csdn.net/liigo/archive/2006/01/17/582231.aspx 1.前言 本文写给主要工作在Windows操作系统下而 ...

  5. 去除Many2one字段的“创建并编辑”选项

    要去除Many2one字段的“创建并编辑”选项,只要在view.xml里对应的field定义里增加options="{'no_create_edit':1}即可 <field name ...

  6. vue系列之过渡效果

    参考地址:http://cn.vuejs.org/v2/guide/transitions.html vue2.0,要想实现过渡效果,要用transition组件 代码: <div id=&qu ...

  7. springMVC源码分析--FlashMap和FlashMapManager重定向数据保存

    在上一篇博客springMVC源码分析--页面跳转RedirectView(三)中我们看到了在RedirectView跳转时会将跳转之前的请求中的参数保存到fFlashMap中,然后通过FlashMa ...

  8. Android Monkey压力测试环境搭建及使用

    Android Monkey压力测试学习笔记 步骤:下载SDK -> 解压进入SDK Manager下载系统 -> 配置环境变量 -> 创建虚拟设备或连接真机 -> 进入命令模 ...

  9. 线上Slave报1062的案例

    最近经常线上的Slave老报1062的错误,蛋碎一地,幸好Slave暂时没有用到业务上,也就是说没有做读写分离,所以Slave有问题,影响也不大,但每隔一阵子就报1062主键冲突的错误,让我好纠结,如 ...

  10. Crack相关

    Microsoft Office 2007专业增强版密钥:KXFDR-7PTMK-YKYHD-C8FWV-BBPVWM7YXX-XJ8YH-WY349-4HPR9-4JBYJCTKXX-M97FT-8 ...