Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
c80d4a60
提交
c80d4a60
authored
4月 07, 2010
作者:
Frederic Bastien
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
lowered profiler overhead
上级
2491a3f4
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
9 行增加
和
17 行删除
+9
-17
profilemode.py
theano/compile/profilemode.py
+9
-17
没有找到文件。
theano/compile/profilemode.py
浏览文件 @
c80d4a60
...
@@ -31,16 +31,13 @@ class Profile_Maker(FunctionMaker):
...
@@ -31,16 +31,13 @@ class Profile_Maker(FunctionMaker):
class
ProfileMode
(
Mode
):
class
ProfileMode
(
Mode
):
def
__init__
(
self
,
linker
=
config
.
linker
,
optimizer
=
config
.
optimizer
):
def
__init__
(
self
,
linker
=
config
.
linker
,
optimizer
=
config
.
optimizer
):
local_time
=
[
0.0
]
apply_time
=
{}
apply_time
=
{}
op_cimpl
=
{}
op_cimpl
=
{}
compile_time
=
0
#time passed in theano.function()
compile_time
=
0
#time passed in theano.function()
fct_call_time
=
{}
#time passed inside theano fct call including op time.
fct_call_time
=
{}
#time passed inside theano fct call including op time.
fct_call
=
{}
fct_call
=
{}
self
.
__setstate__
((
linker
,
optimizer
,
local_time
,
self
.
__setstate__
((
linker
,
optimizer
,
apply_time
,
op_cimpl
,
apply_time
,
op_cimpl
,
compile_time
,
fct_call_time
,
fct_call
))
compile_time
,
fct_call_time
,
fct_call
))
def
function_maker
(
self
,
i
,
o
,
m
,
*
args
,
**
kwargs
):
def
function_maker
(
self
,
i
,
o
,
m
,
*
args
,
**
kwargs
):
...
@@ -51,16 +48,12 @@ class ProfileMode(Mode):
...
@@ -51,16 +48,12 @@ class ProfileMode(Mode):
def
__getstate__
(
self
):
def
__getstate__
(
self
):
#print "__getstate__",self.provided_linker,self.provided_optimizer
#print "__getstate__",self.provided_linker,self.provided_optimizer
return
(
self
.
provided_linker
,
self
.
provided_optimizer
,
self
.
local_time
,
return
(
self
.
provided_linker
,
self
.
provided_optimizer
,
self
.
apply_time
,
self
.
apply_time
,
self
.
op_cimpl
,
self
.
compile_time
,
self
.
fct_call_time
,
self
.
fct_call
)
self
.
op_cimpl
,
self
.
compile_time
,
self
.
fct_call_time
,
self
.
fct_call
)
def
__setstate__
(
self
,
(
linker
,
optimizer
,
local_time
,
def
__setstate__
(
self
,
(
linker
,
optimizer
,
apply_time
,
op_cimpl
,
apply_time
,
op_cimpl
,
compile_time
,
fct_call_time
,
fct_call
)):
compile_time
,
fct_call_time
,
fct_call
)):
self
.
local_time
=
local_time
self
.
apply_time
=
apply_time
self
.
apply_time
=
apply_time
self
.
op_cimpl
=
op_cimpl
self
.
op_cimpl
=
op_cimpl
self
.
compile_time
=
compile_time
self
.
compile_time
=
compile_time
...
@@ -83,7 +76,6 @@ class ProfileMode(Mode):
...
@@ -83,7 +76,6 @@ class ProfileMode(Mode):
th
()
th
()
dt
=
time
.
time
()
-
t0
dt
=
time
.
time
()
-
t0
local_time
[
0
]
+=
dt
apply_time
[(
i
,
node
)]
+=
dt
apply_time
[(
i
,
node
)]
+=
dt
...
@@ -115,14 +107,13 @@ class ProfileMode(Mode):
...
@@ -115,14 +107,13 @@ class ProfileMode(Mode):
:param n_ops_to_print: the number of ops to print. Default 20, or n_apply_to_print flag.
:param n_ops_to_print: the number of ops to print. Default 20, or n_apply_to_print flag.
"""
"""
local_time
=
self
.
local_time
[
0
]
compile_time
=
self
.
compile_time
compile_time
=
self
.
compile_time
fct_call_time
=
self
.
fct_call_time
fct_call_time
=
self
.
fct_call_time
fct_call
=
self
.
fct_call
fct_call
=
self
.
fct_call
apply_time
=
self
.
apply_time
apply_time
=
self
.
apply_time
op_cimpl
=
self
.
op_cimpl
op_cimpl
=
self
.
op_cimpl
self
.
print_summary_
(
"print_summary"
,
local_time
,
compile_time
,
fct_call_time
,
fct_call
,
self
.
print_summary_
(
"print_summary"
,
compile_time
,
fct_call_time
,
fct_call
,
apply_time
,
op_cimpl
,
apply_time
,
op_cimpl
,
n_apply_to_print
,
n_ops_to_print
)
n_apply_to_print
,
n_ops_to_print
)
...
@@ -153,20 +144,19 @@ class ProfileMode(Mode):
...
@@ -153,20 +144,19 @@ class ProfileMode(Mode):
r
[
a
]
+=
t
r
[
a
]
+=
t
return
r
return
r
local_time
=
self
.
local_time
[
0
]
-
other
.
local_time
[
0
]
compile_time
=
self
.
compile_time
-
other
.
compile_time
compile_time
=
self
.
compile_time
-
other
.
compile_time
fct_call_time
=
diff_dict
(
self
.
fct_call_time
,
other
.
fct_call_time
)
fct_call_time
=
diff_dict
(
self
.
fct_call_time
,
other
.
fct_call_time
)
fct_call
=
diff_dict
(
self
.
fct_call
,
other
.
fct_call
)
fct_call
=
diff_dict
(
self
.
fct_call
,
other
.
fct_call
)
apply_time
=
diff_dict
(
self
.
apply_time
,
other
.
apply_time
)
apply_time
=
diff_dict
(
self
.
apply_time
,
other
.
apply_time
)
op_cimpl
=
self
.
op_cimpl
and
other
.
op_cimpl
op_cimpl
=
self
.
op_cimpl
and
other
.
op_cimpl
self
.
print_summary_
(
"print_diff_summary"
,
local_time
,
compile_time
,
fct_call_time
,
fct_call
,
self
.
print_summary_
(
"print_diff_summary"
,
compile_time
,
fct_call_time
,
fct_call
,
apply_time
,
op_cimpl
,
apply_time
,
op_cimpl
,
n_apply_to_print
=
n_apply_to_print
,
n_apply_to_print
=
n_apply_to_print
,
n_ops_to_print
=
n_ops_to_print
,
print_apply
=
False
)
n_ops_to_print
=
n_ops_to_print
,
print_apply
=
False
)
@staticmethod
@staticmethod
def
print_summary_
(
fct_name
,
local_time
,
compile_time
,
fct_call_time
,
fct_call
,
def
print_summary_
(
fct_name
,
compile_time
,
fct_call_time
,
fct_call
,
apply_time
,
op_cimpl
,
apply_time
,
op_cimpl
,
n_apply_to_print
=
15
,
n_ops_to_print
=
20
,
print_apply
=
True
):
n_apply_to_print
=
15
,
n_ops_to_print
=
20
,
print_apply
=
True
):
"""
"""
...
@@ -177,6 +167,8 @@ class ProfileMode(Mode):
...
@@ -177,6 +167,8 @@ class ProfileMode(Mode):
param: n_ops_to_print the number of ops to print. Default 20.
param: n_ops_to_print the number of ops to print. Default 20.
"""
"""
local_time
=
sum
(
apply_time
.
values
())
print
''
print
''
print
'ProfileMode.
%
s()'
%
(
fct_name
)
print
'ProfileMode.
%
s()'
%
(
fct_name
)
print
'---------------------------'
print
'---------------------------'
...
@@ -354,7 +346,7 @@ def atexit_print_default_profile_mode():
...
@@ -354,7 +346,7 @@ def atexit_print_default_profile_mode():
config.mode=PROFILE_MODE
config.mode=PROFILE_MODE
"""
"""
for
prof_mode
in
prof_mode_instance_to_print
:
for
prof_mode
in
prof_mode_instance_to_print
:
if
prof_mode
.
local_time
[
0
]
>
0
:
if
sum
(
prof_mode
.
apply_time
.
values
())
>
0
:
prof_mode
.
print_summary
()
prof_mode
.
print_summary
()
#Register atexit_print_default_profile_mode to have the summary of the
#Register atexit_print_default_profile_mode to have the summary of the
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论