Ubuntu16.04测试开启GPU加速
来源:互联网 发布:旋转矩阵计算旋转角度 编辑:程序博客网 时间:2024/06/10 04:20
在前面文章中《Ubuntu16.04+GTX1050ti+CUDA8.0+TensorFlow-gpu+keras配置深度学习环境》已经配置好了系统。现在来进行GPU加速测试。
- 测试1:系统自动分配设备
#-*- coding:utf-8 -*-import tensorflow as tf# 新建一个 graph.a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a')b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b')c = tf.matmul(a, b)# 新建session with log_device_placement并设置为True.sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))# 运行这个 op.print(sess.run(c))
你应该能看见以下输出:
Device mapping:/job:localhost/replica:0/task:0/gpu:0 -> device: 0, name: Tesla K40c, pci busid: 0000:05:00.0b: /job:localhost/replica:0/task:0/gpu:0a: /job:localhost/replica:0/task:0/gpu:0MatMul: /job:localhost/replica:0/task:0/gpu:0[[ 22. 28.] [ 49. 64.]]
- 测试2:手动指定分配设备
#-*- coding:utf-8 -*-import tensorflow as tf# 新建一个graph.with tf.device('/cpu:0'): a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a') b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b')c = tf.matmul(a, b)# 新建session with log_device_placement并设置为True.sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))# 运行这个op.print(sess.run(c))
你应该能看见以下输出,a 和 b 操作都被指派给了 cpu:0。
Device mapping:/job:localhost/replica:0/task:0/gpu:0 -> device: 0, name: Tesla K40c, pci busid: 0000:05:00.0b: /job:localhost/replica:0/task:0/cpu:0a: /job:localhost/replica:0/task:0/cpu:0MatMul: /job:localhost/replica:0/task:0/gpu:0[[ 22. 28.] [ 49. 64.]]
- 测试3:跑个TensorFlow的小程序。代码见百度云盘
参考文献:
- Using GPUs
- 使用 GPUs
阅读全文
0 0
- Ubuntu16.04测试开启GPU加速
- ubuntu16.04下安装TensorFlow(GPU加速)
- ubuntu16.04下安装TensorFlow(GPU加速)----详细图文教程
- caffe安装+Ubuntu16.04+三显卡gpu加速
- ubuntu16.04下安装TensorFlow(GPU加速)----详细图文教程
- ubuntu16.04下安装TensorFlow(GPU加速)----详细图文教程
- ubuntu16.04下安装TensorFlow(GPU加速)----详细图文教程
- ubuntu16.04下安装TensorFlow(GPU加速)----详细图文教程
- ubuntu16.04下opencv3.3 GPU(CUDA)加速
- 测试gpu的加速比
- 开启浏览器的GPU加速功能
- PS 开启GPU加速图片处理
- tensorflow学习笔记十一:ubuntu16.04下安装TensorFlow(GPU加速)----详细图文教程
- Tensorflow在ubuntu16.04下的安装(GPU加速版)
- 深度学习篇——Ubuntu16.04下安装caffe(GPU加速)
- 深度学习 ubuntu16.04 theano tensorflow cuda cudnn 搭建gpu加速,亲测有效
- Ubuntu16下的ThensorFlow环境配置(GPU加速)
- ubuntu16.04安装vmware后集成显卡如何开启3D加速的问题解决思路
- 第一次配置java环境变量
- spark的自定义partitioner
- jQuery EasyUI中的Layout布局
- 关于一次云服务器tomcat误删经历
- 字符串逆序输出
- Ubuntu16.04测试开启GPU加速
- 如何保持数据库和缓存的一致性
- HDU 6035 Colorful Tree 树上统计 联通块
- HDU6304(Balala Power!)
- Source Tree for Mac 不断提示输入密码
- [Scala]Scala学习笔记三 Map与Tuple
- 线程特性以及常用术语
- 小程序及语音转文字
- zoj2770(差分约束)火烧连营