提交 5d252340 authored 作者: Frederic's avatar Frederic

Add a new flag profile_memory that will print the inputs/outputs shapes in the apply node profile.

上级 7d044df1
...@@ -268,6 +268,15 @@ import theano and print the config variable, as in: ...@@ -268,6 +268,15 @@ import theano and print the config variable, as in:
Do the vm/cvm linkers profile the execution of Theano functions? Do the vm/cvm linkers profile the execution of Theano functions?
.. attribute:: profile_memory
Bool value: either True or False
Default False
Do the vm/cvm linkers profile the memory of Theano functions get printed?
It only work when profile=True.
.. attribute:: profile_optimizer .. attribute:: profile_optimizer
Bool value: either True or False Bool value: either True or False
...@@ -275,6 +284,7 @@ import theano and print the config variable, as in: ...@@ -275,6 +284,7 @@ import theano and print the config variable, as in:
Default False Default False
Do the vm/cvm linkers profile the optimization phase when compiling a Theano function? Do the vm/cvm linkers profile the optimization phase when compiling a Theano function?
It only work when profile=True.
.. attribute:: config.lib.amdlibm .. attribute:: config.lib.amdlibm
......
...@@ -523,6 +523,16 @@ class ProfileStats(object): ...@@ -523,6 +523,16 @@ class ProfileStats(object):
print >> file, format_str %(f, ftot, t, t / nb_call, nb_call, print >> file, format_str %(f, ftot, t, t / nb_call, nb_call,
nd_id, nd_id,
str(a)[:maxlen]) str(a)[:maxlen])
if not config.profile_memory:
continue
for idx, var in enumerate(a.inputs):
sh = self.variable_shape.get(var, 'no shape')
dtype = getattr(var, 'dtype', 'no dtype')
print " input %d: dtype=%s, shape=%s " % (idx, dtype, sh)
for idx, var in enumerate(a.outputs):
sh = self.variable_shape.get(var, 'no shape')
dtype = getattr(var, 'dtype', 'no dtype')
print " output %d: dtype=%s, shape=%s " % (idx, dtype, sh)
# Same as before, this I've sacrificied some information making # Same as before, this I've sacrificied some information making
# the output more readable # the output more readable
#print >> file, ' %4.1f%% %5.1f%% %5.3fs %5.3fs %.2es %i %s'%( #print >> file, ' %4.1f%% %5.1f%% %5.3fs %5.3fs %.2es %i %s'%(
...@@ -670,7 +680,7 @@ class ProfileStats(object): ...@@ -670,7 +680,7 @@ class ProfileStats(object):
elif self.fct_callcount > 0: elif self.fct_callcount > 0:
print >> file, (" No node time accumulated " print >> file, (" No node time accumulated "
"(hint: try config profiling.time_thunks=1)") "(hint: try config profiling.time_thunks=1)")
if self.variable_shape: if config.profile_memory:
self.summary_memory(file, n_ops_to_print) self.summary_memory(file, n_ops_to_print)
if self.optimizer_profile: if self.optimizer_profile:
print "Optimizer Profile" print "Optimizer Profile"
......
...@@ -23,6 +23,9 @@ AddConfigVar('profile', ...@@ -23,6 +23,9 @@ AddConfigVar('profile',
AddConfigVar('profile_optimizer', AddConfigVar('profile_optimizer',
"If VM should collect optimizer profile information", "If VM should collect optimizer profile information",
BoolParam(False)) BoolParam(False))
AddConfigVar('profile_memory',
"If VM should collect memory profile information and print it",
BoolParam(False))
def filter_vm_lazy(val): def filter_vm_lazy(val):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论