Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
95adacbd
提交
95adacbd
authored
2月 05, 2013
作者:
lamblin
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1197 from nouiz/lock
Take the compiledir lock only if the op generate c code.
上级
c4e6bded
9d06e115
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
13 行增加
和
5 行删除
+13
-5
cmodule.py
theano/gof/cmodule.py
+13
-5
没有找到文件。
theano/gof/cmodule.py
浏览文件 @
95adacbd
...
@@ -891,10 +891,11 @@ class ModuleCache(object):
...
@@ -891,10 +891,11 @@ class ModuleCache(object):
hash_key
=
hash
(
key
)
hash_key
=
hash
(
key
)
key_data
=
None
key_data
=
None
# We have never seen this key before.
# We have never seen this key before.
# Acquire lock before creating things in the compile cache,
# to avoid that other processes remove the compile dir while it
# We acquire the lock later only if we where able to
# is still empty.
# generate c code Otherwise, we would take the lock for op
compilelock
.
get_lock
()
# that have only a perform().
lock_taken
=
False
# This try/finally block ensures that the lock is released once we
# This try/finally block ensures that the lock is released once we
# are done writing in the cache file or after raising an exception.
# are done writing in the cache file or after raising an exception.
try
:
try
:
...
@@ -918,6 +919,13 @@ class ModuleCache(object):
...
@@ -918,6 +919,13 @@ class ModuleCache(object):
# The first compilation step is to yield the source code.
# The first compilation step is to yield the source code.
src_code
=
compile_steps
.
next
()
src_code
=
compile_steps
.
next
()
module_hash
=
get_module_hash
(
src_code
,
key
)
module_hash
=
get_module_hash
(
src_code
,
key
)
# The op have c_code, so take the lock.
compilelock
.
get_lock
()
lock_taken
=
True
assert
os
.
path
.
exists
(
location
),
(
"The directory just created shouldn't be deleted!"
)
if
module_hash
in
self
.
module_hash_to_key_data
:
if
module_hash
in
self
.
module_hash_to_key_data
:
_logger
.
debug
(
"Duplicated module! Will re-use the "
_logger
.
debug
(
"Duplicated module! Will re-use the "
"previous one"
)
"previous one"
)
...
@@ -1039,7 +1047,7 @@ class ModuleCache(object):
...
@@ -1039,7 +1047,7 @@ class ModuleCache(object):
finally
:
finally
:
# Release lock if needed.
# Release lock if needed.
if
not
keep_lock
:
if
not
keep_lock
and
lock_taken
:
compilelock
.
release_lock
()
compilelock
.
release_lock
()
# Update map from key to module name for all keys associated to
# Update map from key to module name for all keys associated to
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论