Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
e2d07514
提交
e2d07514
authored
11月 27, 2023
作者:
Ricardo Vieira
提交者:
Ricardo Vieira
11月 27, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Include C cache preloading in profile output
Also don't do it if there's no C compilation
上级
7ecb9f8c
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
14 行增加
和
4 行删除
+14
-4
types.py
pytensor/compile/function/types.py
+10
-4
profiling.py
pytensor/compile/profiling.py
+4
-0
没有找到文件。
pytensor/compile/function/types.py
浏览文件 @
e2d07514
...
@@ -1474,7 +1474,7 @@ class FunctionMaker:
...
@@ -1474,7 +1474,7 @@ class FunctionMaker:
if
getattr
(
mode
,
"profile"
,
None
):
if
getattr
(
mode
,
"profile"
,
None
):
raise
TypeError
(
"profile passed via 'mode'. This isn't supported anymore"
)
raise
TypeError
(
"profile passed via 'mode'. This isn't supported anymore"
)
self
.
profile
=
profile
self
.
profile
=
profile
if
profile
:
if
profile
and
config
.
cxx
:
# This is very important:
# This is very important:
# 1) We preload the cache here to not have its timing
# 1) We preload the cache here to not have its timing
# included with the rewrites.
# included with the rewrites.
...
@@ -1482,7 +1482,12 @@ class FunctionMaker:
...
@@ -1482,7 +1482,12 @@ class FunctionMaker:
# too much execution time during testing as we compile
# too much execution time during testing as we compile
# much more functions then the number of compile c
# much more functions then the number of compile c
# module.
# module.
start_get_cache
=
time
.
perf_counter
()
pytensor
.
link
.
c
.
basic
.
get_module_cache
()
.
refresh
()
pytensor
.
link
.
c
.
basic
.
get_module_cache
()
.
refresh
()
get_cache_time
=
time
.
perf_counter
()
-
start_get_cache
self
.
profile
.
linker_time
+=
get_cache_time
self
.
profile
.
preload_cache_time
+=
get_cache_time
# Handle the case where inputs and/or outputs is a single
# Handle the case where inputs and/or outputs is a single
# Variable (not in a list)
# Variable (not in a list)
unpack_single
=
False
unpack_single
=
False
...
@@ -1722,7 +1727,8 @@ def orig_function(
...
@@ -1722,7 +1727,8 @@ def orig_function(
"""
"""
t1
=
time
.
perf_counter
()
if
profile
:
t1
=
time
.
perf_counter
()
mode
=
pytensor
.
compile
.
mode
.
get_mode
(
mode
)
mode
=
pytensor
.
compile
.
mode
.
get_mode
(
mode
)
inputs
=
list
(
map
(
convert_function_input
,
inputs
))
inputs
=
list
(
map
(
convert_function_input
,
inputs
))
...
@@ -1755,8 +1761,8 @@ def orig_function(
...
@@ -1755,8 +1761,8 @@ def orig_function(
with
config
.
change_flags
(
compute_test_value
=
"off"
):
with
config
.
change_flags
(
compute_test_value
=
"off"
):
fn
=
m
.
create
(
defaults
)
fn
=
m
.
create
(
defaults
)
finally
:
finally
:
t2
=
time
.
perf_counter
()
if
profile
and
fn
:
if
fn
and
profile
:
t2
=
time
.
perf_counter
()
profile
.
compile_time
+=
t2
-
t1
profile
.
compile_time
+=
t2
-
t1
# TODO: append
# TODO: append
profile
.
nb_nodes
=
len
(
fn
.
maker
.
fgraph
.
apply_nodes
)
profile
.
nb_nodes
=
len
(
fn
.
maker
.
fgraph
.
apply_nodes
)
...
...
pytensor/compile/profiling.py
浏览文件 @
e2d07514
...
@@ -269,6 +269,9 @@ class ProfileStats:
...
@@ -269,6 +269,9 @@ class ProfileStats:
linker_time
:
float
=
0.0
linker_time
:
float
=
0.0
# time spent linking graph (FunctionMaker.create)
# time spent linking graph (FunctionMaker.create)
preload_cache_time
:
float
=
0.0
# time spent preloading the cache, so it does not affect rewrites profiling
import_time
:
float
=
0.0
import_time
:
float
=
0.0
# time spent in importing compiled python module.
# time spent in importing compiled python module.
...
@@ -811,6 +814,7 @@ class ProfileStats:
...
@@ -811,6 +814,7 @@ class ProfileStats:
),
),
file
=
file
,
file
=
file
,
)
)
print
(
f
" C-cache preloading {self.preload_cache_time:e}s"
,
file
=
file
)
print
(
f
" Import time {self.import_time:e}s"
,
file
=
file
)
print
(
f
" Import time {self.import_time:e}s"
,
file
=
file
)
print
(
print
(
f
" Node make_thunk time {self.linker_node_make_thunks:e}s"
,
file
=
file
f
" Node make_thunk time {self.linker_node_make_thunks:e}s"
,
file
=
file
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论