Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
05a30361
提交
05a30361
authored
10月 16, 2014
作者:
carriepl
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2168 from aalmah/ticket_2125
fixing #2125: redirecting profiling output to a file
上级
451f7b8f
d235e44c
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
29 行增加
和
4 行删除
+29
-4
config.txt
doc/library/config.txt
+11
-0
profiling.py
theano/compile/profiling.py
+18
-4
没有找到文件。
doc/library/config.txt
浏览文件 @
05a30361
...
@@ -338,6 +338,17 @@ import theano and print the config variable, as in:
...
@@ -338,6 +338,17 @@ import theano and print the config variable, as in:
Do the memory profile print the min peak memory usage?
Do the memory profile print the min peak memory usage?
It only works when profile=True, profile_memory=True
It only works when profile=True, profile_memory=True
.. attribute:: profiling.destination
String value: 'stderr', 'stdout', or a name of a
file to be created
Default 'stderr'
Name of the destination file for the profiling output.
The profiling output can be either directed to stderr
(default), or stdout or an arbitrary file.
.. attribute:: config.lib.amdlibm
.. attribute:: config.lib.amdlibm
Bool value: either True or False
Bool value: either True or False
...
...
theano/compile/profiling.py
浏览文件 @
05a30361
...
@@ -25,14 +25,13 @@ import numpy
...
@@ -25,14 +25,13 @@ import numpy
import
theano
import
theano
from
theano.gof
import
graph
from
theano.gof
import
graph
from
theano.configparser
import
AddConfigVar
,
BoolParam
,
IntParam
from
theano.configparser
import
AddConfigVar
,
BoolParam
,
IntParam
,
StrParam
import_time
=
time
.
time
()
import_time
=
time
.
time
()
config
=
theano
.
config
config
=
theano
.
config
_atexit_print_list
=
[]
_atexit_print_list
=
[]
_atexit_print_file
=
sys
.
stderr
_atexit_registered
=
False
_atexit_registered
=
False
AddConfigVar
(
'profiling.time_thunks'
,
AddConfigVar
(
'profiling.time_thunks'
,
...
@@ -66,14 +65,29 @@ AddConfigVar('profiling.min_peak_memory',
...
@@ -66,14 +65,29 @@ AddConfigVar('profiling.min_peak_memory',
BoolParam
(
False
),
BoolParam
(
False
),
in_c_key
=
False
)
in_c_key
=
False
)
AddConfigVar
(
'profiling.destination'
,
"""
File destination of the profiling output
"""
,
StrParam
(
'stderr'
),
in_c_key
=
False
)
def
_atexit_print_fn
():
def
_atexit_print_fn
():
"""Print ProfileStat objects in _atexit_print_list to _atexit_print_file
"""Print ProfileStat objects in _atexit_print_list to _atexit_print_file
"""
"""
to_sum
=
[]
to_sum
=
[]
if
config
.
profiling
.
destination
==
'stderr'
:
destination_file
=
sys
.
stderr
elif
config
.
profiling
.
destination
==
'stdout'
:
destination_file
=
sys
.
stdout
else
:
destination_file
=
open
(
config
.
profiling
.
destination
,
'w'
)
for
ps
in
_atexit_print_list
:
for
ps
in
_atexit_print_list
:
if
ps
.
fct_callcount
or
ps
.
compile_time
>
0
:
if
ps
.
fct_callcount
or
ps
.
compile_time
>
0
:
ps
.
summary
(
file
=
_atexit_print
_file
,
ps
.
summary
(
file
=
destination
_file
,
n_ops_to_print
=
config
.
profiling
.
n_ops
,
n_ops_to_print
=
config
.
profiling
.
n_ops
,
n_apply_to_print
=
config
.
profiling
.
n_apply
)
n_apply_to_print
=
config
.
profiling
.
n_apply
)
if
not
isinstance
(
ps
,
ScanProfileStats
):
if
not
isinstance
(
ps
,
ScanProfileStats
):
...
@@ -109,7 +123,7 @@ def _atexit_print_fn():
...
@@ -109,7 +123,7 @@ def _atexit_print_fn():
else
:
else
:
cum
.
optimizer_profile
=
None
cum
.
optimizer_profile
=
None
cum
.
summary
(
file
=
_atexit_print
_file
,
cum
.
summary
(
file
=
destination
_file
,
n_ops_to_print
=
config
.
profiling
.
n_ops
,
n_ops_to_print
=
config
.
profiling
.
n_ops
,
n_apply_to_print
=
config
.
profiling
.
n_apply
)
n_apply_to_print
=
config
.
profiling
.
n_apply
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论