在Cifar10上更改TensorFlow中的线程数 [英] Changing the number of threads in TensorFlow on Cifar10
本文介绍了在Cifar10上更改TensorFlow中的线程数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
每当我运行cifar10_eval.py时,都会创建32个线程,如下所示:
Whenever I run the cifar10_eval.py, in creates 32 threads as following:
我tensorflow/core/common_runtime/local_device.cc:25]本地设备内部操作并行线程:32
我认为此线程数是CPU上运行的线程数,但是当我检查使用情况时,仅使用了400-500%的CPU.无论如何,有没有要改变此线程数?
I think this number of threads is the number of threads running on CPUs, but when I check the usage, only 400-500% of CPUs are used. Is there anyway to change this number of threads?
推荐答案
To configure this value, you can pass a tf.ConfigProto
argument when constructing the tf.Session
:
NUM_THREADS = …
sess = tf.Session(config=tf.ConfigProto(
intra_op_parallelism_threads=NUM_THREADS))
这篇关于在Cifar10上更改TensorFlow中的线程数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文