MCPcopy
hub / github.com/InternLM/InternLM / get_group

Method get_group

internlm/core/context/parallel_context.py:335–345  ·  view source on GitHub ↗

Returns the group of the current device for `parallel_mode`. Args: parallel_mode: The chosen parallel mode. Returns: torch.distributed.ProcessGroup: The group of the current device for `parallel_mode`.

(self, parallel_mode: ParallelMode)

Source from the content-addressed store, hash-verified

333 return self._world_sizes.get(parallel_mode, 1)
334
335 def get_group(self, parallel_mode: ParallelMode):
336 """Returns the group of the current device for `parallel_mode`.
337
338 Args:
339 parallel_mode: The chosen parallel mode.
340
341 Returns:
342 torch.distributed.ProcessGroup: The group of the current device for `parallel_mode`.
343 """
344 self._check_parallel_mode(parallel_mode)
345 return self._groups[parallel_mode]
346
347 def get_ranks_in_group(self, parallel_mode: ParallelMode):
348 """Returns the rank of the current device for `parallel_mode` in the group.

Callers 15

mainFunction · 0.80
sync_model_paramFunction · 0.80
evaluate_on_val_dlsFunction · 0.80
__init__Method · 0.80
gather_split_1d_tensorFunction · 0.80
__init__Method · 0.80
_gatherFunction · 0.80
__init__Method · 0.80
__init__Method · 0.80
__init__Method · 0.80

Calls 1

_check_parallel_modeMethod · 0.95

Tested by

no test coverage detected