If you look at the ConfigProto API on line 278, you will see the following:
This really means that if you do something like this without allow_soft_placement=True , TensorFlow will throw an error.
with tf.device('/gpu:0'):
Right below it you will see line 281:
When log_device_placement=True , you will get verbose output of something like this:
2017-07-03 01:13:59.466748: I tensorflow/core/common_runtime/simple_placer.cc:841] Placeholder_1: (Placeholder)/job:localhost/replica:0/task:0/cpu:0 Placeholder: (Placeholder): /job:localhost/replica:0/task:0/cpu:0 2017-07-03 01:13:59.466765: I tensorflow/core/common_runtime/simple_placer.cc:841] Placeholder: (Placeholder)/job:localhost/replica:0/task:0/cpu:0 Variable/initial_value: (Const): /job:localhost/replica:0/task:0/cpu:0 2017-07-03 01:13:59.466783: I tensorflow/core/common_runtime/simple_placer.cc:841] Variable/initial_value: (Const)/job:localhost/replica:0/task:0/cpu:0
You can see where each operation is displayed. In this case, they are all mapped to /cpu:0 , but if you are in a distributed configuration, there will be many more devices.
jkschin
source share