Skip to content
This repository has been archived by the owner on Jul 1, 2023. It is now read-only.

What's the expected output from Device.allDevices ? #1089

Closed
xihui-wu opened this issue Sep 21, 2020 · 4 comments
Closed

What's the expected output from Device.allDevices ? #1089

xihui-wu opened this issue Sep 21, 2020 · 4 comments
Assignees

Comments

@xihui-wu
Copy link
Contributor

xihui-wu commented Sep 21, 2020

I ran this on colab with CPU, GPT and TPU respectively. Here are their outputs:

CPU:
1 element
▿ 0 : Device(kind: .CPU, ordinal: 0, backend: .XLA)
- kind : TensorFlow.Device.Kind.CPU
- ordinal : 0
- backend : TensorFlow.Device.Backend.XLA

GPU:
1 element
▿ 0 : Device(kind: .GPU, ordinal: 0, backend: .XLA)
- kind : TensorFlow.Device.Kind.GPU
- ordinal : 0
- backend : TensorFlow.Device.Backend.XLA

TPU:
9 elements
▿ 0 : Device(kind: .CPU, ordinal: 0, backend: .XLA)
- kind : TensorFlow.Device.Kind.CPU
- ordinal : 0
- backend : TensorFlow.Device.Backend.XLA
▿ 1 : Device(kind: .TPU, ordinal: 0, backend: .XLA)
- kind : TensorFlow.Device.Kind.TPU
- ordinal : 0
- backend : TensorFlow.Device.Backend.XLA
▿ 2 : Device(kind: .TPU, ordinal: 1, backend: .XLA)
- kind : TensorFlow.Device.Kind.TPU
- ordinal : 1
- backend : TensorFlow.Device.Backend.XLA
...
▿ 8 : Device(kind: .TPU, ordinal: 7, backend: .XLA)
- kind : TensorFlow.Device.Kind.TPU
- ordinal : 7
- backend : TensorFlow.Device.Backend.XLA

My confusion is why GPU output doesn't contain CPU device but that of TPU does ? What are expected ?

@xihui-wu xihui-wu changed the title What's the expected output from What's the expected output from Device.allDevices ? Sep 21, 2020
@brettkoonce
Copy link
Contributor

brettkoonce commented Sep 22, 2020

see also tensorflow/swift#524 #1077

@BradLarson
Copy link
Contributor

This is due to the cause behind issue #1059, in that the X10 backend searches out and automatically exposes the best accelerator it finds on CPU / GPU systems. In doing so, it doesn't expose the other devices on the system, including the CPU on a CPU + GPU system, or additional GPUs or CPUs beyond the first.

This can be done manually at the command line by constructing the kind of environment variable string I list in #1059, but the proper mappings should be detected and taken care of for you internally. I believe that's the focus of that other issue, and it's being worked on in parallel to the visibility issues with the eager-mode devices.

@marcrasi
Copy link
Contributor

@xihui-wu will verify and close after #1059 is fixed.

@xihui-wu
Copy link
Contributor Author

Verified this issue is gone.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants