experimental linker is default

上级 2d08b840
...@@ -11,11 +11,11 @@ def experimental_linker(env, target = None): ...@@ -11,11 +11,11 @@ def experimental_linker(env, target = None):
def fetch(op): def fetch(op):
try: try:
factory = op.c_thunk_factory() factory = op.c_thunk_factory()
# print "yea %s" % op print "yea %s" % op
thunk = factory() thunk = factory()
return lambda: cutils.run_cthunk(thunk) return lambda: cutils.run_cthunk(thunk)
except NotImplementedError: except NotImplementedError:
# print "nope %s" % op print "nope %s" % op
return op._perform return op._perform
order = env.toposort() order = env.toposort()
for op in order: for op in order:
...@@ -47,8 +47,8 @@ class profile_linker: ...@@ -47,8 +47,8 @@ class profile_linker:
self.n_thunks = 0 self.n_thunks = 0
self.times = [0.0 for op in self.order] self.times = [0.0 for op in self.order]
#TODO: popen2("dot -Tpng | display") and actually make the graph window pop up
def print_for_dot(self): def print_for_dot(self):
#TODO: popen2("dot -Tpng | display") and actually make the graph window pop up
print "digraph unix { size = '6,6'; node [color = lightblue2; style = filled];" print "digraph unix { size = '6,6'; node [color = lightblue2; style = filled];"
for op in self.order: for op in self.order:
for input in op.inputs: for input in op.inputs:
...@@ -102,8 +102,8 @@ class profile_linker: ...@@ -102,8 +102,8 @@ class profile_linker:
class prog(gof.Prog): class prog(gof.Prog):
def __init__(self, inputs, outputs, optimizer = opt.optimizer([]), linker = def __init__(self, inputs, outputs, optimizer = opt.optimizer([]),
gof.link.perform_linker): linker = experimental_linker):
"""Compile a subgraph. """Compile a subgraph.
N.B. This triggers computation of the subgraph leading to the outputs N.B. This triggers computation of the subgraph leading to the outputs
...@@ -112,7 +112,6 @@ class prog(gof.Prog): ...@@ -112,7 +112,6 @@ class prog(gof.Prog):
TODO: think about whether orphan computation should be in this function, TODO: think about whether orphan computation should be in this function,
or in self.__call__() or in self.__call__()
""" """
linker = experimental_linker
new_outputs = gof.mark_outputs_as_destroyed(outputs) new_outputs = gof.mark_outputs_as_destroyed(outputs)
gof.Prog.__init__(self, gof.Prog.__init__(self,
inputs, inputs,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论