提交 7c9b917f authored 作者: Frederic Bastien's avatar Frederic Bastien

Add Theano flag profiling.ignore_first_call

上级 4b763483
......@@ -388,6 +388,14 @@ import theano and print the config variable, as in:
Do a debugprint of the profiled functions
.. attribute:: config.profiling.ignore_first_call
Bool value: either True or False
Default False
Do we ignore the first call to a Theano function while profiling.
.. attribute:: config.lib.amdlibm
Bool value: either True or False
......
......@@ -928,7 +928,9 @@ class Function(object):
profile.fct_call_time += dt_call
if hasattr(self.fn, 'update_profile'):
self.fn.update_profile(profile)
if profile.ignore_first_call:
profile.reset()
profile.ignore_first_call = False
if self.return_none:
return None
elif self.unpack_single and len(outputs) == 1:
......
......@@ -110,7 +110,16 @@ class ProfileStats(object):
in this class.
"""
def reset(self):
""" Ignore previous function call"""
#self.compile_time = 0.
self.fct_call_time = 0.
self.fct_callcount = 0
self.vm_call_time = 0.
self.apply_time = {}
self.apply_callcount = {}
# self.apply_cimpl = None
#self.messge = None
#
# Note on implementation:
# Class variables are used here so that each one can be
......@@ -216,6 +225,7 @@ class ProfileStats(object):
if not _atexit_registered:
atexit.register(_atexit_print_fn)
_atexit_registered = True
self.ignore_first_call = theano.config.ignore_first_call
def class_time(self):
"""
......
......@@ -1043,6 +1043,13 @@ AddConfigVar('profiling.debugprint',
BoolParam(False),
in_c_key=False)
AddConfigVar('profiling.ignore_first_call',
"""
Do we ignore the first call of a Theano function.
""",
BoolParam(False),
in_c_key=False)
AddConfigVar('optdb.position_cutoff',
'Where to stop eariler during optimization. It represent the'
' position of the optimizer where to stop.',
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论