Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
24e73f67
提交
24e73f67
authored
12月 01, 2015
作者:
abergeron
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3712 from nouiz/crash_gpu_from_host
Fix compilation crash
上级
5429c30a
78158149
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
33 行增加
和
5 行删除
+33
-5
test_opt.py
theano/sandbox/cuda/tests/test_opt.py
+18
-0
basic_ops.py
theano/sandbox/gpuarray/basic_ops.py
+3
-2
opt.py
theano/sandbox/gpuarray/opt.py
+3
-2
test_opt.py
theano/sandbox/gpuarray/tests/test_opt.py
+9
-1
没有找到文件。
theano/sandbox/cuda/tests/test_opt.py
浏览文件 @
24e73f67
...
@@ -504,6 +504,24 @@ def test_pdbbreakpoint_op():
...
@@ -504,6 +504,24 @@ def test_pdbbreakpoint_op():
assert
topo
[
-
1
]
.
op
==
cuda
.
host_from_gpu
assert
topo
[
-
1
]
.
op
==
cuda
.
host_from_gpu
def
test_local_gpu_elemwise_careduce
():
x
=
theano
.
tensor
.
fmatrix
()
o
=
(
x
*
x
)
.
sum
()
f
=
theano
.
function
([
x
],
o
,
mode
=
mode_with_gpu
)
topo
=
f
.
maker
.
fgraph
.
toposort
()
assert
len
(
topo
)
==
3
assert
topo
[
1
]
.
op
.
pre_scalar_op
==
theano
.
scalar
.
sqr
data
=
numpy
.
random
.
rand
(
3
,
4
)
.
astype
(
'float32'
)
utt
.
assert_allclose
(
f
(
data
),
(
data
*
data
)
.
sum
())
o
=
(
x
*
x
)
.
sum
(
axis
=
1
)
f
=
theano
.
function
([
x
],
o
,
mode
=
mode_with_gpu
)
topo
=
f
.
maker
.
fgraph
.
toposort
()
assert
len
(
topo
)
==
3
assert
topo
[
1
]
.
op
.
pre_scalar_op
==
theano
.
scalar
.
sqr
utt
.
assert_allclose
(
f
(
data
),
(
data
*
data
)
.
sum
(
axis
=
1
))
def
test_huge_elemwise_fusion
():
def
test_huge_elemwise_fusion
():
""" Test the the GpuElemwise fusion work correctly
""" Test the the GpuElemwise fusion work correctly
We check that we fuse one node with part of its input
We check that we fuse one node with part of its input
...
...
theano/sandbox/gpuarray/basic_ops.py
浏览文件 @
24e73f67
...
@@ -403,6 +403,7 @@ class GpuFromHost(Op):
...
@@ -403,6 +403,7 @@ class GpuFromHost(Op):
return
"""
return
"""
PyArrayObject *
%(name)
s_tmp;
PyArrayObject *
%(name)
s_tmp;
%(name)
s_tmp = PyArray_GETCONTIGUOUS(
%(inp)
s);
%(name)
s_tmp = PyArray_GETCONTIGUOUS(
%(inp)
s);
int err;
if (
%(name)
s_tmp == NULL)
if (
%(name)
s_tmp == NULL)
%(fail)
s
%(fail)
s
...
@@ -411,8 +412,8 @@ class GpuFromHost(Op):
...
@@ -411,8 +412,8 @@ class GpuFromHost(Op):
(size_t *)PyArray_DIMS(
%(name)
s_tmp),
(size_t *)PyArray_DIMS(
%(name)
s_tmp),
get_typecode((PyObject *)PyArray_DESCR(
%(name)
s_tmp)))) {
get_typecode((PyObject *)PyArray_DESCR(
%(name)
s_tmp)))) {
Py_BEGIN_ALLOW_THREADS
Py_BEGIN_ALLOW_THREADS
int
err = GpuArray_write(&
%(out)
s->ga, PyArray_DATA(
%(name)
s_tmp),
err = GpuArray_write(&
%(out)
s->ga, PyArray_DATA(
%(name)
s_tmp),
PyArray_NBYTES(
%(name)
s_tmp));
PyArray_NBYTES(
%(name)
s_tmp));
Py_END_ALLOW_THREADS
Py_END_ALLOW_THREADS
Py_DECREF(
%(name)
s_tmp);
Py_DECREF(
%(name)
s_tmp);
if (err != GA_NO_ERROR) {
if (err != GA_NO_ERROR) {
...
...
theano/sandbox/gpuarray/opt.py
浏览文件 @
24e73f67
...
@@ -867,12 +867,13 @@ def local_gpu_elemwise_careduce(node):
...
@@ -867,12 +867,13 @@ def local_gpu_elemwise_careduce(node):
isinstance
(
node
.
inputs
[
0
]
.
owner
.
op
,
GpuElemwise
)
and
isinstance
(
node
.
inputs
[
0
]
.
owner
.
op
,
GpuElemwise
)
and
# The Op support all scalar with 1 inputs. We don't
# The Op support all scalar with 1 inputs. We don't
# automatically add more case, as some like trigonometic
# automatically add more case, as some like trigonometic
# operation with some reduction pattern will probably result
# operation with some reduction pattern will probably result
s
#
to
slow down.
#
in
slow down.
isinstance
(
node
.
inputs
[
0
]
.
owner
.
op
.
scalar_op
,
scalar
.
basic
.
Sqr
)):
isinstance
(
node
.
inputs
[
0
]
.
owner
.
op
.
scalar_op
,
scalar
.
basic
.
Sqr
)):
op
=
node
.
op
op
=
node
.
op
inp
=
node
.
inputs
[
0
]
.
owner
.
inputs
[
0
]
inp
=
node
.
inputs
[
0
]
.
owner
.
inputs
[
0
]
return
[
GpuCAReduceCuda
(
scalar_op
=
op
.
scalar_op
,
return
[
GpuCAReduceCuda
(
scalar_op
=
op
.
scalar_op
,
axis
=
op
.
axis
,
reduce_mask
=
op
.
reduce_mask
,
reduce_mask
=
op
.
reduce_mask
,
pre_scalar_op
=
scalar
.
basic
.
sqr
)(
inp
)]
pre_scalar_op
=
scalar
.
basic
.
sqr
)(
inp
)]
...
...
theano/sandbox/gpuarray/tests/test_opt.py
浏览文件 @
24e73f67
...
@@ -212,7 +212,15 @@ def test_local_gpu_elemwise_careduce():
...
@@ -212,7 +212,15 @@ def test_local_gpu_elemwise_careduce():
topo
=
f
.
maker
.
fgraph
.
toposort
()
topo
=
f
.
maker
.
fgraph
.
toposort
()
assert
len
(
topo
)
==
3
assert
len
(
topo
)
==
3
assert
topo
[
1
]
.
op
.
pre_scalar_op
==
theano
.
scalar
.
sqr
assert
topo
[
1
]
.
op
.
pre_scalar_op
==
theano
.
scalar
.
sqr
f
(
numpy
.
random
.
rand
(
3
,
4
)
.
astype
(
theano
.
config
.
floatX
))
data
=
numpy
.
random
.
rand
(
3
,
4
)
.
astype
(
theano
.
config
.
floatX
)
utt
.
assert_allclose
(
f
(
data
),
(
data
*
data
)
.
sum
())
o
=
(
x
*
x
)
.
sum
(
axis
=
1
)
f
=
theano
.
function
([
x
],
o
,
mode
=
mode_with_gpu
)
topo
=
f
.
maker
.
fgraph
.
toposort
()
assert
len
(
topo
)
==
3
assert
topo
[
1
]
.
op
.
pre_scalar_op
==
theano
.
scalar
.
sqr
utt
.
assert_allclose
(
f
(
data
),
(
data
*
data
)
.
sum
(
axis
=
1
))
def
test_local_gpu_subtensor
():
def
test_local_gpu_subtensor
():
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论