温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

ubuntu中怎么测试gpu性能

发布时间:2022-11-21 16:30:07 阅读:785 作者:iii 栏目:服务器
Ubuntu服务器限时活动,0元免费领,库存有限,领完即止! 点击查看>>

这篇“ubuntu中怎么测试gpu性能”文章的知识点大部分人都不太理解,所以小编给大家总结了以下内容,内容详细,步骤清晰,具有一定的借鉴价值,希望大家阅读完这篇文章能有所收获,下面我们一起来看看这篇“ubuntu中怎么测试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.]]

以上就是关于“ubuntu中怎么测试gpu性能”这篇文章的内容,相信大家都有了一定的了解,希望小编分享的内容对大家有帮助,若想了解更多相关的知识内容,请关注亿速云行业资讯频道。

亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI

开发者交流群×