提交 fe43e786 authored 作者: Frederic's avatar Frederic

Move completly the optimizer_time and linker_time into the ProfileStats.

上级 51a6bbc6
...@@ -1022,8 +1022,6 @@ class FunctionMaker(object): ...@@ -1022,8 +1022,6 @@ class FunctionMaker(object):
optimizer_profile = optimizer(fgraph) optimizer_profile = optimizer(fgraph)
end_optimizer = time.time() end_optimizer = time.time()
opt_time = end_optimizer - start_optimizer opt_time = end_optimizer - start_optimizer
mode.optimizer_time += opt_time
if profile: if profile:
profile.optimizer_time += opt_time profile.optimizer_time += opt_time
if theano.config.profile_optimizer: if theano.config.profile_optimizer:
...@@ -1183,7 +1181,6 @@ class FunctionMaker(object): ...@@ -1183,7 +1181,6 @@ class FunctionMaker(object):
linker_time = end_linker - start_linker linker_time = end_linker - start_linker
_logger.debug('Linker took %f seconds', linker_time) _logger.debug('Linker took %f seconds', linker_time)
self.mode.linker_time += linker_time
if self.profile: if self.profile:
self.profile.linker_time += linker_time self.profile.linker_time += linker_time
_fn.time_thunks = self.profile.flag_time_thunks _fn.time_thunks = self.profile.flag_time_thunks
......
...@@ -262,8 +262,6 @@ class Mode(object): ...@@ -262,8 +262,6 @@ class Mode(object):
self.call_time = 0 self.call_time = 0
self.fn_time = 0 self.fn_time = 0
linker.mode = self # TODO: WHY IS THIS HERE? linker.mode = self # TODO: WHY IS THIS HERE?
self.optimizer_time = 0
self.linker_time = 0
def __str__(self): def __str__(self):
return "%s(linker = %s, optimizer = %s)" % (self.__class__.__name__, return "%s(linker = %s, optimizer = %s)" % (self.__class__.__name__,
......
...@@ -202,8 +202,6 @@ class ProfileMode(Mode): ...@@ -202,8 +202,6 @@ class ProfileMode(Mode):
self.call_time = 0 self.call_time = 0
self.fn_time = 0 self.fn_time = 0
self.optimizer_time = 0
self.linker_time = 0
def print_summary(self, **kwargs): def print_summary(self, **kwargs):
""" Print 3 summary that show where the time is spend. The first show an Apply-wise summary, the second show an Op-wise summary, the third show an type-Op-wise summary. """ Print 3 summary that show where the time is spend. The first show an Apply-wise summary, the second show an Op-wise summary, the third show an type-Op-wise summary.
...@@ -289,9 +287,18 @@ class ProfileMode(Mode): ...@@ -289,9 +287,18 @@ class ProfileMode(Mode):
apply_cimpl = self.apply_cimpl and other.apply_cimpl apply_cimpl = self.apply_cimpl and other.apply_cimpl
message = self.message message = self.message
variable_shape = diff_dict(self.variable_shape, other.variable_shape) variable_shape = diff_dict(self.variable_shape, other.variable_shape)
other_time = {'linker_time': self.linker_time - other.linker_time, self_linker_time = sum([ps.linker_time for ps
'optimizer_time': self.optimizer_time - in self.profile_stats.values()])
other.optimizer_time} other_linker_time = sum([ps.linker_time for ps
in other.profile_stats.values()])
self_optimizer_time = sum([ps.optimizer_time for ps
in self.profile_stats.values()])
other_optimizer_time = sum([ps.optimizer_time for ps
in other.profile_stats.values()])
other_time = {'linker_time': self_linker_time - other_linker_time,
'optimizer_time': self_optimizer_time -
other_optimizer_time}
self.print_summary_("print_diff_summary", compile_time, self.print_summary_("print_diff_summary", compile_time,
fct_call_time, fct_call, fct_call_time, fct_call,
apply_time, apply_cimpl, message, variable_shape, apply_time, apply_cimpl, message, variable_shape,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论