Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
ec2ff8e2
提交
ec2ff8e2
authored
6月 03, 2011
作者:
Olivier Delalleau
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
The 'theano-cache clearn' command now also deletes directories cuda_ndarray and cutils_ext
上级
cdb5a5c3
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
34 行增加
和
3 行删除
+34
-3
theano-cache
bin/theano-cache
+1
-1
cmodule.py
theano/gof/cmodule.py
+33
-2
没有找到文件。
bin/theano-cache
浏览文件 @
ec2ff8e2
...
@@ -6,7 +6,7 @@ from theano.gof.cc import get_module_cache
...
@@ -6,7 +6,7 @@ from theano.gof.cc import get_module_cache
if
len
(
sys
.
argv
)
==
1
:
if
len
(
sys
.
argv
)
==
1
:
print
config
.
compiledir
print
config
.
compiledir
elif
sys
.
argv
[
1
]
in
(
'clear'
):
elif
sys
.
argv
[
1
]
in
(
'clear'
):
get_module_cache
()
.
clear
(
unversioned_min_age
=-
1
)
get_module_cache
()
.
clear
(
unversioned_min_age
=-
1
,
clear_base_files
=
True
)
else
:
else
:
print
'command "
%
s" not recognized'
%
sys
.
argv
[
1
]
print
'command "
%
s" not recognized'
%
sys
.
argv
[
1
]
print
'Type "theano-cache" to print the cache location'
print
'Type "theano-cache" to print the cache location'
...
...
theano/gof/cmodule.py
浏览文件 @
ec2ff8e2
...
@@ -762,17 +762,48 @@ class ModuleCache(object):
...
@@ -762,17 +762,48 @@ class ModuleCache(object):
if
get_lock
:
if
get_lock
:
compilelock
.
release_lock
()
compilelock
.
release_lock
()
def
clear
(
self
,
unversioned_min_age
=
None
):
def
clear
(
self
,
unversioned_min_age
=
None
,
clear_base_files
=
False
):
"""
"""
Clear all the elements of the cache
Clear all elements in the cache.
:param unversioned_min_age: Forwarded to `clear_unversioned`. In
particular, you can set it to -1 in order to delete all unversioned
cached modules regardless of their age.
:clear_base_files: If True, then delete base directories 'cuda_ndarray'
and 'cutils_ext' if they are present. If False, those directories are
left intact.
"""
"""
compilelock
.
get_lock
()
compilelock
.
get_lock
()
try
:
try
:
self
.
clear_old
(
-
1.0
,
get_lock
=
False
)
self
.
clear_old
(
-
1.0
,
get_lock
=
False
)
self
.
clear_unversioned
(
min_age
=
unversioned_min_age
,
get_lock
=
False
)
self
.
clear_unversioned
(
min_age
=
unversioned_min_age
,
get_lock
=
False
)
if
clear_base_files
:
self
.
clear_base_files
(
get_lock
=
False
)
finally
:
finally
:
compilelock
.
release_lock
()
compilelock
.
release_lock
()
def
clear_base_files
(
self
,
get_lock
=
True
):
"""
Delete base directories 'cuda_ndarray' and 'cutils_ext' if present.
:param get_lock: If True, then this function acquires then releases the
lock on the compile dir.
"""
if
get_lock
:
compilelock
.
get_lock
()
try
:
for
base_dir
in
(
'cuda_ndarray'
,
'cutils_ext'
):
to_delete
=
os
.
path
.
join
(
self
.
dirname
,
base_dir
)
if
os
.
path
.
isdir
(
to_delete
):
try
:
shutil
.
rmtree
(
to_delete
)
except
:
warning
(
'Could not delete
%
s'
%
to_delete
)
finally
:
if
get_lock
:
compilelock
.
release_lock
()
def
clear_unversioned
(
self
,
min_age
=
None
,
get_lock
=
True
):
def
clear_unversioned
(
self
,
min_age
=
None
,
get_lock
=
True
):
"""
"""
Delete unversioned dynamic modules.
Delete unversioned dynamic modules.
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论