Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
4ba730a0
提交
4ba730a0
authored
1月 07, 2015
作者:
Arnaud Bergeron
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Some changes from review.
上级
4f59ff7b
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
11 行增加
和
16 行删除
+11
-16
cc.py
theano/gof/cc.py
+5
-11
cmodule.py
theano/gof/cmodule.py
+6
-5
没有找到文件。
theano/gof/cc.py
浏览文件 @
4ba730a0
...
@@ -1282,15 +1282,6 @@ class CLinker(link.Linker):
...
@@ -1282,15 +1282,6 @@ class CLinker(link.Linker):
return
((),
sig
)
return
((),
sig
)
return
version
,
sig
return
version
,
sig
def
get_src_code
(
self
):
"""
Returns the source code for the module represented by this linker.
"""
if
not
hasattr
(
self
,
'_source'
):
mod
=
self
.
build_dynamic_module
()
self
.
_source
=
mod
.
code
()
return
self
.
_source
def
compile_cmodule
(
self
,
location
=
None
):
def
compile_cmodule
(
self
,
location
=
None
):
"""
"""
This compiles the source code for this linker and returns a
This compiles the source code for this linker and returns a
...
@@ -1298,7 +1289,7 @@ class CLinker(link.Linker):
...
@@ -1298,7 +1289,7 @@ class CLinker(link.Linker):
"""
"""
if
location
is
None
:
if
location
is
None
:
location
=
cmodule
.
dlimport_workdir
(
config
.
compiledir
)
location
=
cmodule
.
dlimport_workdir
(
config
.
compiledir
)
mod
=
self
.
build
_dynamic_module
()
mod
=
self
.
get
_dynamic_module
()
c_compiler
=
self
.
c_compiler
()
c_compiler
=
self
.
c_compiler
()
libs
=
self
.
libraries
()
libs
=
self
.
libraries
()
preargs
=
self
.
compile_args
()
preargs
=
self
.
compile_args
()
...
@@ -1335,9 +1326,12 @@ class CLinker(link.Linker):
...
@@ -1335,9 +1326,12 @@ class CLinker(link.Linker):
release_lock
()
release_lock
()
return
module
return
module
def
build
_dynamic_module
(
self
):
def
get
_dynamic_module
(
self
):
"""Return a cmodule.DynamicModule instance full of the code
"""Return a cmodule.DynamicModule instance full of the code
for our fgraph.
for our fgraph.
This method is cached on the first call so it can be called
multiple times without penalty.
"""
"""
if
not
hasattr
(
self
,
'_mod'
):
if
not
hasattr
(
self
,
'_mod'
):
self
.
code_gen
()
self
.
code_gen
()
...
...
theano/gof/cmodule.py
浏览文件 @
4ba730a0
...
@@ -618,6 +618,9 @@ class ModuleCache(object):
...
@@ -618,6 +618,9 @@ class ModuleCache(object):
"""
"""
def
_get_module
(
self
,
name
):
def
_get_module
(
self
,
name
):
"""
Fetch a compiled module from the loaded cache or the disk.
"""
if
name
not
in
self
.
module_from_name
:
if
name
not
in
self
.
module_from_name
:
_logger
.
debug
(
'loading name
%
s'
,
name
)
_logger
.
debug
(
'loading name
%
s'
,
name
)
self
.
module_from_name
[
name
]
=
dlimport
(
name
)
self
.
module_from_name
[
name
]
=
dlimport
(
name
)
...
@@ -688,7 +691,7 @@ class ModuleCache(object):
...
@@ -688,7 +691,7 @@ class ModuleCache(object):
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
if
(
time_now
-
last_access_time
(
entry
))
<
age_thresh_use
:
if
(
time_now
-
last_access_time
(
entry
))
<
age_thresh_use
:
_logger
.
debug
(
'refresh adding
%
s'
,
key_pkl
)
_logger
.
debug
(
'refresh adding
%
s'
,
key_pkl
)
...
@@ -725,7 +728,7 @@ class ModuleCache(object):
...
@@ -725,7 +728,7 @@ class ModuleCache(object):
# not yet been imported (e.g. when running two
# not yet been imported (e.g. when running two
# different Theano-based scripts). They are not
# different Theano-based scripts). They are not
# necessarily broken, but we cannot load them
# necessarily broken, but we cannot load them
#
here
.
#
now. They will be loaded later if needed
.
pass
pass
continue
continue
...
@@ -762,7 +765,7 @@ class ModuleCache(object):
...
@@ -762,7 +765,7 @@ class ModuleCache(object):
rmtree
(
root
,
ignore_nocleanup
=
True
,
rmtree
(
root
,
ignore_nocleanup
=
True
,
msg
=
'module file path mismatch'
,
msg
=
'module file path mismatch'
,
level
=
logging
.
INFO
)
level
=
logging
.
INFO
)
continue
continue
# Find unversioned keys from other processes.
# Find unversioned keys from other processes.
# TODO: check if this can happen at all
# TODO: check if this can happen at all
...
@@ -923,8 +926,6 @@ class ModuleCache(object):
...
@@ -923,8 +926,6 @@ class ModuleCache(object):
def
_get_from_hash
(
self
,
module_hash
,
key
,
keep_lock
=
False
):
def
_get_from_hash
(
self
,
module_hash
,
key
,
keep_lock
=
False
):
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 "
"previous one"
)
key_data
=
self
.
module_hash_to_key_data
[
module_hash
]
key_data
=
self
.
module_hash_to_key_data
[
module_hash
]
module
=
self
.
_get_from_key
(
None
,
key_data
)
module
=
self
.
_get_from_key
(
None
,
key_data
)
with
compilelock
.
lock_ctx
(
keep_lock
=
keep_lock
):
with
compilelock
.
lock_ctx
(
keep_lock
=
keep_lock
):
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论