Browse Source

disable somas when variable_memory_max_size is set

tags/v1.1.0
laiyongqiang 5 years ago
parent
commit
6b57cc705f
3 changed files with 10 additions and 9 deletions
  1. +10
    -7
      mindspore/ccsrc/runtime/device/kernel_runtime.cc
  2. +0
    -1
      model_zoo/official/nlp/bert_thor/run_pretrain.py
  3. +0
    -1
      model_zoo/official/nlp/tinybert/run_general_distill.py

+ 10
- 7
mindspore/ccsrc/runtime/device/kernel_runtime.cc View File

@@ -675,13 +675,16 @@ void KernelRuntime::AssignDynamicMemory(session::KernelGraph *graph) {

if (is_enable_mem_reuse) {
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 {
MS_LOG(INFO) << "Memory Reuse is disable...";
}


+ 0
- 1
model_zoo/official/nlp/bert_thor/run_pretrain.py View File

@@ -145,7 +145,6 @@ def run_pretrain():
context.set_context(mode=context.GRAPH_MODE, device_target=args_opt.device_target,
device_id=args_opt.device_id, save_graphs=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)
ckpt_save_dir = args_opt.save_checkpoint_path
if args_opt.distribute == "true":


+ 0
- 1
model_zoo/official/nlp/tinybert/run_general_distill.py View File

@@ -70,7 +70,6 @@ def run_general_distill():
raise Exception("Target error, GPU or Ascend is supported.")

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,
datetime.datetime.now().strftime('%Y-%m-%d_time_%H_%M_%S'))


Loading…
Cancel
Save