提交 5170ff7b authored 作者: Frederic Bastien's avatar Frederic Bastien

Code refactor, make printed information more clear

上级 cc8eaeda
...@@ -1150,64 +1150,46 @@ class ProfileStats(object): ...@@ -1150,64 +1150,46 @@ class ProfileStats(object):
else: else:
print("Memory Profile", file=file) print("Memory Profile", file=file)
(max_node_memory_size,
max_running_max_memory_size,
max_node_memory_saved_by_view,
max_node_memory_saved_by_inplace) = stats[0]
(new_max_node_memory_size,
new_max_running_max_memory_size,
new_max_node_memory_saved_by_view,
new_max_node_memory_saved_by_inplace) = stats[2]
print("(Sparse variables are ignored)", file=file) print("(Sparse variables are ignored)", file=file)
print("(For values in brackets, it's for linker = c|py", file=file) print("(For values in brackets, it's for linker = c|py", file=file)
print("---", file=file) def print_stats(stats1, stats2):
# print >> file, " Max if no gc, inplace and view: %dKB" % int( (max_node_memory_size,
# round(max_sum_size / 1024)) max_running_max_memory_size,
print(" Max if no gc (allow_gc=False): %dKB (%dKB)" % (int(round( max_node_memory_saved_by_view,
new_max_node_memory_size[0] / 1024.)), int(round( max_node_memory_saved_by_inplace) = stats1
max_node_memory_size[0] / 1024.))), file=file) (new_max_node_memory_size,
print(" CPU: %dKB (%dKB)" % ((int(round( new_max_running_max_memory_size,
new_max_node_memory_size[1] / 1024.)), int(round( new_max_node_memory_saved_by_view,
max_node_memory_size[1] / 1024.)))), file=file) new_max_node_memory_saved_by_inplace) = stats2
print(" GPU: %dKB (%dKB)" % ((int(round(
new_max_node_memory_size[2] / 1024.)), int(round( print(" CPU + GPU: %dKB (%dKB)" % (int(round(
max_node_memory_size[2] / 1024.)))), file=file) new_max_running_max_memory_size[0] / 1024.)), int(round(
max_running_max_memory_size[0] / 1024.))), file=file)
print(" CPU: %dKB (%dKB)" % ((int(round(
new_max_running_max_memory_size[1] / 1024.)), int(round(
max_running_max_memory_size[1] / 1024.)))), file=file)
print(" GPU: %dKB (%dKB)" % ((int(round(
new_max_running_max_memory_size[2] / 1024.)), int(round(
max_running_max_memory_size[2] / 1024.)))), file=file)
print("---", file=file) print("---", file=file)
print(" Max peak memory with current setting", file=file)
print(" Max if linker=cvm(default): %dKB (%dKB)" % (int(round( print_stats(stats[0], stats[2])
new_max_running_max_memory_size[0] / 1024.)), int(round( print(" Max peak memory with current setting and Theano flag optimizer_excluding=inplace", file=file)
max_running_max_memory_size[0] / 1024.))), file=file) print_stats(stats[1], stats[3])
print(" CPU: %dKB (%dKB)" % ((int(round(
new_max_running_max_memory_size[1] / 1024.)), int(round( (max_node_memory_size, _, _, _) = stats[0]
max_running_max_memory_size[1] / 1024.)))), file=file) (new_max_node_memory_size, _, _, _) = stats[2]
print(" GPU: %dKB (%dKB)" % ((int(round( print(" Max peak memory if allow_gc=False (linker don't make a difference)", file=file)
new_max_running_max_memory_size[2] / 1024.)), int(round( print(" CPU + GPU: %dKB" % int(round(
max_running_max_memory_size[2] / 1024.)))), file=file) new_max_node_memory_size[0] / 1024.)), file=file)
print(" CPU: %dKB" % int(round(
(new_max_node_memory_size, new_max_node_memory_size[1] / 1024.)), file=file)
new_max_running_max_memory_size, print(" GPU: %dKB" % int(round(
new_max_node_memory_saved_by_view, new_max_node_memory_size[2] / 1024.)), file=file)
new_max_node_memory_saved_by_inplace) = stats[3]
print(" Max if linker=cvm(default) and disable inplace: %dKB (%dKB)" % (int(round(
new_max_running_max_memory_size[0] / 1024.)), int(round(
max_running_max_memory_size[0] / 1024.))), file=file)
print(" CPU: %dKB (%dKB)" % ((int(round(
new_max_running_max_memory_size[1] / 1024.)), int(round(
max_running_max_memory_size[1] / 1024.)))), file=file)
print(" GPU: %dKB (%dKB)" % ((int(round(
new_max_running_max_memory_size[2] / 1024.)), int(round(
max_running_max_memory_size[2] / 1024.)))), file=file)
print("---", file=file) print("---", file=file)
(new_max_node_memory_size,
new_max_running_max_memory_size,
new_max_node_memory_saved_by_view,
new_max_node_memory_saved_by_inplace) = stats[2]
if min_max_peak: if min_max_peak:
print(" Minimum peak from all valid apply node order is " print(" Minimum peak from all valid apply node order is "
"%dKB(took %.3fs to compute)" % "%dKB(took %.3fs to compute)" %
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论