提交 9a9a3b29 authored 作者: Roy Xue's avatar Roy Xue

Calculate minimum peak for each fgraph and store the max value

上级 2b950f2a
...@@ -635,6 +635,11 @@ class ProfileStats(object): ...@@ -635,6 +635,11 @@ class ProfileStats(object):
new_max_node_memory_saved_by_view = 0 new_max_node_memory_saved_by_view = 0
new_max_node_memory_saved_by_inplace = 0 new_max_node_memory_saved_by_inplace = 0
# count the minimum peak
best_order = []
minimum_peak = 0
max_minimum_peak = 0
def count_running_memory(order, thunk_old_storage, nodes_mem): def count_running_memory(order, thunk_old_storage, nodes_mem):
""" """
Calculate memory with specific node order Calculate memory with specific node order
...@@ -733,12 +738,15 @@ class ProfileStats(object): ...@@ -733,12 +738,15 @@ class ProfileStats(object):
new_max_node_memory_saved_by_inplace = max( new_max_node_memory_saved_by_inplace = max(
new_max_node_memory_saved_by_inplace, new_running_memory[3]) new_max_node_memory_saved_by_inplace, new_running_memory[3])
node_list = fgraph.nodes
best_order, minimum_peak = count_minimum_peak(node_list, fgraph)
max_minimum_peak = max(max_minimum_peak, minimum_peak)
del fgraph, nodes_mem, post_thunk_old_storage, node del fgraph, nodes_mem, post_thunk_old_storage, node
best_order = []
minimum_peak = 0
node_list = fgraph.nodes
best_order, minimum_peak = count_minimum_peak(node_list)
if len(fct_memory) > 1: if len(fct_memory) > 1:
print >> file, ("Memory Profile " print >> file, ("Memory Profile "
...@@ -1158,7 +1166,7 @@ if 0: # old code still to be ported from ProfileMode ...@@ -1158,7 +1166,7 @@ if 0: # old code still to be ported from ProfileMode
n_ops_to_print=n_ops_to_print, print_apply=False) n_ops_to_print=n_ops_to_print, print_apply=False)
def count_minimum_peak(node_list): def count_minimum_peak(node_list, fgraph):
mem_list = [] mem_list = []
current_mem = 0 current_mem = 0
order_index = 0 order_index = 0
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论