MCPcopy Create free account
hub / github.com/deepspeedai/DeepSpeed / assert_ints_same_as_other_ranks

Function assert_ints_same_as_other_ranks

deepspeed/runtime/zero/utils.py:123–137  ·  view source on GitHub ↗

NOTE: creates both communication and synchronization overhead so should be used sparingly takes a list of ints from each rank and ensures that they are the same across ranks, throwing an exception if they are not.

(ints: List[int])

Source from the content-addressed store, hash-verified

121
122@instrument_w_nvtx
123def assert_ints_same_as_other_ranks(ints: List[int]) -> None:
124 """
125 NOTE: creates both communication and synchronization overhead so should be
126 used sparingly
127
128 takes a list of ints from each rank and ensures that they are the same
129 across ranks, throwing an exception if they are not.
130 """
131 assert_lst_len_same_as_other_ranks(ints)
132 rank0_ints = get_lst_from_rank0(ints)
133 if ints != rank0_ints:
134 raise RuntimeError(f"Detected a disagreement on list contents between rank0 and rank{dist.get_rank()}: "
135 f"\n list length: {len(ints)}"
136 f"\n rank0: {rank0_ints} "
137 f"\n rank{dist.get_rank()}: {ints}")
138
139
140def is_builtin_type(obj):

Callers 3

all_gather_coalescedMethod · 0.90
reset_stepMethod · 0.85

Calls 3

get_lst_from_rank0Function · 0.85
get_rankMethod · 0.45

Tested by

no test coverage detected