Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
5afc4fb4
提交
5afc4fb4
authored
5月 11, 2012
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added the numpy ABI version in the key and update "theano-cache cleanup" to…
Added the numpy ABI version in the key and update "theano-cache cleanup" to delete key that don't have it.
上级
ce589649
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
22 行增加
和
2 行删除
+22
-2
cc.py
theano/gof/cc.py
+9
-1
cmodule.py
theano/gof/cmodule.py
+3
-0
compiledir.py
theano/gof/compiledir.py
+10
-1
没有找到文件。
theano/gof/cc.py
浏览文件 @
5afc4fb4
...
...
@@ -11,6 +11,9 @@ import sys
from
itertools
import
izip
import
numpy
if
sys
.
version_info
[:
2
]
>=
(
2
,
5
):
import
hashlib
...
...
@@ -918,7 +921,7 @@ class CLinker(link.Linker):
The signature has the following form:
{{{
'CLinker.cmodule_key', compilation args, libraries,
header_dirs, config md5,
header_dirs,
numpy ABI version,
config md5,
(op0, input_signature0, output_signature0),
(op1, input_signature1, output_signature1),
...
...
...
@@ -1032,6 +1035,11 @@ class CLinker(link.Linker):
args
=
tuple
(
args
)
sig
.
append
(
args
)
#We must always add the numpy ABI version here as
# DynamicModule always add the include <numpy/arrayobject.h>
sig
.
append
(
'NPY_ABI_VERSION=0x
%
X'
%
numpy
.
core
.
multiarray
.
_get_ndarray_c_version
())
# IMPORTANT: The 'md5' prefix is used to isolate the compilation
# parameters from the rest of the key. If you want to add more key
# elements, they should be before this md5 hash if and only if they
...
...
theano/gof/cmodule.py
浏览文件 @
5afc4fb4
...
...
@@ -314,6 +314,7 @@ def get_module_hash(src_code, key):
2. The version part of the key.
3. The compiler options defined in `key` (command line parameters and
libraries to link against).
4. The NumPy ABI version.
"""
# `to_hash` will contain any element such that we know for sure that if
# it changes, then the module hash should be different.
...
...
@@ -347,6 +348,8 @@ def get_module_hash(src_code, key):
# This is the md5 hash of the config options. We can stop
# here.
break
elif
key_element
.
startswith
(
'NPY_ABI_VERSION=0x'
):
to_hash
.
append
(
key_element
)
else
:
raise
AssertionError
(
error_msg
)
else
:
...
...
theano/gof/compiledir.py
浏览文件 @
5afc4fb4
...
...
@@ -115,8 +115,10 @@ def cleanup():
"""
Delete keys in old format from the compiledir.
We define keys in old format as keys that have an ndarray in them.
Old clean up include key in old format:
1) keys that have an ndarray in them.
Now we use a hash in the keys of the constant data.
2) key that don't have the numpy ABI version in them
If there is no key left for a compiled module, we delete the module.
"""
...
...
@@ -131,10 +133,17 @@ def cleanup():
try
:
keydata
=
cPickle
.
load
(
file
)
for
key
in
list
(
keydata
.
keys
):
have_npy_abi_version
=
False
for
obj
in
flatten
(
key
):
if
isinstance
(
obj
,
numpy
.
ndarray
):
keydata
.
remove_key
(
key
)
break
if
(
isinstance
(
obj
,
basestring
)
and
obj
.
startswith
(
'NPY_ABI_VERSION=0x'
)):
have_npy_abi_version
=
True
if
not
have_npy_abi_version
:
keydata
.
remove_key
(
key
)
if
len
(
keydata
.
keys
)
==
0
:
shutil
.
rmtree
(
os
.
path
.
join
(
compiledir
,
directory
))
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论