Skip to content
Open
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
23 changes: 23 additions & 0 deletions torchrec/distributed/planner/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,18 @@ class DeviceHardware:
storage: Storage
perf: Perf

def __hash__(self) -> int:
return hash((self.rank, self.storage, self.perf))

def __eq__(self, other: object) -> bool:
if not isinstance(other, DeviceHardware):
return False
return (
self.rank == other.rank
and self.storage == other.storage
and self.perf == other.perf
)


class CustomTopologyData:
"""
Expand Down Expand Up @@ -247,6 +259,17 @@ def get_bw(
else:
return self.inter_host_bw

def __hash__(self) -> int:
return hash((self._inter_host_bw, self._intra_host_bw))

def __eq__(self, other: object) -> bool:
if not isinstance(other, BasicCommsBandwidths):
return False
return (
self._inter_host_bw == other._inter_host_bw
and self._intra_host_bw == other._intra_host_bw
)


class Topology:
"""
Expand Down
Loading