Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
46b12f1f
提交
46b12f1f
authored
6月 19, 2013
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
pep8
上级
8faaecc9
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
22 行增加
和
22 行删除
+22
-22
cmodule.py
theano/gof/cmodule.py
+22
-22
没有找到文件。
theano/gof/cmodule.py
浏览文件 @
46b12f1f
...
@@ -479,7 +479,7 @@ class KeyData(object):
...
@@ -479,7 +479,7 @@ class KeyData(object):
protocol
=
cPickle
.
HIGHEST_PROTOCOL
)
protocol
=
cPickle
.
HIGHEST_PROTOCOL
)
except
cPickle
.
PicklingError
:
except
cPickle
.
PicklingError
:
_logger
.
warning
(
"Cache leak due to unpickle-able key data
%
s"
,
_logger
.
warning
(
"Cache leak due to unpickle-able key data
%
s"
,
self
.
keys
)
self
.
keys
)
os
.
remove
(
self
.
key_pkl
)
os
.
remove
(
self
.
key_pkl
)
raise
raise
...
@@ -664,8 +664,8 @@ class ModuleCache(object):
...
@@ -664,8 +664,8 @@ class ModuleCache(object):
# os. So it is normal that this happens from time
# os. So it is normal that this happens from time
# to time.
# to time.
_logger
.
warning
(
"ModuleCache.refresh() Found key "
_logger
.
warning
(
"ModuleCache.refresh() Found key "
"without dll in cache, deleting it.
%
s"
,
"without dll in cache, deleting it.
%
s"
,
key_pkl
)
key_pkl
)
_rmtree
(
root
,
ignore_nocleanup
=
True
,
_rmtree
(
root
,
ignore_nocleanup
=
True
,
msg
=
"missing module file"
,
level
=
logging
.
INFO
)
msg
=
"missing module file"
,
level
=
logging
.
INFO
)
continue
continue
...
@@ -674,7 +674,7 @@ class ModuleCache(object):
...
@@ -674,7 +674,7 @@ class ModuleCache(object):
def
unpickle_failure
():
def
unpickle_failure
():
_logger
.
info
(
"ModuleCache.refresh() Failed to "
_logger
.
info
(
"ModuleCache.refresh() Failed to "
"unpickle cache file
%
s"
,
key_pkl
)
"unpickle cache file
%
s"
,
key_pkl
)
try
:
try
:
key_data
=
cPickle
.
load
(
open
(
key_pkl
,
'rb'
))
key_data
=
cPickle
.
load
(
open
(
key_pkl
,
'rb'
))
...
@@ -779,9 +779,9 @@ class ModuleCache(object):
...
@@ -779,9 +779,9 @@ class ModuleCache(object):
level
=
logging
.
DEBUG
)
level
=
logging
.
DEBUG
)
else
:
else
:
_logger
.
debug
(
'Found duplicated module not '
_logger
.
debug
(
'Found duplicated module not '
'old enough yet to be deleted '
'old enough yet to be deleted '
'(age:
%
s):
%
s'
,
'(age:
%
s):
%
s'
,
age
,
entry
)
age
,
entry
)
continue
continue
# Remember the map from a module's hash to the KeyData
# Remember the map from a module's hash to the KeyData
...
@@ -870,7 +870,7 @@ class ModuleCache(object):
...
@@ -870,7 +870,7 @@ class ModuleCache(object):
compilelock
.
release_lock
()
compilelock
.
release_lock
()
_logger
.
debug
(
'Time needed to refresh cache:
%
s'
,
_logger
.
debug
(
'Time needed to refresh cache:
%
s'
,
(
time
.
time
()
-
start_time
))
(
time
.
time
()
-
start_time
))
return
too_old_to_use
return
too_old_to_use
...
@@ -934,8 +934,8 @@ class ModuleCache(object):
...
@@ -934,8 +934,8 @@ class ModuleCache(object):
_logger
.
error
(
e
)
_logger
.
error
(
e
)
if
e
.
errno
==
31
:
if
e
.
errno
==
31
:
_logger
.
error
(
'There are
%
i files in
%
s'
,
_logger
.
error
(
'There are
%
i files in
%
s'
,
len
(
os
.
listdir
(
config
.
compiledir
)),
len
(
os
.
listdir
(
config
.
compiledir
)),
config
.
compiledir
)
config
.
compiledir
)
raise
raise
try
:
try
:
compile_steps
=
fn
(
location
=
location
)
.
__iter__
()
compile_steps
=
fn
(
location
=
location
)
.
__iter__
()
...
@@ -958,7 +958,7 @@ class ModuleCache(object):
...
@@ -958,7 +958,7 @@ class ModuleCache(object):
if
module_hash
in
self
.
module_hash_to_key_data
:
if
module_hash
in
self
.
module_hash_to_key_data
:
_logger
.
debug
(
"Duplicated module! Will re-use the "
_logger
.
debug
(
"Duplicated module! Will re-use the "
"previous one"
)
"previous one"
)
duplicated_module
=
True
duplicated_module
=
True
# Load the already existing module.
# Load the already existing module.
key_data
=
self
.
module_hash_to_key_data
[
module_hash
]
key_data
=
self
.
module_hash_to_key_data
[
module_hash
]
...
@@ -966,7 +966,7 @@ class ModuleCache(object):
...
@@ -966,7 +966,7 @@ class ModuleCache(object):
# should not be used considering that the module should
# should not be used considering that the module should
# already be compiled.
# already be compiled.
module
=
self
.
module_from_key
(
key
=
None
,
module
=
self
.
module_from_key
(
key
=
None
,
key_data
=
key_data
)
key_data
=
key_data
)
name
=
module
.
__file__
name
=
module
.
__file__
# Add current key to the set of keys associated to the
# Add current key to the set of keys associated to the
# same module. We only save the KeyData object of
# same module. We only save the KeyData object of
...
@@ -1007,7 +1007,7 @@ class ModuleCache(object):
...
@@ -1007,7 +1007,7 @@ class ModuleCache(object):
name
=
module
.
__file__
name
=
module
.
__file__
_logger
.
debug
(
"Adding module to cache
%
s
%
s"
,
_logger
.
debug
(
"Adding module to cache
%
s
%
s"
,
key
,
name
)
key
,
name
)
assert
name
.
startswith
(
location
)
assert
name
.
startswith
(
location
)
assert
name
not
in
self
.
module_from_name
assert
name
not
in
self
.
module_from_name
# Changing the hash of the key is not allowed during
# Changing the hash of the key is not allowed during
...
@@ -1251,7 +1251,7 @@ class ModuleCache(object):
...
@@ -1251,7 +1251,7 @@ class ModuleCache(object):
compilelock
.
get_lock
()
compilelock
.
get_lock
()
try
:
try
:
for
base_dir
in
(
'cuda_ndarray'
,
'cutils_ext'
,
'lazylinker_ext'
,
for
base_dir
in
(
'cuda_ndarray'
,
'cutils_ext'
,
'lazylinker_ext'
,
'scan_perform'
):
'scan_perform'
):
to_delete
=
os
.
path
.
join
(
self
.
dirname
,
base_dir
+
'.delete.me'
)
to_delete
=
os
.
path
.
join
(
self
.
dirname
,
base_dir
+
'.delete.me'
)
if
os
.
path
.
isdir
(
to_delete
):
if
os
.
path
.
isdir
(
to_delete
):
try
:
try
:
...
@@ -1266,7 +1266,7 @@ class ModuleCache(object):
...
@@ -1266,7 +1266,7 @@ class ModuleCache(object):
shutil
.
move
(
to_rename
,
to_delete
)
shutil
.
move
(
to_rename
,
to_delete
)
except
Exception
:
except
Exception
:
_logger
.
warning
(
'Could not move
%
s to
%
s'
,
_logger
.
warning
(
'Could not move
%
s to
%
s'
,
to_rename
,
to_delete
)
to_rename
,
to_delete
)
finally
:
finally
:
compilelock
.
release_lock
()
compilelock
.
release_lock
()
...
@@ -1370,7 +1370,7 @@ class ModuleCache(object):
...
@@ -1370,7 +1370,7 @@ class ModuleCache(object):
finally
:
finally
:
compilelock
.
release_lock
()
compilelock
.
release_lock
()
_logger
.
debug
(
'Time spent checking keys:
%
s'
,
_logger
.
debug
(
'Time spent checking keys:
%
s'
,
self
.
time_spent_in_check_key
)
self
.
time_spent_in_check_key
)
def
_rmtree
(
parent
,
ignore_nocleanup
=
False
,
msg
=
''
,
level
=
logging
.
DEBUG
,
def
_rmtree
(
parent
,
ignore_nocleanup
=
False
,
msg
=
''
,
level
=
logging
.
DEBUG
,
...
@@ -1391,14 +1391,14 @@ def _rmtree(parent, ignore_nocleanup=False, msg='', level=logging.DEBUG,
...
@@ -1391,14 +1391,14 @@ def _rmtree(parent, ignore_nocleanup=False, msg='', level=logging.DEBUG,
except
Exception
,
e
:
except
Exception
,
e
:
# If parent still exists, mark it for deletion by a future refresh()
# If parent still exists, mark it for deletion by a future refresh()
_logger
.
debug
(
'In _rmtree, encountered exception:
%
s(
%
s)'
,
_logger
.
debug
(
'In _rmtree, encountered exception:
%
s(
%
s)'
,
type
(
e
),
e
)
type
(
e
),
e
)
if
os
.
path
.
exists
(
parent
):
if
os
.
path
.
exists
(
parent
):
try
:
try
:
_logger
.
info
(
'placing "delete.me" in
%
s'
,
parent
)
_logger
.
info
(
'placing "delete.me" in
%
s'
,
parent
)
open
(
os
.
path
.
join
(
parent
,
'delete.me'
),
'w'
)
.
close
()
open
(
os
.
path
.
join
(
parent
,
'delete.me'
),
'w'
)
.
close
()
except
Exception
,
ee
:
except
Exception
,
ee
:
_logger
.
warning
(
"Failed to remove or mark cache directory
%
s "
_logger
.
warning
(
"Failed to remove or mark cache directory
%
s "
"for removal
%
s"
,
parent
,
ee
)
"for removal
%
s"
,
parent
,
ee
)
_module_cache
=
None
_module_cache
=
None
...
@@ -1416,7 +1416,7 @@ def get_module_cache(dirname, init_args=None):
...
@@ -1416,7 +1416,7 @@ def get_module_cache(dirname, init_args=None):
atexit
.
register
(
_module_cache
.
_on_atexit
)
atexit
.
register
(
_module_cache
.
_on_atexit
)
elif
init_args
:
elif
init_args
:
_logger
.
warning
(
'Ignoring init arguments for module cache because it '
_logger
.
warning
(
'Ignoring init arguments for module cache because it '
'was created prior to this call'
)
'was created prior to this call'
)
if
_module_cache
.
dirname
!=
dirname
:
if
_module_cache
.
dirname
!=
dirname
:
_logger
.
warning
(
"Returning module cache instance with different "
_logger
.
warning
(
"Returning module cache instance with different "
"dirname (
%
s) than you requested (
%
s)"
,
"dirname (
%
s) than you requested (
%
s)"
,
...
@@ -1815,8 +1815,8 @@ class GCC_compiler(object):
...
@@ -1815,8 +1815,8 @@ class GCC_compiler(object):
# sometimes, the linker cannot find -lpython so we need to tell it
# sometimes, the linker cannot find -lpython so we need to tell it
# explicitly where it is located
# explicitly where it is located
# this returns somepath/lib/python2.x
# this returns somepath/lib/python2.x
python_lib
=
distutils
.
sysconfig
.
get_python_lib
(
plat_specific
=
1
,
\
python_lib
=
distutils
.
sysconfig
.
get_python_lib
(
plat_specific
=
1
,
standard_lib
=
1
)
standard_lib
=
1
)
python_lib
=
os
.
path
.
dirname
(
python_lib
)
python_lib
=
os
.
path
.
dirname
(
python_lib
)
if
python_lib
not
in
lib_dirs
:
if
python_lib
not
in
lib_dirs
:
lib_dirs
.
append
(
python_lib
)
lib_dirs
.
append
(
python_lib
)
...
@@ -1833,7 +1833,7 @@ class GCC_compiler(object):
...
@@ -1833,7 +1833,7 @@ class GCC_compiler(object):
cppfile
.
close
()
cppfile
.
close
()
lib_filename
=
os
.
path
.
join
(
location
,
'
%
s.
%
s'
%
lib_filename
=
os
.
path
.
join
(
location
,
'
%
s.
%
s'
%
(
module_name
,
get_lib_extension
()))
(
module_name
,
get_lib_extension
()))
_logger
.
debug
(
'Generating shared lib
%
s'
,
lib_filename
)
_logger
.
debug
(
'Generating shared lib
%
s'
,
lib_filename
)
cmd
=
[
'g++'
,
get_gcc_shared_library_arg
(),
'-g'
]
cmd
=
[
'g++'
,
get_gcc_shared_library_arg
(),
'-g'
]
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论