2

how can I manually assign more than one device to one single op in TensorFlow (python API)?

For example, in order to assign one cpu to a graph, I would do:

with tf.device("/cpu:0"):
    # Define operation here

What if I want to assign cpu 0, 1, 2, 3 all to this same op?

It seems like I can't use a list of device names as the arg for tf.device. Any help or guidance would be appreciated. Thanks!

1
  • By default all cpus are used automatically and cpu:0 refers to all cpus on machine Commented Aug 5, 2017 at 0:33

1 Answer 1

1

You can have multiple with contexts like so:

with tf.device("/cpu:0") as cpu0, tf.device("/cpu:1") as cpu1:
    pass
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.