提交 dce5f32b authored 作者: Roy Xue's avatar Roy Xue

Transfer generator into recursive function

上级 2d90d1f8
...@@ -895,15 +895,11 @@ class ProfileStats(object): ...@@ -895,15 +895,11 @@ class ProfileStats(object):
new_exec_nodes.add(c) new_exec_nodes.add(c)
if not new_exec_nodes: if not new_exec_nodes:
yield [node]
# Check and Update mem_bound # Check and Update mem_bound
if max_mem_count < mem_bound: if max_mem_count < mem_bound:
mem_bound = max_mem_count mem_bound = max_mem_count
else: else:
for p in min_memory_generator(new_exec_nodes, min_memory_generator(new_exec_nodes, viewed_by_temp, view_of_temp)
viewed_by_temp,
view_of_temp):
yield [node]+p
# Reset track variables # Reset track variables
mem_count -= mem_created mem_count -= mem_created
...@@ -921,11 +917,7 @@ class ProfileStats(object): ...@@ -921,11 +917,7 @@ class ProfileStats(object):
view_of = {} # {var1: original var viewed by var1} view_of = {} # {var1: original var viewed by var1}
# The orignal mean that we don't keep trac of all the intermediate relationship in the view. # The orignal mean that we don't keep trac of all the intermediate relationship in the view.
# Loop all valid orders and find min peak(store in mem_bound) min_memory_generator(executable_nodes, viewed_by, view_of)
for order in min_memory_generator(executable_nodes,
viewed_by,
view_of):
continue
return mem_bound return mem_bound
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论