提交 450039f7 authored 作者: Frederic's avatar Frederic

Print the Gflops/s

上级 cb22e69d
...@@ -490,11 +490,9 @@ class ProfileStats(object): ...@@ -490,11 +490,9 @@ class ProfileStats(object):
hs += ['<id>'] hs += ['<id>']
es += ['%3d'] es += ['%3d']
es += ['%s', '%s']
if self.variable_shape: if self.variable_shape:
hs += ['<Mflops>'] hs += ['<Mflops>', '<Gflops/s>']
es += ['%.1f']
else:
es += ['%s']
upto_length = numpy.sum([len(x) for x in hs]) + len(hs) upto_length = numpy.sum([len(x) for x in hs]) + len(hs)
maxlen = self.line_width - upto_length maxlen = self.line_width - upto_length
...@@ -523,17 +521,20 @@ class ProfileStats(object): ...@@ -523,17 +521,20 @@ class ProfileStats(object):
continue continue
if not self.variable_shape: if not self.variable_shape:
flops = "" flops = ""
flops_s = ""
elif hasattr(a.op, 'flops'): elif hasattr(a.op, 'flops'):
flops = a.op.flops([self.variable_shape[var] fl = a.op.flops([self.variable_shape[var]
for var in a.inputs], for var in a.inputs],
[self.variable_shape[var] [self.variable_shape[var]
for var in a.outputs]) for var in a.outputs])
flops = flops/1024./1024 flops = '%8.1f' % (fl/1024./1024)
flops_s = '%10.1f' % (fl/1024./1024/1024/t)
else: else:
flops = -1 flops = " "
flops_s = " "
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,
flops, flops, flops_s,
str(a)[:maxlen]) str(a)[:maxlen])
if not config.profile_memory: if not config.profile_memory:
continue continue
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论