提交 d3dcb876 authored 作者: Faruk Ahmed's avatar Faruk Ahmed

add flag, print if flag is true

上级 003c24a2
......@@ -111,6 +111,8 @@ def _atexit_print_fn():
n_ops_to_print=config.profiling.n_ops,
n_apply_to_print=config.profiling.n_apply)
if config.print_global_stats:
print_global_stats()
def print_global_stats():
"""
......@@ -129,15 +131,18 @@ def print_global_stats():
else:
destination_file = open(config.profiling.destination, 'w')
print('Time elasped since Theano import = %6.2fs, '
'Time spent in Theano functions = %6.2fs, '
print('='*50, file=destination_file)
print('Global stats: ',
'Time elasped since Theano import = %6.3fs, '
'Time spent in Theano functions = %6.3fs, '
'Time spent compiling Theano functions: '
' optimzation = %6.2s, linker = %6.2s ' %
(theano_imported_time,
' optimzation = %6.3fs, linker = %6.3fs ' %
(time.time() - theano_imported_time,
total_fct_exec_time,
total_graph_opt_time,
total_time_linker),
file=file)
file=destination_file)
print('='*50, file=destination_file)
class ProfileStats(object):
......
......@@ -126,6 +126,12 @@ AddConfigVar(
BoolParam(False, allow_override=False),
in_c_key=False)
AddConfigVar(
'print_global_stats',
"Print some global statistics (time spent) at the end",
BoolParam(False),
in_c_key=False)
class ContextsParam(ConfigParam):
def __init__(self):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论