提交 024a1d61 authored 作者: Frederic's avatar Frederic

Add timming of the compute min peak algo.

上级 c0d12f1b
...@@ -657,6 +657,7 @@ class ProfileStats(object): ...@@ -657,6 +657,7 @@ class ProfileStats(object):
# track min peak memory usage # track min peak memory usage
min_max_peak = 0 min_max_peak = 0
min_peak_time = 0
def count_running_memory(order, fgraph, nodes_mem): def count_running_memory(order, fgraph, nodes_mem):
""" """
...@@ -983,7 +984,9 @@ class ProfileStats(object): ...@@ -983,7 +984,9 @@ class ProfileStats(object):
# Config: whether print min memory peak # Config: whether print min memory peak
if config.profiling.min_peak_memory: if config.profiling.min_peak_memory:
node_list = fgraph.apply_nodes node_list = fgraph.apply_nodes
ttt = time.time()
min_peak = count_minimum_peak(node_list, fgraph, nodes_mem) min_peak = count_minimum_peak(node_list, fgraph, nodes_mem)
min_peak_time += time.time() - ttt
min_max_peak = max(min_max_peak, min_peak) min_max_peak = max(min_max_peak, min_peak)
del fgraph, nodes_mem del fgraph, nodes_mem
...@@ -1008,8 +1011,8 @@ class ProfileStats(object): ...@@ -1008,8 +1011,8 @@ class ProfileStats(object):
new_max_running_max_memory_size / 1024.)), int(round( new_max_running_max_memory_size / 1024.)), int(round(
max_running_max_memory_size / 1024.))) max_running_max_memory_size / 1024.)))
if min_max_peak: if min_max_peak:
print >> file, " Minimum peak from all valid apply node order is %dKB" % int(round( print >> file, " Minimum peak from all valid apply node order is %dKB(took %f.2s to compute)" % (int(round(
min_max_peak / 1024.)) min_max_peak / 1024.)), min_peak_time)
print >> file, " Memory saved if views are used: %dKB (%dKB)" % (int( print >> file, " Memory saved if views are used: %dKB (%dKB)" % (int(
round(new_max_node_memory_saved_by_view / 1024.)), int( round(new_max_node_memory_saved_by_view / 1024.)), int(
round(max_node_memory_saved_by_view / 1024.))) round(max_node_memory_saved_by_view / 1024.)))
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论