Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions pathwaysutils/elastic/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,14 @@ def active_slice_count(self) -> int:
"""The number of active slices."""
return len(self.active_slice_indices)

@property
def active_devices(self) -> list[jax.Device]:
"""The devices belonging to the active slices, ordered by slice index."""
devices = []
for slice_index in sorted(self.active_slice_indices):
devices.extend(self.slice_to_devices[slice_index])
return devices

def scale_by_active_slices(self, x: int | float) -> int | float:
"""Scale x by the number of active slices."""
if isinstance(x, int):
Expand Down
Loading