用于测试 tensorflow 安装的速度基准 [英] speed benchmark for testing tensorflow install

查看:24
本文介绍了用于测试 tensorflow 安装的速度基准的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怀疑我的 gpu 机器上是否正确配置了 tensorflow,因为每次迭代在我喜欢的 gpu 机器上训练一个简单的线性回归模型(batchsize = 32、1500 个输入特征、150 个输出变量)要慢 100 倍左右在我的笔记本电脑上.

我正在使用 Titan X 和现代 CPU 等.nvidia-smi 说我的 GPU 利用率仅为 10%,但我预计这是因为批量较小.我没有使用 feed_dict 将数据移动到计算图中.一切都来自 tf.decode_csv 和 tf.train.shuffle_batch.

有人对如何轻松测试我的安装是否正确有任何建议吗?是否有任何简单的速度基准?我的笔记本电脑和 gpu 机器之间的速度差异如此之大,以至于我预计事情没有正确配置.

解决方案

尝试 tensorflow/tensorflow/models/image/mnist/convolutional.py,它将打印每步计时.>

在 Tesla K40c 上,每一步应该得到大约 16 ms,而在我 3 岁的机器上仅使用 CPU 大约 120 ms

<小时>

这移到了 models 存储库:https://github.com/tensorflow/models/blob/master/tutorials/image/mnist/convolutional.py.

convolutional.py 文件现在位于 models/tutorials/image/mnist/convolutional.py

I'm doubting whether tensorflow is correctly configured on my gpu box, since it's about 100x slower per iteration to train a simple linear regression model (batchsize = 32, 1500 input features, 150 output variables) on my fancy gpu machine than on my laptop.

I'm using a Titan X, with a modern cpu, etc. nvidia-smi says that I'm only at 10% gpu utilization, but I expect that's because of the small batchsizes. I'm not using a feed_dict to move data into the computation graph. Everything is coming via a tf.decode_csv and tf.train.shuffle_batch.

Does anyone have any recommendations for how to easily test whether my install is correct? Are there any simple speed benchmarks? The speed difference between my laptop and the gpu machine is so dramatic that I'm expecting that things aren't configured properly.

解决方案

Try tensorflow/tensorflow/models/image/mnist/convolutional.py, that'll print per-step timing.

On Tesla K40c that should get about 16 ms per step, while about 120 ms for CPU-only on my 3 year old machine


Edit: This moved to the models repositories: https://github.com/tensorflow/models/blob/master/tutorials/image/mnist/convolutional.py.

The convolutional.py file is now at models/tutorials/image/mnist/convolutional.py

这篇关于用于测试 tensorflow 安装的速度基准的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆