Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
8d57251e
提交
8d57251e
authored
8月 14, 2015
作者:
Iban Harlouchet
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
numpydoc for theano/compile/profilemode.py
上级
8129b741
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
46 行增加
和
24 行删除
+46
-24
profilemode.py
theano/compile/profilemode.py
+46
-24
没有找到文件。
theano/compile/profilemode.py
浏览文件 @
8d57251e
...
@@ -122,7 +122,10 @@ class ProfileMode(Mode):
...
@@ -122,7 +122,10 @@ class ProfileMode(Mode):
profile_stats
))
profile_stats
))
def
function_maker
(
self
,
i
,
o
,
m
,
*
args
,
**
kwargs
):
def
function_maker
(
self
,
i
,
o
,
m
,
*
args
,
**
kwargs
):
"""Return an instance of `Profiler_Maker` which init the count"""
"""
Return an instance of `Profiler_Maker` which init the count.
"""
assert
m
is
self
assert
m
is
self
return
Profile_Maker
(
i
,
o
,
self
,
*
args
,
**
kwargs
)
return
Profile_Maker
(
i
,
o
,
self
,
*
args
,
**
kwargs
)
...
@@ -147,7 +150,9 @@ class ProfileMode(Mode):
...
@@ -147,7 +150,9 @@ class ProfileMode(Mode):
self
.
profile_stats
=
profile_stats
self
.
profile_stats
=
profile_stats
def
profile_thunk
(
i
,
node
,
th
):
def
profile_thunk
(
i
,
node
,
th
):
""" Profile only the execution time
"""
Profile only the execution time.
"""
"""
global
run_cthunk
global
run_cthunk
if
hasattr
(
th
,
'cthunk'
):
if
hasattr
(
th
,
'cthunk'
):
...
@@ -169,7 +174,9 @@ class ProfileMode(Mode):
...
@@ -169,7 +174,9 @@ class ProfileMode(Mode):
self
.
apply_time
[
node
]
+=
max
(
dt
,
1e-14
)
self
.
apply_time
[
node
]
+=
max
(
dt
,
1e-14
)
def
profile_thunk2
(
i
,
node
,
th
):
def
profile_thunk2
(
i
,
node
,
th
):
""" Profile the execution time and the memory size.
"""
Profile the execution time and the memory size.
"""
"""
global
run_cthunk
global
run_cthunk
if
hasattr
(
th
,
'cthunk'
):
if
hasattr
(
th
,
'cthunk'
):
...
@@ -211,7 +218,8 @@ class ProfileMode(Mode):
...
@@ -211,7 +218,8 @@ class ProfileMode(Mode):
self
.
fn_time
=
0
self
.
fn_time
=
0
def
print_summary
(
self
,
**
kwargs
):
def
print_summary
(
self
,
**
kwargs
):
""" Print 3 summaries that show where time is spent. The first shows
"""
Print 3 summaries that show where time is spent. The first shows
an Apply-wise summary, the second an Op-wise summary and the
an Apply-wise summary, the second an Op-wise summary and the
third a type-Op-wise summary.
third a type-Op-wise summary.
...
@@ -235,10 +243,13 @@ class ProfileMode(Mode):
...
@@ -235,10 +243,13 @@ class ProfileMode(Mode):
There is an hack with the Op-wise summary. Go see it if you
There is an hack with the Op-wise summary. Go see it if you
want to know more.
want to know more.
:param kwargs: They are passed to print_summary_ expanded.
Parameters
Currently there is n_apply_to_print,
----------
n_ops_to_print and min_memory_size that are
kwargs
accepted.
They are passed to print_summary_ expanded. Currently there is
n_apply_to_print, n_ops_to_print and min_memory_size that are
accepted.
"""
"""
compile_time
=
sum
([
ps
.
compile_time
for
ps
compile_time
=
sum
([
ps
.
compile_time
for
ps
in
self
.
profile_stats
.
values
()])
in
self
.
profile_stats
.
values
()])
...
@@ -280,18 +291,23 @@ class ProfileMode(Mode):
...
@@ -280,18 +291,23 @@ class ProfileMode(Mode):
**
kwargs
)
**
kwargs
)
def
print_diff_summary
(
self
,
other
,
**
kwargs
):
def
print_diff_summary
(
self
,
other
,
**
kwargs
):
""" As print_summary, but print the difference on two different
"""
As print_summary, but print the difference on two different
profile mode.
profile mode.
TODO: Also we don't print the Apply-wise summary as it don't
TODO: Also we don't print the Apply-wise summary as it don't
work for now.
work for now.
TODO: make comparaison with gpu code.
TODO: make comparaison with gpu code.
:param other: the other instance of ProfileMode that we want
Parameters
to be compared to.
----------
:param kwargs: They are passed to print_summary_ expanded.
other
The other instance of ProfileMode that we want to be compared to.
kwargs
They are passed to print_summary_ expanded.
Currently there is n_apply_to_print, n_ops_to_print and
Currently there is n_apply_to_print, n_ops_to_print and
min_memory_size that are accepted.
min_memory_size that are accepted.
"""
"""
def
diff_dict
(
a_time
,
b_time_
):
def
diff_dict
(
a_time
,
b_time_
):
...
@@ -343,13 +359,18 @@ class ProfileMode(Mode):
...
@@ -343,13 +359,18 @@ class ProfileMode(Mode):
min_memory_size
=
config
.
ProfileMode
.
min_memory_size
,
min_memory_size
=
config
.
ProfileMode
.
min_memory_size
,
):
):
"""
"""
do the actual printing of print_summary and print_diff_summary.
Do the actual printing of print_summary and print_diff_summary.
:param n_apply_to_print: the number of apply to print. Default 15.
Parameters
----------
n_apply_to_print
The number of apply to print. Default 15.
n_ops_to_print
The number of ops to print. Default 20.
min_memory_size
Don't print memory profile of apply whose outputs memory size is
lower than that.
:param n_ops_to_print: the number of ops to print. Default 20.
:param min_memory_size: Don't print memory profile of apply
whose outputs memory size is lower then that.
"""
"""
print
(
"ProfileMode is deprecated! Use the new profiler."
)
print
(
"ProfileMode is deprecated! Use the new profiler."
)
...
@@ -700,9 +721,9 @@ Test them first, as they are not guaranteed to always provide a speedup.""")
...
@@ -700,9 +721,9 @@ Test them first, as they are not guaranteed to always provide a speedup.""")
"""
"""
Create a new instance of this Mode.
Create a new instance of this Mode.
Keyword arguments can be provided for the linker,
Keyword arguments can be provided for the linker,
in which case its
in which case its `clone` method will be called with these
`clone` method will be called with these arguments.
arguments.
"""
"""
new_linker
=
self
.
linker
.
clone
(
**
link_kwargs
)
new_linker
=
self
.
linker
.
clone
(
**
link_kwargs
)
new_optimizer
=
self
.
provided_optimizer
new_optimizer
=
self
.
provided_optimizer
...
@@ -727,10 +748,11 @@ prof_mode_instance_to_print = [predefined_modes["PROFILE_MODE"]]
...
@@ -727,10 +748,11 @@ prof_mode_instance_to_print = [predefined_modes["PROFILE_MODE"]]
def
atexit_print_default_profile_mode
():
def
atexit_print_default_profile_mode
():
"""Print the summary of the predefined mode ProfileMode if used.
"""
Print the summary of the predefined mode ProfileMode if used.
This all to have the summary printed at exit when config.mode=ProfileMode.
This all to have the summary printed at exit when
config.mode=ProfileMode
"""
"""
for
prof_mode
in
prof_mode_instance_to_print
:
for
prof_mode
in
prof_mode_instance_to_print
:
if
prof_mode
.
local_time
>
0
:
if
prof_mode
.
local_time
>
0
:
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论