Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
120b1ee9
提交
120b1ee9
authored
7月 20, 2009
作者:
James Bergstra
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
added some more checks to key pickles in cache mechanism
上级
54b0b796
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
12 行增加
和
3 行删除
+12
-3
cmodule.py
theano/gof/cmodule.py
+12
-3
没有找到文件。
theano/gof/cmodule.py
浏览文件 @
120b1ee9
...
@@ -7,7 +7,7 @@ import numpy.distutils #TODO: TensorType should handle this
...
@@ -7,7 +7,7 @@ import numpy.distutils #TODO: TensorType should handle this
import
compilelock
# we will abuse the lockfile mechanism when reading and writing the registry
import
compilelock
# we will abuse the lockfile mechanism when reading and writing the registry
_logger
=
logging
.
getLogger
(
"theano.gof.cmodule"
)
_logger
=
logging
.
getLogger
(
"theano.gof.cmodule"
)
_logger
.
setLevel
(
logging
.
WARN
)
_logger
.
setLevel
(
logging
.
INFO
)
def
error
(
*
args
):
def
error
(
*
args
):
#sys.stderr.write('ERROR:'+ ' '.join(str(a) for a in args)+'\n')
#sys.stderr.write('ERROR:'+ ' '.join(str(a) for a in args)+'\n')
...
@@ -274,6 +274,11 @@ class ModuleCache(object):
...
@@ -274,6 +274,11 @@ class ModuleCache(object):
info
(
"Erasing broken file"
,
key_pkl
)
info
(
"Erasing broken file"
,
key_pkl
)
os
.
remove
(
key_pkl
)
os
.
remove
(
key_pkl
)
continue
continue
if
not
key
[
0
]:
#if the version is False
warning
(
"ModuleCache.refresh() Found unversioned key in cache, deleting it."
,
key_pkl
)
info
(
"Erasing broken file"
,
key_pkl
)
os
.
remove
(
key_pkl
)
continue
if
key
not
in
self
.
entry_from_key
:
if
key
not
in
self
.
entry_from_key
:
entry
=
module_name_from_dir
(
root
)
entry
=
module_name_from_dir
(
root
)
self
.
entry_from_key
[
key
]
=
entry
self
.
entry_from_key
[
key
]
=
entry
...
@@ -301,6 +306,8 @@ class ModuleCache(object):
...
@@ -301,6 +306,8 @@ class ModuleCache(object):
info
(
"deleting ModuleCache entry"
,
entry
)
info
(
"deleting ModuleCache entry"
,
entry
)
del
self
.
entry_from_key
[
key
]
del
self
.
entry_from_key
[
key
]
if
key
[
0
]:
#this is a versioned entry, so should have been on disk
self
.
loaded_key_pkl
.
remove
(
os
.
path
.
join
(
os
.
path
.
dirname
(
entry
),
'key.pkl'
))
self
.
loaded_key_pkl
.
remove
(
os
.
path
.
join
(
os
.
path
.
dirname
(
entry
),
'key.pkl'
))
finally
:
finally
:
...
@@ -342,6 +349,7 @@ class ModuleCache(object):
...
@@ -342,6 +349,7 @@ class ModuleCache(object):
assert
name
.
startswith
(
location
)
assert
name
.
startswith
(
location
)
assert
name
not
in
self
.
module_from_name
assert
name
not
in
self
.
module_from_name
assert
key
not
in
self
.
entry_from_key
assert
key
not
in
self
.
entry_from_key
if
_version
:
# save they key
key_pkl
=
os
.
path
.
join
(
location
,
'key.pkl'
)
key_pkl
=
os
.
path
.
join
(
location
,
'key.pkl'
)
key_file
=
file
(
key_pkl
,
'w'
)
key_file
=
file
(
key_pkl
,
'w'
)
try
:
try
:
...
@@ -354,13 +362,13 @@ class ModuleCache(object):
...
@@ -354,13 +362,13 @@ class ModuleCache(object):
warning
(
"Cache leak due to unpickle-able key"
,
key
)
warning
(
"Cache leak due to unpickle-able key"
,
key
)
key_broken
=
True
key_broken
=
True
if
_version
and
not
key_broken
:
if
not
key_broken
:
key_from_file
=
cPickle
.
load
(
file
(
key_pkl
))
key_from_file
=
cPickle
.
load
(
file
(
key_pkl
))
if
key
!=
key_from_file
:
if
key
!=
key_from_file
:
raise
Exception
(
"key not equal to unpickled version (Hint: verify the __eq__ and __hash__ functions for your Ops"
,
(
key
,
key_from_file
))
raise
Exception
(
"key not equal to unpickled version (Hint: verify the __eq__ and __hash__ functions for your Ops"
,
(
key
,
key_from_file
))
self
.
loaded_key_pkl
.
add
(
key_pkl
)
self
.
entry_from_key
[
key
]
=
name
self
.
entry_from_key
[
key
]
=
name
self
.
module_from_name
[
name
]
=
module
self
.
module_from_name
[
name
]
=
module
self
.
loaded_key_pkl
.
add
(
key_pkl
)
self
.
stats
[
2
]
+=
1
self
.
stats
[
2
]
+=
1
rval
=
module
rval
=
module
...
@@ -448,6 +456,7 @@ def gcc_module_compile_str(module_name, src_code, location=None, include_dirs=[]
...
@@ -448,6 +456,7 @@ def gcc_module_compile_str(module_name, src_code, location=None, include_dirs=[]
preargs
.
append
(
'-fPIC'
)
preargs
.
append
(
'-fPIC'
)
no_opt
=
False
no_opt
=
False
include_dirs
=
[
distutils
.
sysconfig
.
get_python_inc
()]
+
\
include_dirs
=
[
distutils
.
sysconfig
.
get_python_inc
()]
+
\
numpy
.
distutils
.
misc_util
.
get_numpy_include_dirs
()
\
numpy
.
distutils
.
misc_util
.
get_numpy_include_dirs
()
\
+
include_dirs
+
include_dirs
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论