Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
ec3a90d4
提交
ec3a90d4
authored
5月 02, 2013
作者:
James Bergstra
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1303 from nouiz/gpusoftmax
Fix GpuSoftmax[WithBias] Ops to work for large rows
上级
97fff534
2335f829
全部展开
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
20 行增加
和
36 行删除
+20
-36
dev_start_guide.txt
doc/dev_start_guide.txt
+1
-0
check_blas.py
theano/misc/check_blas.py
+3
-1
kernel_codegen.py
theano/sandbox/cuda/kernel_codegen.py
+0
-0
nnet.py
theano/sandbox/cuda/nnet.py
+0
-0
test_nnet.py
theano/sandbox/cuda/tests/test_nnet.py
+16
-35
没有找到文件。
doc/dev_start_guide.txt
浏览文件 @
ec3a90d4
...
@@ -505,5 +505,6 @@ Other tools that can help you
...
@@ -505,5 +505,6 @@ Other tools that can help you
* `line_profiler <http://pypi.python.org/pypi/line_profiler/>`_: Line-by-line profiler.
* `line_profiler <http://pypi.python.org/pypi/line_profiler/>`_: Line-by-line profiler.
* `memory_profiler <http://fseoane.net/blog/2012/line-by-line-report-of-memory-usage/>`_: memory profiler
* `memory_profiler <http://fseoane.net/blog/2012/line-by-line-report-of-memory-usage/>`_: memory profiler
* `runsnake <http://www.vrplumber.com/programming/runsnakerun/>`_: Gui for cProfile(time profiler) and Meliae(memory profiler)
* `runsnake <http://www.vrplumber.com/programming/runsnakerun/>`_: Gui for cProfile(time profiler) and Meliae(memory profiler)
* `Guppy <https://pypi.python.org/pypi/guppy/>`_: Supports object and heap memory sizing, profiling and debugging.
* `hub <https://github.com/defunkt/hub>`_: A tool that adds github commands to the git command line.
* `hub <https://github.com/defunkt/hub>`_: A tool that adds github commands to the git command line.
* `git pull-requests <http://www.splitbrain.org/blog/2011-06/19-automate_github_pull_requests>`_: Another tool for git/github command line.
* `git pull-requests <http://www.splitbrain.org/blog/2011-06/19-automate_github_pull_requests>`_: Another tool for git/github command line.
theano/misc/check_blas.py
浏览文件 @
ec3a90d4
...
@@ -198,6 +198,8 @@ if __name__ == "__main__":
...
@@ -198,6 +198,8 @@ if __name__ == "__main__":
cuda version 5.0 4.2 4.1 4.0 3.2 3.0 # note
cuda version 5.0 4.2 4.1 4.0 3.2 3.0 # note
gpu
gpu
K20m/ECC 0.07s
K20/NOECC 0.07s
M2070 0.25s 0.27s 0.32s
M2070 0.25s 0.27s 0.32s
M2050(Amazon) 0.25s
M2050(Amazon) 0.25s
C2075 0.25s
C2075 0.25s
...
@@ -215,7 +217,7 @@ if __name__ == "__main__":
...
@@ -215,7 +217,7 @@ if __name__ == "__main__":
GTX 285 0.452s 0.452s 0.40s # cuda 3.0 seems faster? driver version?
GTX 285 0.452s 0.452s 0.40s # cuda 3.0 seems faster? driver version?
GTX 550 Ti 0.57s
GTX 550 Ti 0.57s
GT 520 2.68s 3.06s
GT 520 2.68s 3.06s
520M
3.19s # with bumblebee on Ubuntu 12.04
520M
2.44s
3.19s # with bumblebee on Ubuntu 12.04
GT 220 3.80s
GT 220 3.80s
GT 210 6.35s
GT 210 6.35s
8500 GT 10.68s
8500 GT 10.68s
...
...
theano/sandbox/cuda/kernel_codegen.py
浏览文件 @
ec3a90d4
差异被折叠。
点击展开。
theano/sandbox/cuda/nnet.py
浏览文件 @
ec3a90d4
差异被折叠。
点击展开。
theano/sandbox/cuda/tests/test_nnet.py
浏览文件 @
ec3a90d4
...
@@ -172,8 +172,8 @@ def test_softmax_with_bias():
...
@@ -172,8 +172,8 @@ def test_softmax_with_bias():
x
=
T
.
fmatrix
(
'x'
)
x
=
T
.
fmatrix
(
'x'
)
# We can't use zeros_like(x[0,::]) as this don't allow to test with
# We can't use zeros_like(x[0,::]) as this don't allow to test with
# 0 shape.
# 0 shape.
z
=
T
.
nnet
.
softmax_with_bias
(
x
,
T
.
a
lloc
(
numpy
.
asarray
(
0
,
dtype
=
'float32'
)
,
z
=
T
.
nnet
.
softmax_with_bias
(
x
,
T
.
a
range
(
x
.
shape
[
1
]
*
2
,
x
.
shape
[
1
])
)
dtype
=
'float32'
)[::
2
]
)
f
=
theano
.
function
([
x
],
z
,
mode
=
mode_without_gpu
)
f
=
theano
.
function
([
x
],
z
,
mode
=
mode_without_gpu
)
f_gpu
=
theano
.
function
([
x
],
z
,
mode
=
mode_with_gpu
)
f_gpu
=
theano
.
function
([
x
],
z
,
mode
=
mode_with_gpu
)
...
@@ -181,24 +181,12 @@ def test_softmax_with_bias():
...
@@ -181,24 +181,12 @@ def test_softmax_with_bias():
assert
isinstance
(
f_gpu
.
maker
.
fgraph
.
toposort
()[
-
2
]
.
op
,
assert
isinstance
(
f_gpu
.
maker
.
fgraph
.
toposort
()[
-
2
]
.
op
,
cuda
.
nnet
.
GpuSoftmaxWithBias
)
cuda
.
nnet
.
GpuSoftmaxWithBias
)
def
cmp
(
n
,
m
,
catch
=
False
):
def
cmp
(
n
,
m
):
"""Some old card won't accet the configuration arguments of
this implementation. For those cases set catch=True to skip
those errors.
"""
try
:
#print "test_softmax",n,m
#print "test_softmax",n,m
data
=
numpy
.
arange
(
n
*
m
,
dtype
=
'float32'
)
.
reshape
(
n
,
m
)
data
=
numpy
.
arange
(
n
*
m
,
dtype
=
'float32'
)
.
reshape
(
n
,
m
)
out
=
f
(
data
)
out
=
f
(
data
)
gout
=
f_gpu
(
data
)
gout
=
f_gpu
(
data
)
assert
numpy
.
allclose
(
out
,
gout
),
numpy
.
absolute
(
out
-
gout
)
assert
numpy
.
allclose
(
out
,
gout
),
numpy
.
absolute
(
out
-
gout
)
except
RuntimeError
,
e
:
if
not
catch
:
raise
# Different CUDA driver have different error message
assert
(
e
.
args
[
0
]
.
startswith
(
'Cuda error: kSoftmaxWithBias_node_0: invalid configuration argument.
\n
'
)
or
e
.
args
[
0
]
.
startswith
(
'Cuda error: kSoftmaxWithBias_node_0: invalid argument.
\n
'
))
cmp
(
2
,
5
)
cmp
(
2
,
5
)
#we need to test n>32*1024 to check that we make the block loop.
#we need to test n>32*1024 to check that we make the block loop.
...
@@ -211,7 +199,11 @@ def test_softmax_with_bias():
...
@@ -211,7 +199,11 @@ def test_softmax_with_bias():
cmp
(
4
,
2000
)
cmp
(
4
,
2000
)
cmp
(
4
,
2024
)
cmp
(
4
,
2024
)
#GTX285 don't have enough shared mem for this case.
#GTX285 don't have enough shared mem for this case.
cmp
(
4
,
4074
,
True
)
cmp
(
4
,
4074
)
# The GTX580, 680 and kepler don't have enough shared memory.
cmp
(
2
,
10000
)
cmp
(
128
,
16
*
1024
)
cmp
(
128
,
64
*
1024
)
def
test_softmax
():
def
test_softmax
():
...
@@ -219,9 +211,7 @@ def test_softmax():
...
@@ -219,9 +211,7 @@ def test_softmax():
This is basic test for GpuSoftmax
This is basic test for GpuSoftmax
We check that we loop when their is too much block
We check that we loop when their is too much block
We use slower code when there isn't enough shared memory
TODO: check that we loop when their is too much thread.(THIS IS
NOT IMPLEMENTED)
"""
"""
x
=
T
.
fmatrix
(
'x'
)
x
=
T
.
fmatrix
(
'x'
)
...
@@ -232,25 +222,12 @@ def test_softmax():
...
@@ -232,25 +222,12 @@ def test_softmax():
assert
isinstance
(
f_gpu
.
maker
.
fgraph
.
toposort
()[
-
2
]
.
op
,
assert
isinstance
(
f_gpu
.
maker
.
fgraph
.
toposort
()[
-
2
]
.
op
,
cuda
.
nnet
.
GpuSoftmax
)
cuda
.
nnet
.
GpuSoftmax
)
def
cmp
(
n
,
m
,
catch
=
False
):
def
cmp
(
n
,
m
):
"""Some old card won't accept the configuration arguments of
this implementation. For those cases set catch=True to skip
those errors.
"""
try
:
#print "test_softmax",n,m
#print "test_softmax",n,m
data
=
numpy
.
arange
(
n
*
m
,
dtype
=
'float32'
)
.
reshape
(
n
,
m
)
data
=
numpy
.
arange
(
n
*
m
,
dtype
=
'float32'
)
.
reshape
(
n
,
m
)
out
=
f
(
data
)
out
=
f
(
data
)
gout
=
f_gpu
(
data
)
gout
=
f_gpu
(
data
)
assert
numpy
.
allclose
(
out
,
gout
),
numpy
.
absolute
(
out
-
gout
)
assert
numpy
.
allclose
(
out
,
gout
),
numpy
.
absolute
(
out
-
gout
)
except
RuntimeError
,
e
:
if
not
catch
:
raise
# Different CUDA driver have different error message
assert
(
e
.
args
[
0
]
.
startswith
(
'Cuda error: kSoftmax_node_0: invalid configuration argument.
\n
'
)
or
e
.
args
[
0
]
.
startswith
(
'Cuda error: kSoftmax_node_0: invalid argument.
\n
'
))
#we need to test n>32*1024 to check that we make the block loop.
#we need to test n>32*1024 to check that we make the block loop.
cmp
(
2
,
5
)
cmp
(
2
,
5
)
...
@@ -262,5 +239,9 @@ def test_softmax():
...
@@ -262,5 +239,9 @@ def test_softmax():
cmp
(
4
,
1024
)
cmp
(
4
,
1024
)
cmp
(
4
,
2000
)
cmp
(
4
,
2000
)
cmp
(
4
,
2024
)
cmp
(
4
,
2024
)
#GTX285 don't have enough shared mem for this case.
# The GTX285 don't have enough shared memory.
cmp
(
4
,
4074
,
True
)
cmp
(
4
,
4074
)
# The GTX580, 680 and kepler don't have enough shared memory.
cmp
(
2
,
10000
)
cmp
(
128
,
16
*
1024
)
cmp
(
128
,
64
*
1024
)
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论