Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does TensorFlow job use multiple cores by default?

Tags:

I am running the imagenet from TensorFlow models repository. I've instrumented sess.run as described in Github comment and got the following view in the chrome://tracing

enter image description here

I am wondering if TF sometime uses multiple cores or single core all the time. I'd think it is using multiple cores when ops can run in parallel as shown in the red box of the figure. However, all these 6 threads are listed under /job:localhost/replicate:0/task:0/cpu:0 which makes me question my interpretation. Does cpu:0 mean all CPU cores?

I am running on a desktop with 8 cores. I run htop to see core utilization during the TF run and I see only one core getting saturated 95-100%.

like image 821
Nodir Kodirov Avatar asked Mar 16 '17 21:03

Nodir Kodirov


People also ask

Can TensorFlow use multiple cores?

TensorFlow has the ability to execute a given operator using multiple threads ("intra-operator parallelisation"), as well as different operators in parallel ("inter-operator parallelisation").

Is TensorFlow multithreaded?

The TensorFlow Session object is multithreaded, so multiple threads can easily use the same session and run ops in parallel.

Does TensorFlow use cpus?

All cores are wrapped in cpu:0, i.e., TensorFlow does indeed use multiple CPU cores by default.

Does machine learning use multiple cores?

Using multiple cores for common machine learning tasks can dramatically decrease the execution time as a factor of the number of cores available on your system. A common laptop and desktop computer may have 2, 4, or 8 cores.


1 Answers

I found existing answer to this question. All cores are wrapped in cpu:0, i.e., TensorFlow does indeed use multiple CPU cores by default.

like image 112
Nodir Kodirov Avatar answered Nov 08 '22 05:11

Nodir Kodirov