MCPcopy
hub / github.com/ultralytics/yolov5 / torch_distributed_zero_first

Function torch_distributed_zero_first

utils/torch_utils.py:89–95  ·  view source on GitHub ↗
(local_rank: int)

Source from the content-addressed store, hash-verified

87
88@contextmanager
89def torch_distributed_zero_first(local_rank: int):
90 # Decorator to make all processes in distributed training wait for each local_master to do something
91 if local_rank not in [-1, 0]:
92 dist.barrier(device_ids=[local_rank])
93 yield
94 if local_rank == 0:
95 dist.barrier(device_ids=[0])
96
97
98def device_count():

Callers 6

trainFunction · 0.90
create_dataloaderFunction · 0.90
trainFunction · 0.90
trainFunction · 0.90
create_dataloaderFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected