Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
b2dd25bf
提交
b2dd25bf
authored
1月 11, 2012
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Reordered the output of check_blas.py to have the executed timming at the end.
The comparison table is not first.
上级
dbe96b2a
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
35 行增加
和
25 行删除
+35
-25
check_blas.py
theano/misc/check_blas.py
+35
-25
没有找到文件。
theano/misc/check_blas.py
浏览文件 @
b2dd25bf
...
@@ -26,6 +26,11 @@ def execute(execute=True, verbose=True, M=2000, N=2000, K=2000, iters=10):
...
@@ -26,6 +26,11 @@ def execute(execute=True, verbose=True, M=2000, N=2000, K=2000, iters=10):
"""
"""
:param execute: If True, execute a Theano function that should call gemm
:param execute: If True, execute a Theano function that should call gemm
:param verbose: If True, will print some Theano flags and env variable.
:param verbose: If True, will print some Theano flags and env variable.
:param M,N,K: the M,N,K size used by gemm
:param iters: the number of call to gemm to do
:return: a tuple (execution time,
str that represent the implementation used)
"""
"""
a
=
theano
.
shared
(
numpy
.
ones
((
M
,
N
),
dtype
=
theano
.
config
.
floatX
))
a
=
theano
.
shared
(
numpy
.
ones
((
M
,
N
),
dtype
=
theano
.
config
.
floatX
))
...
@@ -51,31 +56,25 @@ def execute(execute=True, verbose=True, M=2000, N=2000, K=2000, iters=10):
...
@@ -51,31 +56,25 @@ def execute(execute=True, verbose=True, M=2000, N=2000, K=2000, iters=10):
print
'Numpy file location that was loaded:'
,
numpy
.
__file__
print
'Numpy file location that was loaded:'
,
numpy
.
__file__
print
'Numpy version:'
,
numpy
.
__version__
print
'Numpy version:'
,
numpy
.
__version__
print
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
=
0
t0
=
0
t1
=
-
1
t1
=
-
1
if
any
([
x
.
op
.
__class__
.
__name__
==
'Gemm'
for
x
in
f
.
maker
.
env
.
toposort
()]):
impl
=
'Used the cpu'
elif
any
([
x
.
op
.
__class__
.
__name__
==
'GpuGemm'
for
x
in
f
.
maker
.
env
.
toposort
()]):
impl
=
'Used the gpu'
else
:
impl
=
'ERROR, not able to tell if theano used the cpu or the gpu'
impl
+=
f
.
maker
.
env
.
toposort
()
if
execute
:
if
execute
:
t0
=
time
.
time
()
t0
=
time
.
time
()
for
i
in
range
(
iters
):
for
i
in
range
(
iters
):
f
()
f
()
t1
=
time
.
time
()
t1
=
time
.
time
()
if
verbose
and
execute
:
return
t1
-
t0
,
impl
print
print
'This execution time took
%.2
fs'
%
(
t1
-
t0
)
print
print
(
'Try to run this script a few times. Experience show that'
' the first time is not as fast as followings call. The'
' difference is not big, but consistent.'
)
return
t1
-
t0
def
jobman_job
(
state
,
channel
):
def
jobman_job
(
state
,
channel
):
...
@@ -115,9 +114,6 @@ if __name__ == "__main__":
...
@@ -115,9 +114,6 @@ if __name__ == "__main__":
print
options
.
help
print
options
.
help
sys
.
exit
(
0
)
sys
.
exit
(
0
)
t
=
execute
(
not
options
.
print_only
,
not
options
.
quiet
,
M
=
options
.
M
,
N
=
options
.
N
,
K
=
options
.
K
,
iters
=
options
.
iter
)
if
not
options
.
quiet
:
if
not
options
.
quiet
:
print
"""
print
"""
Some results that you can compare against. They were 10 executions
Some results that you can compare against. They were 10 executions
...
@@ -181,10 +177,24 @@ if __name__ == "__main__":
...
@@ -181,10 +177,24 @@ if __name__ == "__main__":
8500GT/3.0 10.68s
8500GT/3.0 10.68s
"""
"""
t
,
impl
=
execute
(
not
options
.
print_only
,
not
options
.
quiet
,
M
=
options
.
M
,
N
=
options
.
N
,
K
=
options
.
K
,
iters
=
options
.
iter
)
if
options
.
print_only
:
pass
elif
options
.
quiet
:
print
t
else
:
print
print
print
"We
tim
ed"
,
options
.
iter
,
print
"We
execut
ed"
,
options
.
iter
,
print
"
executions of
gemm with a and b matrix of shapes"
,
print
"
call to
gemm with a and b matrix of shapes"
,
print
"(
%
d,
%
d) and (
%
d,
%
d)."
%
(
options
.
M
,
options
.
N
,
print
"(
%
d,
%
d) and (
%
d,
%
d)."
%
(
options
.
M
,
options
.
N
,
options
.
N
,
options
.
K
)
options
.
N
,
options
.
K
)
else
:
print
t
print
print
'Those executions time took
%.2
fs'
%
t
print
print
(
'Try to run this script a few times. Experience show that'
' the first time is not as fast as followings call. The'
' difference is not big, but consistent.'
)
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论