Why does TensorFlow only find one CPU device despite having multiple cores?
<p>as far as I understood TensorFlow creates one device per core. (source: <a href="https://github.com/samjabrahams/tensorflow-white-paper-notes" rel="nofollow">https://github.com/samjabrahams/tensorflow-white-paper-notes</a>: <em>NOTE: To reiterate- in this context, "single device" means using a single CPU core or single GPU, not a single machine. Similarly, "multi-device" does not refer to multiple machines, but to multiple CPU cores and/or GPUs. See "3.3 Distributed Execution" for multiple machine discussion.</em>)</p>

<p>My computer has four cores but it only recognises one: </p>

<pre><code>&gt;&gt;&gt; from tensorflow.python.client import device_lib 
&gt;&gt;&gt; print(device_lib.list_local_devices())
[name: "/cpu:0"
device_type: "CPU"
memory_limit: 268435456
bus_adjacency: BUS_ANY
incarnation: 13835232998165214133
]
</code></pre>

<p>Do you have any idea why?</p>

<p>By default <code>cpu:0</code> represents all cores available to the process. You can create devices <code>cpu:0</code>, <code>cpu:1</code> which represent 1 logical core each by doing something like this</p>

<pre><code>config = tf.ConfigProto(device_count={"CPU": 2},
                        inter_op_parallelism_threads=2,
                        intra_op_parallelism_threads=1)
sess = tf.Session(config=config)
</code></pre>

<p>Then you can assign to devices as</p>

<pre><code>with tf.device("/cpu:0"):
  # ...

with tf.device("/cpu:1"):
  # ...
</code></pre>

python tensorflow