MCPcopy Create free account
hub / github.com/OpenDriveLab/ReSim / _reduce

Function _reduce

SwissArmyTransformer/sat/mpu/mappings.py:22–33  ·  view source on GitHub ↗

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

(input_)

Source from the content-addressed store, hash-verified

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

Callers 2

backwardMethod · 0.85
forwardMethod · 0.85

Calls 1

get_model_parallel_groupFunction · 0.85

Tested by

no test coverage detected