MCPcopy Create free account
hub / github.com/zai-org/CodeGeeX / set_pipeline_parallel_context

Function set_pipeline_parallel_context

codegeex/mindspore/train.py:487–503  ·  view source on GitHub ↗

Set prarllel context in pipeline training process

(args_opt)

Source from the content-addressed store, hash-verified

485
486
487def set_pipeline_parallel_context(args_opt):
488 """
489 Set prarllel context in pipeline training process
490 """
491 D.init()
492 device_num = D.get_group_size()
493 rank_id = D.get_rank()
494 print("rank_id is {}, device_num is {}".format(rank_id, device_num))
495 context.reset_auto_parallel_context()
496 context.set_auto_parallel_context(
497 parallel_mode=ParallelMode.SEMI_AUTO_PARALLEL, gradients_mean=False,
498 full_batch=bool(args_opt.full_batch), loss_repeated_mean=True,
499 device_num=device_num, enable_parallel_optimizer=bool(args_opt.optimizer_shard),
500 pipeline_stages=args_opt.stage_num)
501 set_algo_parameters(elementwise_op_strategy_follow=True)
502 _set_multi_subgraphs()
503 return rank_id, device_num
504
505
506def run_train_pipeline(args_opt):

Callers 1

run_train_pipelineFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected