MCPcopy Create free account
hub / github.com/OpenGVLab/UniFormerV2 / init_distributed_training

Function init_distributed_training

slowfast/utils/distributed.py:270–285  ·  view source on GitHub ↗

Initialize variables needed for distributed training.

(cfg)

Source from the content-addressed store, hash-verified

268
269
270def init_distributed_training(cfg):
271 """
272 Initialize variables needed for distributed training.
273 """
274 if cfg.NUM_GPUS <= 1:
275 return
276 num_gpus_per_machine = cfg.NUM_GPUS
277 num_machines = dist.get_world_size() // num_gpus_per_machine
278 for i in range(num_machines):
279 ranks_on_i = list(
280 range(i * num_gpus_per_machine, (i + 1) * num_gpus_per_machine)
281 )
282 pg = dist.new_group(ranks_on_i)
283 if i == cfg.SHARD_ID:
284 global _LOCAL_PROCESS_GROUP
285 _LOCAL_PROCESS_GROUP = pg
286
287
288def get_local_size() -> int:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected