Skip to content

Commit

Permalink
add comment explaining how to get global devices
Browse files Browse the repository at this point in the history
  • Loading branch information
hubingallin committed Sep 21, 2023
1 parent 2248912 commit f361c46
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions keras_core/backend/tensorflow/distribution_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ def list_devices(device_type=None):
device_type = (

Check warning on line 25 in keras_core/backend/tensorflow/distribution_lib.py

View check run for this annotation

Codecov / codecov/patch

keras_core/backend/tensorflow/distribution_lib.py#L25

Added line #L25 was not covered by tests
device_type.upper() if device_type else dtensor.preferred_device_type()
)

# DTensor doesn't support getting global devices, even when knowing the
# Mesh. Use TF API instead to get global devices. Coordinator service is
# enabled by default with DTensor, so that list_logical_devices() returns
# a list of global devices. More context can be found in b/254911601.
return tf.config.list_logical_devices(device_type=device_type)

Check warning on line 33 in keras_core/backend/tensorflow/distribution_lib.py

View check run for this annotation

Codecov / codecov/patch

keras_core/backend/tensorflow/distribution_lib.py#L33

Added line #L33 was not covered by tests


Expand Down

0 comments on commit f361c46

Please sign in to comment.