disable somas when variable_memory_max_size is set

pull/8286/head
laiyongqiang 4 years ago
parent a5b0d13141
commit 6b57cc705f

@ -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 auto context = MsContext::GetInstance();
mem_manager_->MallocReusedDynamicMem(graph); MS_EXCEPTION_IF_NULL(context);
mem_type = kReuseDynamicMem; auto variable_memory_max_size = context->get_param<std::string>(MS_CTX_VARIABLE_MEMORY_MAX_SIZE);
#else if (variable_memory_max_size == "0") {
mem_manager_->MallocSomasDynamicMem(graph); mem_manager_->MallocSomasDynamicMem(graph);
mem_type = kSomasReuseDynamicMem; mem_type = kSomasReuseDynamicMem;
#endif } 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'))

Loading…
Cancel
Save