Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
7717caa8
提交
7717caa8
authored
8月 08, 2014
作者:
Roy Xue
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add min peak memory as a theano config variables
use THEANOFLAGS=profiling.min_peak_memory=True to set it on
上级
6d5e4ff2
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
15 行增加
和
11 行删除
+15
-11
profiling.py
theano/compile/profiling.py
+15
-11
没有找到文件。
theano/compile/profiling.py
浏览文件 @
7717caa8
...
...
@@ -55,6 +55,11 @@ AddConfigVar('profiling.min_memory_size',
IntParam
(
1024
,
lambda
i
:
i
>=
0
),
in_c_key
=
False
)
AddConfigVar
(
'profiling.min_peak_memory'
,
"""The min peak memory usage of the order"""
,
BoolParam
(
False
),
in_c_key
=
False
)
def
_atexit_print_fn
():
"""Print ProfileStat objects in _atexit_print_list to _atexit_print_file
...
...
@@ -637,6 +642,9 @@ class ProfileStats(object):
new_max_node_memory_saved_by_view
=
0
new_max_node_memory_saved_by_inplace
=
0
# track min peak memory usage
max_min_peak
=
0
def
count_running_memory
(
order
,
thunk_old_storage
,
nodes_mem
):
"""
Calculate memory with specific node order
...
...
@@ -689,10 +697,6 @@ class ProfileStats(object):
return
[
node_memory_size
,
running_memory_size
,
running_max_memory_size
,
node_memory_saved_by_inplace
,
node_memory_saved_by_view
]
# count the minimum peak
minimum_peak
=
0
max_minimum_peak
=
0
def
count_minimum_peak
(
node_list
,
fgraph
,
nodes_mem
):
global
maybe_executed
,
mem_count
,
mem_bound
,
max_mem_count
order
=
[]
...
...
@@ -856,12 +860,10 @@ class ProfileStats(object):
new_max_node_memory_saved_by_inplace
=
max
(
new_max_node_memory_saved_by_inplace
,
new_running_memory
[
3
])
node_list
=
fgraph
.
apply_nodes
minimum_peak
=
count_minimum_peak
(
node_list
,
fgraph
,
nodes_mem
)
# for the best order, we dont use it now
max_minimum_peak
=
max
(
max_minimum_peak
,
minimum_peak
)
if
config
.
profiling
.
min_peak_memory
:
node_list
=
fgraph
.
apply_nodes
min_peak
=
count_minimum_peak
(
node_list
,
fgraph
,
nodes_mem
)
max_min_peak
=
max
(
max_min_peak
,
min_peak
)
del
fgraph
,
nodes_mem
,
post_thunk_old_storage
,
node
...
...
@@ -885,7 +887,9 @@ class ProfileStats(object):
print
>>
file
,
" Max if linker=cvm(default):
%
dKB (
%
dKB)"
%
(
int
(
round
(
new_max_running_max_memory_size
/
1024.
)),
int
(
round
(
max_running_max_memory_size
/
1024.
)))
print
>>
file
,
" Minimum peak from all valid apply node order is
%
dKB"
%
int
(
round
(
max_minimum_peak
/
1024.
))
if
max_min_peak
:
print
>>
file
,
" Minimum peak from all valid apply node order is
%
dKB"
%
int
(
round
(
max_min_peak
/
1024.
))
print
>>
file
,
" Memory saved if views are used:
%
dKB (
%
dKB)"
%
(
int
(
round
(
new_max_node_memory_saved_by_view
/
1024.
)),
int
(
round
(
max_node_memory_saved_by_view
/
1024.
)))
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论