Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
8b17154a
提交
8b17154a
authored
5月 14, 2015
作者:
Arnaud Bergeron
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Follow the change in call protocol in libgpuarray.
上级
6a8fa46f
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
22 行增加
和
10 行删除
+22
-10
basic_ops.py
theano/sandbox/gpuarray/basic_ops.py
+6
-3
elemwise.py
theano/sandbox/gpuarray/elemwise.py
+6
-4
rng_mrg.py
theano/sandbox/rng_mrg.py
+10
-3
没有找到文件。
theano/sandbox/gpuarray/basic_ops.py
浏览文件 @
8b17154a
...
@@ -944,6 +944,7 @@ KERNEL void k(GLOBAL_MEM %(ctype)s *a, ga_size n, ga_size m) {
...
@@ -944,6 +944,7 @@ KERNEL void k(GLOBAL_MEM %(ctype)s *a, ga_size n, ga_size m) {
kname
=
self
.
gpu_kernels
(
node
,
name
)[
0
]
.
objvar
kname
=
self
.
gpu_kernels
(
node
,
name
)[
0
]
.
objvar
s
=
"""
s
=
"""
size_t dims[2] = {0, 0};
size_t dims[2] = {0, 0};
size_t ls, gs;
void *args[3];
void *args[3];
int err;
int err;
...
@@ -959,10 +960,12 @@ KERNEL void k(GLOBAL_MEM %(ctype)s *a, ga_size n, ga_size m) {
...
@@ -959,10 +960,12 @@ KERNEL void k(GLOBAL_MEM %(ctype)s *a, ga_size n, ga_size m) {
%(fail)
s
%(fail)
s
}
}
args[0] =
&
%(z)
s->g
a;
args[0] =
%(z)
s->ga.dat
a;
args[1] = &dims[0];
args[1] = &dims[0];
args[2] = &dims[1];
args[2] = &dims[1];
err = GpuKernel_call(&
%(kname)
s, 0, 1, 256, args);
ls = 1;
gs = 256;
err = GpuKernel_call(&
%(kname)
s, 1, &ls, &gs, 0, args);
if (err != GA_NO_ERROR) {
if (err != GA_NO_ERROR) {
PyErr_Format(PyExc_RuntimeError,
PyErr_Format(PyExc_RuntimeError,
"gpuarray error: kEye:
%%
s. n
%%
lu, m=
%%
lu.",
"gpuarray error: kEye:
%%
s. n
%%
lu, m=
%%
lu.",
...
@@ -978,4 +981,4 @@ KERNEL void k(GLOBAL_MEM %(ctype)s *a, ga_size n, ga_size m) {
...
@@ -978,4 +981,4 @@ KERNEL void k(GLOBAL_MEM %(ctype)s *a, ga_size n, ga_size m) {
return
s
return
s
def
c_code_cache_version
(
self
):
def
c_code_cache_version
(
self
):
return
(
3
,
self
.
GpuKernelBase_version
)
return
(
4
,
self
.
GpuKernelBase_version
)
theano/sandbox/gpuarray/elemwise.py
浏览文件 @
8b17154a
...
@@ -2664,6 +2664,7 @@ class GpuCAReduceCPY(GpuKernelBase, HideC, CAReduceDtype):
...
@@ -2664,6 +2664,7 @@ class GpuCAReduceCPY(GpuKernelBase, HideC, CAReduceDtype):
nd_out
=
node
.
outputs
[
0
]
.
ndim
nd_out
=
node
.
outputs
[
0
]
.
ndim
code
=
"""
code
=
"""
size_t gs = 1;
size_t gs = 1;
size_t ls;
unsigned int n = 1;
unsigned int n = 1;
unsigned int proxy_dim[
%(nd_in)
s];
unsigned int proxy_dim[
%(nd_in)
s];
unsigned int proxy_off;
unsigned int proxy_off;
...
@@ -2727,7 +2728,7 @@ class GpuCAReduceCPY(GpuKernelBase, HideC, CAReduceDtype):
...
@@ -2727,7 +2728,7 @@ class GpuCAReduceCPY(GpuKernelBase, HideC, CAReduceDtype):
# data in the proper type.
# data in the proper type.
code
+=
"""
code
+=
"""
args[0] = &n;
args[0] = &n;
args[1] =
&tmp->g
a;
args[1] =
tmp->ga.dat
a;
"""
%
dict
(
output
=
output
)
"""
%
dict
(
output
=
output
)
p
=
2
p
=
2
...
@@ -2742,7 +2743,7 @@ class GpuCAReduceCPY(GpuKernelBase, HideC, CAReduceDtype):
...
@@ -2742,7 +2743,7 @@ class GpuCAReduceCPY(GpuKernelBase, HideC, CAReduceDtype):
code
+=
"gs *=
%(input)
s->ga.dimensions[
%(i)
s];"
%
dict
(
input
=
input
,
i
=
i
)
code
+=
"gs *=
%(input)
s->ga.dimensions[
%(i)
s];"
%
dict
(
input
=
input
,
i
=
i
)
code
+=
"""
code
+=
"""
args[
%(p)
s] =
&
%(input)
s->g
a;
args[
%(p)
s] =
%(input)
s->ga.dat
a;
proxy_off =
%(input)
s->ga.offset;
proxy_off =
%(input)
s->ga.offset;
args[
%(p)
s+1] = &proxy_off;
args[
%(p)
s+1] = &proxy_off;
"""
%
dict
(
p
=
p
,
input
=
input
)
"""
%
dict
(
p
=
p
,
input
=
input
)
...
@@ -2758,7 +2759,8 @@ class GpuCAReduceCPY(GpuKernelBase, HideC, CAReduceDtype):
...
@@ -2758,7 +2759,8 @@ class GpuCAReduceCPY(GpuKernelBase, HideC, CAReduceDtype):
code
+=
"""
code
+=
"""
if (gs == 0) gs = 1;
if (gs == 0) gs = 1;
n /= gs;
n /= gs;
err = GpuKernel_call(&
%(k_var)
s, 0,
%(ls)
s, gs, args);
ls =
%(ls)
s;
err = GpuKernel_call(&
%(k_var)
s, 1, &ls, &gs, 0, args);
if (err != GA_NO_ERROR) {
if (err != GA_NO_ERROR) {
PyErr_Format(PyExc_RuntimeError,
PyErr_Format(PyExc_RuntimeError,
"gpuarray error: GpuCAReduceCPY:
%%
s.",
"gpuarray error: GpuCAReduceCPY:
%%
s.",
...
@@ -2788,7 +2790,7 @@ class GpuCAReduceCPY(GpuKernelBase, HideC, CAReduceDtype):
...
@@ -2788,7 +2790,7 @@ class GpuCAReduceCPY(GpuKernelBase, HideC, CAReduceDtype):
return
code
return
code
def
c_code_cache_version
(
self
):
def
c_code_cache_version
(
self
):
return
(
0
,
self
.
GpuKernelBase_version
)
return
(
1
,
self
.
GpuKernelBase_version
)
def
generate_kernel
(
self
,
node
,
odtype
,
redux
):
def
generate_kernel
(
self
,
node
,
odtype
,
redux
):
if
isinstance
(
self
.
scalar_op
,
scalar
.
basic
.
Add
):
if
isinstance
(
self
.
scalar_op
,
scalar
.
basic
.
Add
):
...
...
theano/sandbox/rng_mrg.py
浏览文件 @
8b17154a
...
@@ -994,11 +994,18 @@ class GPUA_mrg_uniform(GpuKernelBase, mrg_uniform_base):
...
@@ -994,11 +994,18 @@ class GPUA_mrg_uniform(GpuKernelBase, mrg_uniform_base):
{
{
void *args[4];
void *args[4];
args[0] = &
%(o_sample)
s->ga;
size_t ls = 0, gs = 0;
args[1] = &
%(o_rstate)
s->ga;
args[0] =
%(o_sample)
s->ga.data;
args[1] =
%(o_rstate)
s->ga.data;
args[2] = &n_elements;
args[2] = &n_elements;
args[3] = &n_streams;
args[3] = &n_streams;
int err = GpuKernel_call(&
%(kname)
s, n_elements, 0, 0, args);
int err = GpuKernel_sched(&
%(kname)
s, n_elements, &ls, &gs);
if (err != GA_NO_ERROR) {
PyErr_Format(PyExc_RuntimeError, "GpuKernel_sched:
%%
s
\\
n",
GpuKernel_error(&
%(kname)
s, err));
%(fail)
s
}
err = GpuKernel_call(&
%(kname)
s, 1, &ls, &gs, 0, args);
if (err != GA_NO_ERROR) {
if (err != GA_NO_ERROR) {
PyErr_Format(PyExc_RuntimeError, "GpuKernel_call:
%%
s
\\
n",
PyErr_Format(PyExc_RuntimeError, "GpuKernel_call:
%%
s
\\
n",
GpuKernel_error(&
%(kname)
s, err));
GpuKernel_error(&
%(kname)
s, err));
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论