MCPcopy Create free account
hub / github.com/zai-org/CodeGeeX / _reduce

Function _reduce

codegeex/megatron/mpu/mappings.py:26–36  ·  view source on GitHub ↗

All-reduce the the input tensor across model parallel group.

(input_)

Source from the content-addressed store, hash-verified

24
25
26def _reduce(input_):
27 """All-reduce the the input tensor across model parallel group."""
28
29 # Bypass the function if we are using only 1 GPU.
30 if get_tensor_model_parallel_world_size() == 1:
31 return input_
32
33 # All-reduce.
34 torch.distributed.all_reduce(input_, group=get_tensor_model_parallel_group())
35
36 return input_
37
38
39def _split(input_):

Callers 3

backwardMethod · 0.85
symbolicMethod · 0.85
forwardMethod · 0.85

Tested by

no test coverage detected