| @@ -675,13 +675,16 @@ void KernelRuntime::AssignDynamicMemory(session::KernelGraph *graph) { | |||||
| if (is_enable_mem_reuse) { | if (is_enable_mem_reuse) { | ||||
| MS_LOG(INFO) << "Memory Reuse is enable..."; | MS_LOG(INFO) << "Memory Reuse is enable..."; | ||||
| #ifdef MEM_REUSE_DEBUG | |||||
| mem_manager_->MallocReusedDynamicMem(graph); | |||||
| mem_type = kReuseDynamicMem; | |||||
| #else | |||||
| mem_manager_->MallocSomasDynamicMem(graph); | |||||
| mem_type = kSomasReuseDynamicMem; | |||||
| #endif | |||||
| auto context = MsContext::GetInstance(); | |||||
| MS_EXCEPTION_IF_NULL(context); | |||||
| auto variable_memory_max_size = context->get_param<std::string>(MS_CTX_VARIABLE_MEMORY_MAX_SIZE); | |||||
| if (variable_memory_max_size == "0") { | |||||
| mem_manager_->MallocSomasDynamicMem(graph); | |||||
| mem_type = kSomasReuseDynamicMem; | |||||
| } else { | |||||
| mem_manager_->MallocReusedDynamicMem(graph); | |||||
| mem_type = kReuseDynamicMem; | |||||
| } | |||||
| } else { | } else { | ||||
| MS_LOG(INFO) << "Memory Reuse is disable..."; | MS_LOG(INFO) << "Memory Reuse is disable..."; | ||||
| } | } | ||||
| @@ -145,7 +145,6 @@ def run_pretrain(): | |||||
| context.set_context(mode=context.GRAPH_MODE, device_target=args_opt.device_target, | context.set_context(mode=context.GRAPH_MODE, device_target=args_opt.device_target, | ||||
| device_id=args_opt.device_id, save_graphs=False) | device_id=args_opt.device_id, save_graphs=False) | ||||
| context.set_context(reserve_class_name_in_scope=False) | context.set_context(reserve_class_name_in_scope=False) | ||||
| context.set_context(variable_memory_max_size="30GB") | |||||
| context.set_context(max_call_depth=3000) | context.set_context(max_call_depth=3000) | ||||
| ckpt_save_dir = args_opt.save_checkpoint_path | ckpt_save_dir = args_opt.save_checkpoint_path | ||||
| if args_opt.distribute == "true": | if args_opt.distribute == "true": | ||||
| @@ -70,7 +70,6 @@ def run_general_distill(): | |||||
| raise Exception("Target error, GPU or Ascend is supported.") | raise Exception("Target error, GPU or Ascend is supported.") | ||||
| context.set_context(reserve_class_name_in_scope=False) | context.set_context(reserve_class_name_in_scope=False) | ||||
| context.set_context(variable_memory_max_size="30GB") | |||||
| save_ckpt_dir = os.path.join(args_opt.save_ckpt_path, | save_ckpt_dir = os.path.join(args_opt.save_ckpt_path, | ||||
| datetime.datetime.now().strftime('%Y-%m-%d_time_%H_%M_%S')) | datetime.datetime.now().strftime('%Y-%m-%d_time_%H_%M_%S')) | ||||