!9450 set graph mode should before init(), otherwise hccl will report repeat init error

From: @caojian05
Reviewed-by: @linqingke,@guoqi1024
Signed-off-by: @linqingke
This commit is contained in:
mindspore-ci-bot 2020-12-04 10:53:15 +08:00 committed by Gitee
commit 8bedff1a0d
1 changed files with 1 additions and 1 deletions

View File

@ -126,6 +126,7 @@ def merge_args(args_opt, cloud_args):
if __name__ == '__main__':
args = parse_args()
context.set_context(mode=context.GRAPH_MODE, device_target=args.device_target)
device_num = int(os.environ.get("DEVICE_NUM", 1))
if args.is_distributed:
if args.device_target == "Ascend":
@ -143,7 +144,6 @@ if __name__ == '__main__':
else:
if args.device_target == "Ascend":
context.set_context(device_id=args.device_id)
context.set_context(mode=context.GRAPH_MODE, device_target=args.device_target)
# select for master rank save ckpt or all rank save, compatible for model parallel
args.rank_save_ckpt_flag = 0