Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
7f3f632c
提交
7f3f632c
authored
5月 26, 2011
作者:
Olivier Delalleau
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added a warning when the same key is associated to different modules
Also fixed a bug where the same key.pkl file could be loaded multiple times.
上级
ec4e08d5
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
15 行增加
和
5 行删除
+15
-5
cmodule.py
theano/gof/cmodule.py
+15
-5
没有找到文件。
theano/gof/cmodule.py
浏览文件 @
7f3f632c
...
@@ -211,7 +211,7 @@ def get_module_hash(module_file, key):
...
@@ -211,7 +211,7 @@ def get_module_hash(module_file, key):
Return an MD5 hash that identifies a module.
Return an MD5 hash that identifies a module.
This hash takes into account:
This hash takes into account:
1. The 'mod.cpp'
file associated
used to compile `module_file`.
1. The 'mod.cpp'
or 'mod.cu' file
used to compile `module_file`.
2. The compiler options defined in `key`.
2. The compiler options defined in `key`.
"""
"""
source_code
=
os
.
path
.
join
(
os
.
path
.
dirname
(
module_file
),
'mod.cpp'
)
source_code
=
os
.
path
.
join
(
os
.
path
.
dirname
(
module_file
),
'mod.cpp'
)
...
@@ -364,8 +364,12 @@ class ModuleCache(object):
...
@@ -364,8 +364,12 @@ class ModuleCache(object):
warning
(
"hash 1:"
,
hash
(
k1
))
warning
(
"hash 1:"
,
hash
(
k1
))
age_thresh_use
=
60
*
60
*
24
*
24
age_thresh_use
=
60
*
60
*
24
*
24
"""The default age threshold for `clear_old` (in seconds)
"""
"""
The default age threshold (in seconds) for cache files we want to use.
Older modules will be deleted in ``clear_old``.
"""
def
refresh
(
self
):
def
refresh
(
self
):
"""Update self.entry_from_key by walking the cache directory structure.
"""Update self.entry_from_key by walking the cache directory structure.
...
@@ -473,6 +477,13 @@ class ModuleCache(object):
...
@@ -473,6 +477,13 @@ class ModuleCache(object):
# Assert that we have not already got this
# Assert that we have not already got this
# entry somehow.
# entry somehow.
assert
entry
not
in
self
.
module_from_name
assert
entry
not
in
self
.
module_from_name
else
:
warning
(
"The same cache key is associated to "
"different modules. This should not "
"be possible! We will re-use the first"
" module (
%
s) instead of the new one "
"(
%
s)."
%
(
self
.
entry_from_key
[
key
],
entry
))
self
.
loaded_key_pkl
.
add
(
key_pkl
)
self
.
loaded_key_pkl
.
add
(
key_pkl
)
# Remember the map from a module's hash to the KeyData
# Remember the map from a module's hash to the KeyData
...
@@ -482,10 +493,9 @@ class ModuleCache(object):
...
@@ -482,10 +493,9 @@ class ModuleCache(object):
# This should not happen anymore, but may happen
# This should not happen anymore, but may happen
# with the previous cache mechanism, that did not
# with the previous cache mechanism, that did not
# ensure uniqueness of the compiled modules.
# ensure uniqueness of the compiled modules.
# TODO Convert into an error in the future.
warning
(
warning
(
"Found duplicated modules in the cache, you "
"Found duplicated modules in the cache, you "
"
are probably
using an old cache. Clear it "
"
may be
using an old cache. Clear it "
"with 'theano-cache clear' to benefit from "
"with 'theano-cache clear' to benefit from "
"recent cache optimizations."
)
"recent cache optimizations."
)
else
:
else
:
...
@@ -803,7 +813,7 @@ class ModuleCache(object):
...
@@ -803,7 +813,7 @@ class ModuleCache(object):
compilelock
.
release_lock
()
compilelock
.
release_lock
()
def
_on_atexit
(
self
):
def
_on_atexit
(
self
):
#
self.refresh()#refresh is called by clear_old(), this can be long for big directory
#
Note: no need to call refresh() since it is called by clear_old().
compilelock
.
get_lock
()
compilelock
.
get_lock
()
try
:
try
:
self
.
clear_old
(
get_lock
=
False
)
self
.
clear_old
(
get_lock
=
False
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论