TensorFlow 开启了多少个进程? [英] How many processes does TensorFlow open?

查看:45
本文介绍了TensorFlow 开启了多少个进程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用扭矩来运行一些使用 tensorflow 库的基于 CNN 的学习.(每个任务 1 个 CPU)

I am using torque to run some CNN-based learning using tensorflow library. (1 CPU per task)

当我在服务器上运行 top 时,我注意到:load average: 677.29, 668.59, 470.

When I run top on my server, I noticed that: load average: 677.29, 668.59, 470.

我创建一个这样的会话:sess = tf.Session()

I create a session like this: sess = tf.Session()

所以我的问题是文档中有一些地方可以让我阅读 TensorFlow 使用的时间和数量.

So my question is there some place in documentation where I can read when and how many processes TensorFlow uses.

推荐答案

当前版本的 TensorFlow (0.6.0) 在单个进程中运行:与您创建 tf.Session(或调用tensorflow::NewSession(),如果您使用的是 C++ 接口).

The current version of TensorFlow (0.6.0) runs in a single process: the same process in which you create the tf.Session (or call tensorflow::NewSession(), if you're using the C++ interface).

但是,TensorFlow 默认使用多线程,这可能是您看到的高平均负载的原因.默认情况下,TensorFlow 将根据适合您系统的数量为两个线程池选择线程数.当前的默认行为是为 "inter-op" 线程池(决定了可以并行执行的操作数),以及 intra-op"线程池(决定了一个操作中可并行化的线程数).线程的另一个来源是基于 Python 的 QueueRunner,每个队列至少启动一个线程(通常在输入管道中).

However, TensorFlow by default uses multiple threads, which could account for the high load averages you are seeing. By default TensorFlow will choose the number of threads for two threadpools based on an appropriate number for your system. Currently the default behavior is to allocate the same number of threads as cores, for both the "inter-op" threadpool (which determines the number of ops that can execute in parallel), and the "intra-op" threadpool (which determines the number of threads available for parallelizing within an op). Another source of threads is in the Python-based QueueRunner, which starts at least one thread per queue (typically in an input pipeline).

因此,如果您拥有大量内核,并且您的 TensorFlow 程序有很多可用的并行性(或复杂的输入管道),您最终可能会看到如此高的平均负载.

Therefore, if you have a large number of cores, and your TensorFlow program has a lot of available parallelism (or a complex input pipeline), you can end up seeing such high load averages.

这篇关于TensorFlow 开启了多少个进程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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