提交 ff354011 authored 作者: Frederic Bastien's avatar Frederic Bastien

fix bug with the new lock behavior introduced yesterday.

上级 bcf400ec
...@@ -1154,7 +1154,6 @@ class OpWiseCLinker(link.LocalLinker): ...@@ -1154,7 +1154,6 @@ class OpWiseCLinker(link.LocalLinker):
# C code. We will keep the lock untill all the function # C code. We will keep the lock untill all the function
# compilation will be finished. This allow to don't # compilation will be finished. This allow to don't
# require the lock when all c code are already compiled! # require the lock when all c code are already compiled!
keep_lock=True
orig_n_lock = getattr(get_lock,"n_lock",0) orig_n_lock = getattr(get_lock,"n_lock",0)
try: try:
...@@ -1194,14 +1193,11 @@ class OpWiseCLinker(link.LocalLinker): ...@@ -1194,14 +1193,11 @@ class OpWiseCLinker(link.LocalLinker):
thunk, node_input_filters, node_output_filters = cl.make_thunk( thunk, node_input_filters, node_output_filters = cl.make_thunk(
input_storage = node_input_storage, input_storage = node_input_storage,
output_storage = node_output_storage, output_storage = node_output_storage,
keep_lock=keep_lock) keep_lock=getattr(get_lock,"n_lock",0) != orig_n_lock)
assert callable(thunk) assert callable(thunk)
thunk.inputs = node_input_storage thunk.inputs = node_input_storage
thunk.outputs = node_output_storage thunk.outputs = node_output_storage
thunks.append(thunk) thunks.append(thunk)
if keep_lock and get_lock.n_lock > orig_n_lock:
keep_lock=False
do_python_thunk = False do_python_thunk = False
except (NotImplementedError, utils.MethodNotDefined): except (NotImplementedError, utils.MethodNotDefined):
thunk = None thunk = None
...@@ -1241,7 +1237,7 @@ class OpWiseCLinker(link.LocalLinker): ...@@ -1241,7 +1237,7 @@ class OpWiseCLinker(link.LocalLinker):
finally: finally:
# Release lock on compilation directory. # Release lock on compilation directory.
if get_lock.n_lock > orig_n_lock: if getattr(get_lock,"n_lock",0) > orig_n_lock:
release_lock() release_lock()
assert get_lock.n_lock == orig_n_lock assert get_lock.n_lock == orig_n_lock
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论