Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
6ef192a3
提交
6ef192a3
authored
6月 23, 2011
作者:
Frederic Bastien
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Small comment and errors msg fix.
上级
f6351e1a
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
7 行增加
和
45 行删除
+7
-45
cuda_ndarray.cu
theano/sandbox/cuda/cuda_ndarray.cu
+7
-45
没有找到文件。
theano/sandbox/cuda/cuda_ndarray.cu
浏览文件 @
6ef192a3
...
@@ -901,52 +901,12 @@ CudaNdarray_add(PyObject* py_self, PyObject * py_other)
...
@@ -901,52 +901,12 @@ CudaNdarray_add(PyObject* py_self, PyObject * py_other)
return
(
PyObject
*
)
rval
;
return
(
PyObject
*
)
rval
;
}
}
/*
#define decl_k_elemwise_binary_inplace_rowmajor_3(name, F) \
__global__ void name(const int d0, const int d1, const int d2,\
float* a, const int sA0, const int sA1, const int sA2,\
const float* b, const int sB0, const int sB1, const int sB2){\
for (int i0 = blockIdx.x; i0 < d0; i0 += gridDim.x){\
for (int i1 = blockIdx.y; i1 < d1; i1 += gridDim.y){\
for (int i2 = threadIdx.x; i2 < d2; i2 += blockDim.x){\
F(a[i0*sA0 + i1*sA1 + i2*sA2], b[i0*sB0 + i1*sB1 + i2*sB2]); \
}\
}\
}\
}
#define decl_k_elemwise_binary_inplace_rowmajor_4(name, F) \
__global__ void name(const int d0, const int d1, const int d2, const int d3,\
float* a, const int sA0, const int sA1,\
const int sA2, const int sA3,\
const float* b, const int sB0, const int sB1,\
const int sB2, const int sB3){\
for (int i0 = blockIdx.x; i0 < d0; i0 += gridDim.x){\
for (int i1 = blockIdx.y; i1 < d1; i1 += gridDim.y){\
for (int i2 = threadIdx.x; i2 < d2; i2 += blockDim.x){\
for (int i3 = threadIdx.y; i3 < d3; i3 += blockDim.y){\
F(a[i0*sA0 + i1*sA1 + i2*sA2 + i3*sA3], b[i0*sB0 + i1*sB1 + i2*sB2 + i3*sB3]); \
}\
}\
}\
}\
}
template<typename T> __device__ T binary_iadd(T a, T b) { a = a+b; }
template<typename T> __device__ T binary_idiv(T a, T b) { a = a/b; }
decl_k_elemwise_binary_inplace_rowmajor_3(k_iadd_3, binary_iadd<float>)
decl_k_elemwise_binary_inplace_rowmajor_4(k_iadd_4, binary_iadd<float>)
decl_k_elemwise_binary_inplace_rowmajor_3(k_idiv_3, binary_idiv<float>)
decl_k_elemwise_binary_inplace_rowmajor_4(k_idiv_4, binary_idiv<float>)
*/
enum
operator_t
enum
operator_t
{
{
IADD
=
0
,
IADD
=
0
,
IDIV
,
IDIV
,
CPY
,
CPY
,
N_ELEMWISE_OPS
N_ELEMWISE_OPS
// What this mean? It is not used
};
};
template
<
int
operator_num
>
template
<
int
operator_num
>
...
@@ -1005,14 +965,16 @@ __global__ void k_ielem_4(const int d0, const int d1, const int d2, const int d3
...
@@ -1005,14 +965,16 @@ __global__ void k_ielem_4(const int d0, const int d1, const int d2, const int d3
/*
/*
CudaNdarray_inplace_elemwise
CudaNdarray_inplace_elemwise
Compute A / B or A + B, working inplace on A.
Compute elemwise, working inplace on A.
Currently implemented A / B, A + B and A = B
(the last is not tested and not used!)
py_self - the CudaNdarray that we'll modify (A)
py_self - the CudaNdarray that we'll modify (A)
py_other - the other argument (B)
py_other - the other argument (B)
fct_nb - which operation to perform (operator_t)
fct_nb - which operation to perform (operator_t)
Returns 0 on success.
Returns 0 on success.
Returns 1 on failure, and sets Python exception.
Returns
-
1 on failure, and sets Python exception.
*/
*/
int
int
...
@@ -1090,7 +1052,7 @@ CudaNdarray_inplace_elemwise(PyObject* py_self, PyObject * py_other, operator_t
...
@@ -1090,7 +1052,7 @@ CudaNdarray_inplace_elemwise(PyObject* py_self, PyObject * py_other, operator_t
{
{
PyErr_SetString
(
PyErr_SetString
(
PyExc_ValueError
,
PyExc_ValueError
,
"need same dimensions (or broadcastable dimension)"
);
"
CudaNdarray_inplace_elemwise
need same dimensions (or broadcastable dimension)"
);
return
-
1
;
return
-
1
;
}
}
// if we're broadcasting other, then make sure it has stride 0
// if we're broadcasting other, then make sure it has stride 0
...
@@ -1105,7 +1067,7 @@ CudaNdarray_inplace_elemwise(PyObject* py_self, PyObject * py_other, operator_t
...
@@ -1105,7 +1067,7 @@ CudaNdarray_inplace_elemwise(PyObject* py_self, PyObject * py_other, operator_t
{
{
PyErr_SetString
(
PyErr_SetString
(
PyExc_ValueError
,
PyExc_ValueError
,
"cannot work inplace on an un-initialized array"
);
"
CudaNdarray_inplace_elemwise
cannot work inplace on an un-initialized array"
);
return
0
;
return
0
;
}
}
return
0
;
return
0
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论