Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
c077a6d5
P
Paddle
项目概览
机器未来
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
c077a6d5
编写于
11月 23, 2017
作者:
Y
Yu Yang
提交者:
GitHub
11月 23, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Feature/support int64 for sum (#5832)
* Support int64 for sum op * Refine code
上级
e800c0d3
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
24 addition
and
2 deletion
+24
-2
paddle/operators/math/selected_rows_functor.cc
paddle/operators/math/selected_rows_functor.cc
+4
-0
paddle/operators/math/selected_rows_functor.cu
paddle/operators/math/selected_rows_functor.cu
+4
-0
paddle/operators/sum_op.cc
paddle/operators/sum_op.cc
+3
-1
paddle/operators/sum_op.cu
paddle/operators/sum_op.cu
+3
-1
paddle/platform/cuda_helper.h
paddle/platform/cuda_helper.h
+10
-0
未找到文件。
paddle/operators/math/selected_rows_functor.cc
浏览文件 @
c077a6d5
...
...
@@ -145,6 +145,8 @@ struct SelectedRowsAddTo<platform::CPUPlace, T> {
template
struct
SelectedRowsAddTo
<
platform
::
CPUPlace
,
float
>;
template
struct
SelectedRowsAddTo
<
platform
::
CPUPlace
,
double
>;
template
struct
SelectedRowsAddTo
<
platform
::
CPUPlace
,
int
>;
template
struct
SelectedRowsAddTo
<
platform
::
CPUPlace
,
int64_t
>;
template
<
typename
T
>
struct
SelectedRowsAddToTensor
<
platform
::
CPUPlace
,
T
>
{
...
...
@@ -175,6 +177,8 @@ struct SelectedRowsAddToTensor<platform::CPUPlace, T> {
template
struct
SelectedRowsAddToTensor
<
platform
::
CPUPlace
,
float
>;
template
struct
SelectedRowsAddToTensor
<
platform
::
CPUPlace
,
double
>;
template
struct
SelectedRowsAddToTensor
<
platform
::
CPUPlace
,
int
>;
template
struct
SelectedRowsAddToTensor
<
platform
::
CPUPlace
,
int64_t
>;
}
// namespace math
}
// namespace operators
...
...
paddle/operators/math/selected_rows_functor.cu
浏览文件 @
c077a6d5
...
...
@@ -173,6 +173,8 @@ struct SelectedRowsAddTo<platform::GPUPlace, T> {
template
struct
SelectedRowsAddTo
<
platform
::
GPUPlace
,
float
>;
template
struct
SelectedRowsAddTo
<
platform
::
GPUPlace
,
double
>;
template
struct
SelectedRowsAddTo
<
platform
::
GPUPlace
,
int
>;
template
struct
SelectedRowsAddTo
<
platform
::
GPUPlace
,
int64_t
>;
namespace
{
template
<
typename
T
,
int
block_size
>
...
...
@@ -223,6 +225,8 @@ struct SelectedRowsAddToTensor<platform::GPUPlace, T> {
template
struct
SelectedRowsAddToTensor
<
platform
::
GPUPlace
,
float
>;
template
struct
SelectedRowsAddToTensor
<
platform
::
GPUPlace
,
double
>;
template
struct
SelectedRowsAddToTensor
<
platform
::
GPUPlace
,
int
>;
template
struct
SelectedRowsAddToTensor
<
platform
::
GPUPlace
,
int64_t
>;
}
// namespace math
}
// namespace operators
...
...
paddle/operators/sum_op.cc
浏览文件 @
c077a6d5
...
...
@@ -176,4 +176,6 @@ namespace ops = paddle::operators;
REGISTER_OPERATOR
(
sum
,
ops
::
SumOp
,
ops
::
SumOpMaker
,
ops
::
SumGradMaker
,
ops
::
SumOpVarTypeInference
);
REGISTER_OP_CPU_KERNEL
(
sum
,
ops
::
SumKernel
<
paddle
::
platform
::
CPUPlace
,
float
>
,
ops
::
SumKernel
<
paddle
::
platform
::
CPUPlace
,
double
>
);
ops
::
SumKernel
<
paddle
::
platform
::
CPUPlace
,
double
>
,
ops
::
SumKernel
<
paddle
::
platform
::
CPUPlace
,
int
>
,
ops
::
SumKernel
<
paddle
::
platform
::
CPUPlace
,
int64_t
>
);
paddle/operators/sum_op.cu
浏览文件 @
c077a6d5
...
...
@@ -14,4 +14,6 @@ limitations under the License. */
namespace
ops
=
paddle
::
operators
;
REGISTER_OP_GPU_KERNEL
(
sum
,
ops
::
SumKernel
<
paddle
::
platform
::
GPUPlace
,
float
>
,
ops
::
SumKernel
<
paddle
::
platform
::
GPUPlace
,
double
>
);
ops
::
SumKernel
<
paddle
::
platform
::
GPUPlace
,
double
>
,
ops
::
SumKernel
<
paddle
::
platform
::
GPUPlace
,
int
>
,
ops
::
SumKernel
<
paddle
::
platform
::
GPUPlace
,
int64_t
>
);
paddle/platform/cuda_helper.h
浏览文件 @
c077a6d5
...
...
@@ -31,6 +31,16 @@ constexpr int PADDLE_CUDA_NUM_THREADS = 512;
// For atomicAdd.
USE_CUDA_ATOMIC
(
Add
,
float
);
USE_CUDA_ATOMIC
(
Add
,
int
);
USE_CUDA_ATOMIC
(
Add
,
unsigned
int
);
USE_CUDA_ATOMIC
(
Add
,
unsigned
long
long
int
);
CUDA_ATOMIC_WRAPPER
(
Add
,
int64_t
)
{
static_assert
(
sizeof
(
int64_t
)
==
sizeof
(
long
long
int
),
"long long should be int64"
);
return
CudaAtomicAdd
(
reinterpret_cast
<
unsigned
long
long
int
*>
(
address
),
static_cast
<
unsigned
long
long
int
>
(
val
));
}
#if defined(__CUDA_ARCH__) && __CUDA_ARCH__ >= 600
USE_CUDA_ATOMIC
(
Add
,
double
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录