MCPcopy Create free account
hub / github.com/AIS-SNU/Smart-Infinity / check_using_norm

Method check_using_norm

deepspeed/runtime/utils.py:192–209  ·  view source on GitHub ↗
(self, norm_group, reduce_overflow=True)

Source from the content-addressed store, hash-verified

190 self.has_moe_params = True
191
192 def check_using_norm(self, norm_group, reduce_overflow=True):
193 # TODO: I don't think reduce_overflow is needed if mpu is None
194 overflow = -1 in norm_group
195 overflow_gpu = get_accelerator().FloatTensor([overflow])
196 if self.has_moe_params:
197 # In this case, we need to do an all_reduce across
198 # the expert_parallel_group, so that if there was
199 # an overflow due to expert weights, we detect it
200
201 # Only need to check groups.get_largest_expert_parallel_group()
202 dist.all_reduce(overflow_gpu, op=dist.ReduceOp.MAX, group=groups._get_max_expert_parallel_group())
203 if self.mpu is not None:
204 dist.all_reduce(overflow_gpu, op=dist.ReduceOp.MAX, group=self.mpu.get_model_parallel_group())
205 elif reduce_overflow:
206 dist.all_reduce(overflow_gpu, op=dist.ReduceOp.MAX)
207 dist.barrier()
208 overflow = overflow_gpu[0].item()
209 return bool(overflow)
210
211 def check(self, param_groups=None):
212 params = []

Callers 2

step_fused_adamMethod · 0.80
step_fused_lambMethod · 0.80

Calls 5

get_acceleratorFunction · 0.90
FloatTensorMethod · 0.45
all_reduceMethod · 0.45
barrierMethod · 0.45

Tested by

no test coverage detected