Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
065133f3
提交
065133f3
authored
1月 11, 2012
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added in check_blas.py the --M, --N and --K options.
上级
dd4f0c5c
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
39 行增加
和
15 行删除
+39
-15
check_blas.py
theano/misc/check_blas.py
+39
-15
没有找到文件。
theano/misc/check_blas.py
浏览文件 @
065133f3
...
@@ -21,16 +21,21 @@ import theano.tensor as T
...
@@ -21,16 +21,21 @@ import theano.tensor as T
from
theano.gof.python25
import
any
from
theano.gof.python25
import
any
default_M
,
default_N
,
default_K
=
(
2000
,
2000
,
2000
)
shapes
=
(
2000
,
2000
)
iters
=
10
iters
=
10
def
execute
(
execute
=
True
,
verbose
=
True
):
def
execute
(
execute
=
True
,
verbose
=
True
,
M
=
None
,
N
=
None
,
K
=
None
,
iters
=
10
):
if
M
is
None
:
M
=
default_M
if
N
is
None
:
N
=
default_N
if
K
is
None
:
K
=
default_K
a
=
theano
.
shared
(
numpy
.
ones
(
shapes
,
dtype
=
theano
.
config
.
floatX
))
a
=
theano
.
shared
(
numpy
.
ones
(
(
M
,
N
)
,
dtype
=
theano
.
config
.
floatX
))
b
=
theano
.
shared
(
numpy
.
ones
(
shapes
,
dtype
=
theano
.
config
.
floatX
))
b
=
theano
.
shared
(
numpy
.
ones
(
(
N
,
K
)
,
dtype
=
theano
.
config
.
floatX
))
c
=
theano
.
shared
(
numpy
.
ones
(
shapes
,
dtype
=
theano
.
config
.
floatX
))
c
=
theano
.
shared
(
numpy
.
ones
(
(
M
,
K
)
,
dtype
=
theano
.
config
.
floatX
))
f
=
theano
.
function
([],
updates
=
{
c
:
0.4
*
c
+
.
8
*
T
.
dot
(
a
,
b
)})
f
=
theano
.
function
([],
updates
=
{
c
:
0.4
*
c
+
.
8
*
T
.
dot
(
a
,
b
)})
...
@@ -86,19 +91,36 @@ def jobman_job(state, channel):
...
@@ -86,19 +91,36 @@ def jobman_job(state, channel):
def
test
():
def
test
():
execute
()
execute
()
from
optparse
import
OptionParser
parser
=
OptionParser
(
usage
=
'
%
prog <options>'
)
parser
.
add_option
(
'-q'
,
'--quiet'
,
action
=
'store_true'
,
dest
=
'quiet'
,
default
=
False
,
help
=
"If true, don't print the comparison table"
)
parser
.
add_option
(
'--print_only'
,
action
=
'store_true'
,
dest
=
'print_only'
,
default
=
False
,
help
=
"If true, don't do the gemm call"
)
parser
.
add_option
(
'-M'
,
'--M'
,
action
=
'store'
,
dest
=
'M'
,
default
=
2000
,
type
=
"int"
,
help
=
"The M size to gemm"
)
parser
.
add_option
(
'-N'
,
'--N'
,
action
=
'store'
,
dest
=
'N'
,
default
=
2000
,
type
=
"int"
,
help
=
"The N size to gemm"
)
parser
.
add_option
(
'-K'
,
'--K'
,
action
=
'store'
,
dest
=
'K'
,
default
=
2000
,
type
=
"int"
,
help
=
"The K size to gemm"
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
verbose
=
True
options
,
arguments
=
parser
.
parse_args
(
sys
.
argv
)
print_only
=
False
if
'--quiet'
in
sys
.
argv
:
if
hasattr
(
options
,
"help"
):
verbose
=
False
print
options
.
help
if
'--print_only'
in
sys
.
argv
:
sys
.
exit
(
0
)
print_only
=
True
t
=
execute
(
not
print_only
,
verbose
)
t
=
execute
(
not
options
.
print_only
,
not
options
.
quiet
,
M
=
options
.
M
,
N
=
options
.
N
,
K
=
options
.
K
)
if
verbose
:
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
of gemm in float64 with matrices of shape 2000x2000.
of gemm in float64 with matrices of shape 2000x2000.
...
@@ -163,6 +185,8 @@ if __name__ == "__main__":
...
@@ -163,6 +185,8 @@ if __name__ == "__main__":
print
print
print
"We timed"
,
iters
,
print
"We timed"
,
iters
,
print
"executions of gemm with matrix of shapes"
,
shapes
print
"executions of gemm with a and b matrix of shapes"
,
print
"(
%
d,
%
d) and (
%
d,
%
d)."
%
(
options
.
M
,
options
.
N
,
options
.
N
,
options
.
K
)
else
:
else
:
print
t
print
t
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论