MCPcopy Create free account
hub / github.com/MotrixLab/ADHMR / init_distributed

Function init_distributed

ADHMR/main/main.py:156–176  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

154 return args, config
155
156def init_distributed(args):
157 if "WORLD_SIZE" not in os.environ or int(os.environ["WORLD_SIZE"]) < 1:
158 return False
159
160 torch.cuda.set_device(args.local_rank)
161
162 assert os.environ["MASTER_PORT"], "set the MASTER_PORT variable or use pytorch launcher"
163 assert os.environ["RANK"], "use pytorch launcher and explicityly state the rank of the process"
164
165 torch.manual_seed(args.seed)
166 torch.cuda.manual_seed(args.seed)
167 torch.cuda.manual_seed_all(args.seed)
168 np.random.seed(args.seed)
169 random.seed(args.seed)
170 cudnn.deterministic = True
171 cudnn.benchmark = False
172 os.environ['PYTHONHASHSEED'] = str(args.seed)
173 os.environ['TORCH_DISTRIBUTED_DEBUG'] = 'DETAIL'
174 torch.distributed.init_process_group(backend="nccl", init_method="env://")
175
176 return True
177
178def main():
179 args, cfg = parse_args_and_config()

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected