今天发现一个怪现象,在训练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"
]

最新文章

  1. Android 浮窗开发之窗口层级
  2. iOS开发中获取WiFi相关信息
  3. 谈一谈PHP的代码重构
  4. iframe框架里镶嵌页面;<marquee>:滚动效果;<mark>做标记;内联、内嵌、外联;选择器
  5. [转载] tmux 使用指南
  6. java网络编程serversocket
  7. import了sun开头的类,虽然它在代码里压根就没派上用处!但是必须得引用!
  8. 注册码 myeclipse6.5-6.8
  9. MyBatis学习总结_18_MyBatis与Hibernate区别
  10. Winform webBrowser 不跳转网页
  11. sql Mirroring
  12. [微信小程序] 终于可以愉快的使用 async/await 啦
  13. [Javascript] Promise
  14. 第二章:shiro身份验证
  15. ansible基础-理解篇
  16. Learning-Python【20】:Python常用模块(3)—— shelve、pickle、json、xml、configparser
  17. 基于Kafka消息驱动最终一致事务(二)
  18. 1000多块整个插板,arduino + android 蓝牙插板的实现--屌丝版
  19. warning,C4996,sprintf,deprecated,C4996,strcpy,C4996,strcat
  20. POJ1087 A Plug for UNIX 2017-02-12 13:38 40人阅读 评论(0) 收藏

热门文章

  1. Spring使用注解和struts集成
  2. Shiro简介及入门(四)
  3. Java 集合系列0、概述
  4. ll(ls -l) 列属性
  5. mysql通过centos本地命令行还原数据库出现乱码问题
  6. centos6.7环境下kvm虚拟机之virt-install和virsh及virt-manager工具的使用
  7. Expm 2_1 k-路合并操作问题
  8. Linux下进程/程序网络带宽占用情况查看工具 -- NetHogs
  9. STM32应用实例七:与宇电设备实现AI-BUS通讯
  10. 测试开发之Django——No8.Django中的视图与URL配置