Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
ae2dafef
提交
ae2dafef
authored
10月 12, 2010
作者:
Frederic Bastien
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
print more comparaison info and small refactoring.
上级
04b33346
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
70 行增加
和
27 行删除
+70
-27
check_blas.py
theano/misc/check_blas.py
+70
-27
没有找到文件。
theano/misc/check_blas.py
浏览文件 @
ae2dafef
...
@@ -4,42 +4,85 @@
...
@@ -4,42 +4,85 @@
#A,B,C matrix
#A,B,C matrix
#a,b scalar
#a,b scalar
s
=
"""
result for shapes=(2000,2000) and iters=100
GTX 470 7.22s
GTX 285, 6.84s
GTX 480 5.83s
"""
import
theano
,
numpy
,
time
import
theano
,
numpy
,
time
import
theano.tensor
as
T
import
theano.tensor
as
T
shapes
=
(
2000
,
2000
)
shapes
=
(
2000
,
2000
)
iters
=
10
iters
=
10
a
=
theano
.
shared
(
numpy
.
ones
(
shapes
,
dtype
=
theano
.
config
.
floatX
))
def
execute
(
verbose
=
True
):
b
=
theano
.
shared
(
numpy
.
ones
(
shapes
,
dtype
=
theano
.
config
.
floatX
))
c
=
theano
.
shared
(
numpy
.
ones
(
shapes
,
dtype
=
theano
.
config
.
floatX
))
f
=
theano
.
function
([],
updates
=
{
c
:
0.4
*
c
+.
8
*
T
.
dot
(
a
,
b
)})
a
=
theano
.
shared
(
numpy
.
ones
(
shapes
,
dtype
=
theano
.
config
.
floatX
))
print
'blas.ldflags='
,
theano
.
config
.
blas
.
ldflags
b
=
theano
.
shared
(
numpy
.
ones
(
shapes
,
dtype
=
theano
.
config
.
floatX
))
print
'compiledir='
,
theano
.
config
.
compiledir
c
=
theano
.
shared
(
numpy
.
ones
(
shapes
,
dtype
=
theano
.
config
.
floatX
))
if
any
(
[
x
.
op
.
__class__
.
__name__
==
'Gemm'
for
x
in
f
.
maker
.
env
.
toposort
()]):
print
'Used the cpu'
elif
any
(
[
x
.
op
.
__class__
.
__name__
==
'GpuGemm'
for
x
in
f
.
maker
.
env
.
toposort
()]):
print
'Used the gpu'
print
f
.
maker
.
env
.
toposort
()
f
=
theano
.
function
([],
updates
=
{
c
:
0.4
*
c
+.
8
*
T
.
dot
(
a
,
b
)})
if
verbose
:
print
'Some theano flags:'
print
' blas.ldflags='
,
theano
.
config
.
blas
.
ldflags
print
' compiledir='
,
theano
.
config
.
compiledir
print
' floatX='
,
theano
.
config
.
floatX
print
print
'Numpy config:(used when the theano flags "blas.ldflags" is empty)'
numpy
.
show_config
();
print
'Numpy dot module:'
,
numpy
.
dot
.
__module__
;
print
'Numpy file location that was loaded:'
,
numpy
.
__file__
;
print
'Numpy version:'
,
numpy
.
__version__
print
if
any
(
[
x
.
op
.
__class__
.
__name__
==
'Gemm'
for
x
in
f
.
maker
.
env
.
toposort
()]):
print
'Used the cpu'
elif
any
(
[
x
.
op
.
__class__
.
__name__
==
'GpuGemm'
for
x
in
f
.
maker
.
env
.
toposort
()]):
print
'Used the gpu'
else
:
print
'ERROR, not able to tell if theano used the cpu or the gpu'
print
f
.
maker
.
env
.
toposort
()
t0
=
time
.
time
()
t0
=
time
.
time
()
for
i
in
range
(
iters
):
for
i
in
range
(
iters
):
f
()
f
()
print
t1
=
time
.
time
()
print
'times=
%.2
fs'
%
(
time
.
time
()
-
t0
)
if
verbose
:
print
print
'this execution time took
%.2
fs'
%
(
t1
-
t0
)
return
t1
-
t0
print
"""
Some result that you can compare again on the cpu:
Lib: goto
def
jobman_job
(
state
,
channel
):
computer: Intel(R) Xeon(R) CPU E5430 @ 2.66GHz
execute
()
return
channel
.
COMPLETE
OMP_NUM_THREADS time
def
test
():
1 16.05s
execute
()
2 8.22s
4 4.13s
8 2.32s
if
__name__
==
"__main__"
:
"""
execute
()
print
"""
Some result that you can compare again. They where 10 executions of gemm in float64 with matrix of shape 2000x2000 on FC9.
We tested 3 cpus: Xeon E5345, Xeon E5430 and Xeon E5450
Lib tested:
* numpy with ATLAS from distribution(FC9) package (1 thread)
* manually compiled numpy and ATLAS with 2 threads
* goto with 1, 2, 4 and 8 threads.
lib/nb threads E5345(s) E5430(s) E5450(s)
numpy_FC9_atlas/1 39.2s 35.0s 30.7s
goto/1 18.7s 16.1s 14.2s
numpy_MAN_atlas/2 12.0s 11.6s 10.2s
goto/2 9.5s 8.1s 7.1s
goto/4 4.9s 4.4s 3.7s
goto/8 2.7s 2.4s 2.0s
"""
print
print
"We timed"
,
iters
,
"executions of gemm with matrix of shapes"
,
shapes
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论