Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
c621473e
提交
c621473e
authored
6月 18, 2010
作者:
Razvan Pascanu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Some changes to the script to produce the plot we use in scipy ( basically fix…
Some changes to the script to produce the plot we use in scipy ( basically fix the subplot problem, and play a bit with the axis) '
上级
b5b5252e
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
34 行增加
和
18 行删除
+34
-18
gen_graph.py
benchmark/numexpr/gen_graph.py
+34
-18
没有找到文件。
benchmark/numexpr/gen_graph.py
浏览文件 @
c621473e
...
@@ -62,7 +62,8 @@ def timeit_2vector(nb_element=1e6, nb_repeat=3, nb_call=int(1e2), expr="a**2 + b
...
@@ -62,7 +62,8 @@ def timeit_2vector(nb_element=1e6, nb_repeat=3, nb_call=int(1e2), expr="a**2 + b
def
exec_timeit_2vector
(
expr
,
nb_call_scal
=
1
,
fname
=
None
,
do_unalign
=
False
,
do_amd
=
True
):
def
exec_timeit_2vector
(
expr
,
nb_call_scal
=
1
,
fname
=
None
,
do_unalign
=
False
,
do_amd
=
True
):
time
=
[]
time
=
[]
exp
=
[(
1
,
100000
),(
1e1
,
100000
),(
1e2
,
100000
),(
1e3
,
100000
),
(
5e3
,
50000
),
#exp = [(1,100000),(1e1,100000),(1e2,100000),(1e3,100000), (5e3,50000),
exp
=
[(
1e3
,
100000
),(
5e3
,
50000
),
\
(
1e4
,
10000
),(
5e4
,
5000
),(
1e5
,
2000
),(
1e6
,
200
),(
1e7
,
10
)
(
1e4
,
10000
),(
5e4
,
5000
),(
1e5
,
2000
),(
1e6
,
200
),(
1e7
,
10
)
]
]
...
@@ -97,9 +98,8 @@ def exec_timeit_2vector(expr, nb_call_scal=1, fname=None, do_unalign=False, do_a
...
@@ -97,9 +98,8 @@ def exec_timeit_2vector(expr, nb_call_scal=1, fname=None, do_unalign=False, do_a
pylab
.
axhline
(
y
=
1
,
linewidth
=
1.0
,
color
=
'black'
)
pylab
.
axhline
(
y
=
1
,
linewidth
=
1.0
,
color
=
'black'
)
pylab
.
xlabel
(
'
Nb element
'
)
pylab
.
xlabel
(
'
Dimension of real valued vectors a and b
'
)
pylab
.
ylabel
(
'Speed up vs NumPy'
)
pylab
.
ylabel
(
'Speed up vs NumPy'
)
pylab
.
title
(
'Speed up Numexpr and Theano vs NumPy for "
%(expr)
s"'
%
locals
())
if
do_unalign
and
do_amd
:
if
do_unalign
and
do_amd
:
pylab
.
legend
((
"Numexpr"
,
"Theano"
,
"Theano(amdlibm)"
,
"Numexpr(unalign)"
,
pylab
.
legend
((
"Numexpr"
,
"Theano"
,
"Theano(amdlibm)"
,
"Numexpr(unalign)"
,
"Theano(unalign)"
,
"Theano(amdlibm,unalign)"
),
loc
=
'upper left'
)
"Theano(unalign)"
,
"Theano(amdlibm,unalign)"
),
loc
=
'upper left'
)
...
@@ -124,11 +124,12 @@ def execs_timeit_2vector(exprs, fname=None):
...
@@ -124,11 +124,12 @@ def execs_timeit_2vector(exprs, fname=None):
The first level of list is put into different graph section in the same graph.
The first level of list is put into different graph section in the same graph.
The second level is the expression to put in each section
The second level is the expression to put in each section
"""
"""
exp
=
[(
1
,
10000
),(
1e1
,
10000
),(
1e2
,
100000
),(
1e3
,
100000
),
(
5e3
,
50000
),
#exp = [(1,100000),(1e1,100000),(1e2,100000),(1e3,100000), (5e3,50000),
exp
=
[(
1e3
,
100000
),(
5e3
,
50000
),
\
(
1e4
,
10000
),(
5e4
,
5000
),(
1e5
,
2000
),(
1e6
,
200
),(
1e7
,
10
)
(
1e4
,
10000
),(
5e4
,
5000
),(
1e5
,
2000
),(
1e6
,
200
),(
1e7
,
10
)
]
]
#TO TEST UNCOMMENT THIS LINE
#TO TEST UNCOMMENT THIS LINE
#
exp = [(1,1000),(1e1,1000),(1e2,1000),]
#
exp = [(1,1000),(1e1,1000),(1e2,1000),]
times
=
[]
times
=
[]
str_expr
=
[]
str_expr
=
[]
for
g_exprs
in
exprs
:
for
g_exprs
in
exprs
:
...
@@ -148,23 +149,38 @@ def execs_timeit_2vector(exprs, fname=None):
...
@@ -148,23 +149,38 @@ def execs_timeit_2vector(exprs, fname=None):
colors
=
[
'b'
,
'r'
,
'g'
,
'c'
,
'm'
,
'y'
]
colors
=
[
'b'
,
'r'
,
'g'
,
'c'
,
'm'
,
'y'
]
assert
len
(
colors
)
>=
len
(
times
)
assert
len
(
colors
)
>=
len
(
times
)
fig
=
pylab
.
figure
()
fig
=
pylab
.
figure
()
for
idx
,
graph
in
enumerate
(
exprs
):
for
idx
,(
time
,
expr
)
in
enumerate
(
zip
(
times
,
str_expr
)):
legend
=
[]
pylab
.
subplot
(
220
+
idx
+
1
)
plot
=
fig
.
add_subplot
(
1
,
len
(
exprs
),
idx
)
pylab
.
subplots_adjust
(
wspace
=
0.25
,
hspace
=
0.25
)
for
time
,
expr
,
color
in
zip
(
times
,
str_expr
,
colors
):
#legend=[]
#plot = fig.add_subplot(1,len(exprs),idx)
speedup
=
[
t
[
0
]
.
min
()
/
t
[
1
]
.
min
()
for
t
in
time
]
speedup
=
[
t
[
0
]
.
min
()
/
t
[
1
]
.
min
()
for
t
in
time
]
plot
.
semilogx
(
nb_calls
,
speedup
,
linewidth
=
1.0
,
linestyle
=
'--'
,
color
=
color
)
pylab
.
semilogx
(
nb_calls
,
speedup
,
linewidth
=
1.0
,
linestyle
=
'--'
,
color
=
'r'
)
speedup
=
[
t
[
0
]
.
min
()
/
t
[
2
]
.
min
()
for
t
in
time
]
speedup
=
[
t
[
0
]
.
min
()
/
t
[
2
]
.
min
()
for
t
in
time
]
plot
.
semilogx
(
nb_calls
,
speedup
,
linewidth
=
1.0
,
color
=
color
)
pylab
.
semilogx
(
nb_calls
,
speedup
,
linewidth
=
1.0
,
color
=
'b'
)
legend
+=
[
"Numexpr "
+
expr
,
"Theano "
+
expr
]
pylab
.
title
(
'Speed up Numexpr and Theano vs NumPy'
)
pylab
.
grid
(
True
)
pylab
.
grid
(
True
)
pylab
.
xlabel
(
'Nb element'
)
if
(
idx
==
2
)
or
(
idx
==
3
):
pylab
.
xlabel
(
'Dimension of vectors a and b'
)
if
(
idx
==
0
)
or
(
idx
==
2
):
pylab
.
ylabel
(
'Speed up vs NumPy'
)
pylab
.
ylabel
(
'Speed up vs NumPy'
)
pylab
.
axhline
(
y
=
1
,
linewidth
=
1.0
,
color
=
'black'
)
pylab
.
axhline
(
y
=
1
,
linewidth
=
1.0
,
color
=
'black'
)
pylab
.
legend
(
legend
,
loc
=
'upper left'
)
pylab
.
xlim
(
1e3
,
1e7
)
pylab
.
xticks
([
1e3
,
1e5
,
1e7
],[
'1e3'
,
'1e5'
,
'1e7'
])
pylab
.
title
(
expr
)
#for time,expr,color in zip(times,str_expr,colors):
# speedup = [t[0].min()/t[1].min() for t in time]
# plot.semilogx(nb_calls, speedup, linewidth=1.0, linestyle='--', color=color)
# speedup = [t[0].min()/t[2].min() for t in time]
# plot.semilogx(nb_calls, speedup, linewidth=1.0, color=color)
#legend += ["Numexpr "+expr,"Theano "+expr]
#pylab.title('Speed up Numexpr and Theano vs NumPy')
#pylab.grid(True)
#pylab.xlabel('Nb element')
#pylab.ylabel('Speed up vs NumPy')
#pylab.legend(legend,loc='upper left')
# fig.legend(legend,loc='upper left')
# fig.legend(legend,loc='upper left')
if
fname
:
if
fname
:
...
@@ -180,7 +196,7 @@ execs_timeit_2vector([
...
@@ -180,7 +196,7 @@ execs_timeit_2vector([
[(
"2*a + b**10"
,
.
2
)]
[(
"2*a + b**10"
,
.
2
)]
#"2*a + b*b*b*b*b*b*b*b*b*b",
#"2*a + b*b*b*b*b*b*b*b*b*b",
#("2*a + exp(b)",.3),
#("2*a + exp(b)",.3),
],
fname
=
"multiple_graph.p
ng
"
],
fname
=
"multiple_graph.p
df
"
)
)
###
###
### This case is the one gived on numexpr web site(http://code.google.com/p/numexpr/) as of 16 June 2010
### This case is the one gived on numexpr web site(http://code.google.com/p/numexpr/) as of 16 June 2010
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论