Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
67323e7f
提交
67323e7f
authored
8月 28, 2009
作者:
Frederic Bastien
浏览文件
操作
浏览文件
下载
差异文件
merge
上级
95ded5b4
0bfb7f8c
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
18 行增加
和
9 行删除
+18
-9
cmodule.py
theano/gof/cmodule.py
+18
-9
没有找到文件。
theano/gof/cmodule.py
浏览文件 @
67323e7f
...
@@ -179,10 +179,8 @@ def module_name_from_dir(dirname):
...
@@ -179,10 +179,8 @@ def module_name_from_dir(dirname):
"""Scan the contents of a cache directory and return full path of the dynamic lib in it.
"""Scan the contents of a cache directory and return full path of the dynamic lib in it.
"""
"""
files
=
os
.
listdir
(
dirname
)
files
=
os
.
listdir
(
dirname
)
names
=
[
file
for
file
in
files
if
file
.
endswith
(
'.so'
)
or
file
.
endswith
(
'.pyd'
)]
name
,
=
[
file
for
file
in
files
if
file
.
endswith
(
'.so'
)
or
file
.
endswith
(
'.pyd'
)]
if
len
(
names
)
!=
1
:
return
os
.
path
.
join
(
dirname
,
name
)
raise
Exception
(
'Failed to load dynamic libraries from dir'
,
dirname
)
return
os
.
path
.
join
(
dirname
,
names
[
0
])
class
ModuleCache
(
object
):
class
ModuleCache
(
object
):
"""Interface to the cache of dynamically compiled modules on disk
"""Interface to the cache of dynamically compiled modules on disk
...
@@ -265,6 +263,8 @@ class ModuleCache(object):
...
@@ -265,6 +263,8 @@ class ModuleCache(object):
Add entries that are not in the entry_from_key dictionary.
Add entries that are not in the entry_from_key dictionary.
Remove entries which have been removed from the filesystem.
Remove entries which have been removed from the filesystem.
Also, remove malformed cache directories.
"""
"""
compilelock
.
get_lock
()
compilelock
.
get_lock
()
try
:
try
:
...
@@ -279,16 +279,25 @@ class ModuleCache(object):
...
@@ -279,16 +279,25 @@ class ModuleCache(object):
key
=
cPickle
.
load
(
file
(
key_pkl
))
key
=
cPickle
.
load
(
file
(
key_pkl
))
except
:
except
:
error
(
"ModuleCache.refresh() Failed to unpickle cache key"
,
key_pkl
)
error
(
"ModuleCache.refresh() Failed to unpickle cache key"
,
key_pkl
)
info
(
"Erasing broken
file
"
,
key_pkl
)
info
(
"Erasing broken
cache directory
"
,
key_pkl
)
os
.
remove
(
key_pkl
)
shutil
.
rmtree
(
root
)
continue
continue
if
not
key
[
0
]:
#if the version is False
if
not
key
[
0
]:
#if the version is False
warning
(
"ModuleCache.refresh() Found unversioned key in cache, deleting it."
,
key_pkl
)
warning
(
"ModuleCache.refresh() Found unversioned key in cache, deleting it."
,
key_pkl
)
info
(
"Erasing broken
file
"
,
key_pkl
)
info
(
"Erasing broken
cache directory
"
,
key_pkl
)
os
.
remove
(
key_pkl
)
shutil
.
rmtree
(
root
)
continue
continue
if
key
not
in
self
.
entry_from_key
:
if
key
not
in
self
.
entry_from_key
:
entry
=
module_name_from_dir
(
root
)
try
:
entry
=
module_name_from_dir
(
root
)
except
ValueError
:
# there is a key but no dll!
warning
(
"ModuleCache.refresh() Found key without dll in cache, deleting it."
,
key_pkl
)
info
(
"Erasing broken cache directory"
,
key_pkl
)
shutil
.
rmtree
(
root
)
continue
self
.
entry_from_key
[
key
]
=
entry
self
.
entry_from_key
[
key
]
=
entry
# assert that we haven't already got this entry somehow
# assert that we haven't already got this entry somehow
assert
entry
not
in
self
.
module_from_name
assert
entry
not
in
self
.
module_from_name
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论