配置 Tensorflow 以使用所有 CPU [英] Configuring Tensorflow to use all CPU's

查看:49
本文介绍了配置 Tensorflow 以使用所有 CPU的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

阅读:https://www.tensorflow.org/versions/r0.10/resources/faq.html 它说:

TensorFlow 是否利用了所有可用的设备(GPU 和 CPU)在我的机器上?

Does TensorFlow make use of all the devices (GPUs and CPUs) available on my machine?

TensorFlow 支持多个 GPU 和 CPU.查看操作方法有关如何将 GPU 与 TensorFlow 结合使用的文档,了解如何使用TensorFlow 为设备分配操作,以及 CIFAR-10 教程对于使用多个 GPU 的示例模型.

TensorFlow supports multiple GPUs and CPUs. See the how-to documentation on using GPUs with TensorFlow for details of how TensorFlow assigns operations to devices, and the CIFAR-10 tutorial for an example model that uses multiple GPUs.

请注意,TensorFlow 仅使用具有计算能力的 GPU 设备大于 3.5.

Note that TensorFlow only uses GPU devices with a compute capability greater than 3.5.

这是否意味着 Tensorflow 可以自动使用给定机器上的所有 CPU,还是需要明确配置?

Does this mean Tensorflow can automatically make use of all CPU's on given machine or does it ned to be explicitly configured ?

推荐答案

CPU 是通过设备"使用的,设备"只是一个线程池.如果您觉得需要更多线程,可以控制线程数:

CPUs are used via a "device" which is just a threadpool. You can control the number of threads if you feel like you need more:

sess = tf.Session(config=tf.ConfigProto(
  intra_op_parallelism_threads=NUM_THREADS))

这篇关于配置 Tensorflow 以使用所有 CPU的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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