From 45be54175221c42c1bcb7e46b230fc79c8aa2d02 Mon Sep 17 00:00:00 2001 From: lichun Date: Wed, 14 Jul 2021 19:59:55 +0800 Subject: [PATCH] assign graph memory max size and variable memory max size adaptively --- ge/graph/manager/graph_var_manager.cc | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/ge/graph/manager/graph_var_manager.cc b/ge/graph/manager/graph_var_manager.cc index 5138a0f5..d0669254 100755 --- a/ge/graph/manager/graph_var_manager.cc +++ b/ge/graph/manager/graph_var_manager.cc @@ -795,18 +795,15 @@ Status VarManager::GetTotalMemorySize(size_t &total_mem_size) { Status VarManager::SetMemoryMallocSize(const map &options) { size_t total_mem_size = 0; - Status ret = VarManager::GetTotalMemorySize(total_mem_size); - if (ret != SUCCESS) { - return ret; - } + GE_CHK_STATUS_RET_NOLOG(VarManager::GetTotalMemorySize(total_mem_size)); GEEVENT("Total memory size is %zu", total_mem_size); graph_mem_max_size_ = floor(total_mem_size * kGraphMemoryManagerMallocRatio); var_mem_max_size_ = floor(total_mem_size * kVarMemoryManagerMallocRatio); - auto it = options.find(GRAPH_MEMORY_MAX_SIZE); - if (it != options.end()) { - string graph_memory_manager_malloc_max_size = it->second; + auto it1 = options.find(GRAPH_MEMORY_MAX_SIZE); + if (it1 != options.end()) { + string graph_memory_manager_malloc_max_size = it1->second; ge::Status ret = ParseMemoryMallocSize(graph_memory_manager_malloc_max_size, graph_mem_max_size_); if (ret != SUCCESS) { GELOGE(ge::GE_GRAPH_OPTIONS_INVALID, "[Call][ParseMemoryMallocSize] failed, session id:%lu.", session_id_); @@ -814,9 +811,9 @@ Status VarManager::SetMemoryMallocSize(const map &options) { } } - it = options.find(VARIABLE_MEMORY_MAX_SIZE); - if (it != options.end()) { - string memory_var_manager_malloc_size = it->second; + auto it2 = options.find(VARIABLE_MEMORY_MAX_SIZE); + if (it2 != options.end()) { + string memory_var_manager_malloc_size = it2->second; ge::Status ret = ParseMemoryMallocSize(memory_var_manager_malloc_size, var_mem_max_size_); if (ret != SUCCESS) { GELOGE(ge::GE_GRAPH_OPTIONS_INVALID, "[Call][ParseMemoryMallocSize] failed, session id:%lu.", session_id_);