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?
ThreadPools. The backend of ADCME, TensorFlow, uses two threadpools for multithreading. One thread pool is for inter-parallelism, and the other is for intra-parallelism. They can be set by the users.
The TensorFlow Session object is multithreaded, so multiple threads can easily use the same session and run ops in parallel.
The tf. Session object is thread-safe for Session. run() calls from multiple threads. Before TensorFlow 0.10 graph modification was not thread-safe.
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))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With