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:114–128  ·  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

112
113@instrument_w_nvtx
114def assert_ints_same_as_other_ranks(ints: List[int]) -> None:
115 """
116 NOTE: creates both communication and synchronization overhead so should be
117 used sparingly
118
119 takes a list of ints from each rank and ensures that they are the same
120 across ranks, throwing an exception if they are not.
121 """
122 assert_lst_len_same_as_other_ranks(ints)
123 rank0_ints = get_lst_from_rank0(ints)
124 if ints != rank0_ints:
125 raise RuntimeError(f"Detected a disagreement on list contents between rank0 and rank{dist.get_rank()}: "
126 f"\n list length: {len(ints)}"
127 f"\n rank0: {rank0_ints} "
128 f"\n rank{dist.get_rank()}: {ints}")
129
130
131def 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