提交 df50d612 authored 作者: James Bergstra's avatar James Bergstra

added cthunk failure-checking code to ProfileMode

上级 412665cd
......@@ -17,16 +17,18 @@ class ProfileMode(Mode):
def blah(i, node, th):
if hasattr(th, 'cthunk'):
t0 = time.time()
run_cthunk(th.cthunk)
failure = run_cthunk(th.cthunk)
dt = time.time() - t0
if failure:
raise RuntimeError('A C Op raised an exception. PerformLinker cannot tell you what it was though. Use a standard mode such as FAST_RUN to correct the problem.')
else:
t0 = time.time()
th()
dt = time.time() - t0
local_time[0] += dt
apply_time[(i,node.op)] = apply_time.get((i,node.op), 0.0) + dt
apply_call[(i,node.op)] = apply_call.get((i,node.op), 0) + 1
apply_time[(i,node.op, tuple(node.inputs))] = apply_time.get((i,node.op, tuple(node.inputs)), 0.0) + dt
apply_call[(i,node.op, tuple(node.inputs))] = apply_call.get((i,node.op, tuple(node.inputs)), 0) + 1
op_time[node.op] = op_time.get(node.op, 0.0) + dt
op_cimpl[node.op] = hasattr(th, 'cthunk')
op_call[node.op] = op_call.get(node.op,0) + 1
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论