Zk1001
Zk1001

Reputation: 2053

Changing the number of threads in TensorFlow on Cifar10

Whenever I run the cifar10_eval.py, in creates 32 threads as following:

I tensorflow/core/common_runtime/local_device.cc:25] Local device intra op parallelism threads: 32

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?

Upvotes: 17

Views: 15546

Answers (1)

mrry
mrry

Reputation: 126154

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))

Upvotes: 26

Related Questions