Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
a6b089c6
P
Paddle
项目概览
PaddlePaddle
/
Paddle
1 年多 前同步成功
通知
2310
Star
20933
Fork
5423
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
a6b089c6
编写于
11月 29, 2019
作者:
H
hutuxian
提交者:
GitHub
11月 29, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add macro to ban windows (#21422)
remove nccl related code in windows
上级
ebfb720a
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
15 addition
and
1 deletion
+15
-1
paddle/fluid/operators/data_norm_op.cu
paddle/fluid/operators/data_norm_op.cu
+10
-1
python/paddle/fluid/tests/unittests/test_data_norm_op.py
python/paddle/fluid/tests/unittests/test_data_norm_op.py
+5
-0
未找到文件。
paddle/fluid/operators/data_norm_op.cu
浏览文件 @
a6b089c6
...
...
@@ -16,9 +16,11 @@ limitations under the License. */
#include <string>
#include "paddle/fluid/framework/data_layout.h"
#include "paddle/fluid/operators/data_norm_op.h"
#include "paddle/fluid/platform/collective_helper.h"
#include "paddle/fluid/platform/cuda_primitives.h"
#if defined(PADDLE_WITH_CUDA) && !defined(_WIN32)
#include "paddle/fluid/platform/collective_helper.h"
#include "paddle/fluid/platform/nccl_helper.h"
#endif
namespace
paddle
{
namespace
operators
{
...
...
@@ -176,6 +178,7 @@ class DataNormGradKernel<platform::CUDADeviceContext, T>
d_batch_sum
,
d_batch_square_sum
);
if
(
need_sync_stats
)
{
#if defined(PADDLE_WITH_CUDA) && !defined(_WIN32)
auto
comm
=
platform
::
NCCLCommContext
::
Instance
().
Get
(
0
,
ctx
.
GetPlace
());
PADDLE_ENFORCE_CUDA_SUCCESS
(
platform
::
dynload
::
ncclAllReduce
(
reinterpret_cast
<
const
void
*>
(
d_batch_size
),
...
...
@@ -194,7 +197,13 @@ class DataNormGradKernel<platform::CUDADeviceContext, T>
LOG
(
FATAL
)
<<
"Fail to sync nccl stream: "
<<
cudaGetErrorString
(
e_sync
);
}
#else
PADDLE_THROW
(
platform
::
errors
::
PreconditionNotMet
(
"PaddlePaddle should compile with GPU, and need_sync_stats connot be "
"supported on windows now."
));
#endif
}
T
*
batch_size_data
=
ctx
.
Output
<
Tensor
>
(
"BatchSize"
)
->
mutable_data
<
T
>
(
ctx
.
GetPlace
());
T
*
batch_sum_data
=
...
...
python/paddle/fluid/tests/unittests/test_data_norm_op.py
浏览文件 @
a6b089c6
...
...
@@ -287,6 +287,11 @@ class TestDataNormOpWithSyncStats(OpTest):
def
test_sync_stats
(
self
):
if
not
core
.
is_compiled_with_cuda
():
return
if
os
.
name
==
'nt'
:
print
(
'Skip TestDataNormOpWithSyncStats because nccl is not supported on windows'
)
return
x
=
fluid
.
layers
.
data
(
name
=
'x'
,
shape
=
[
1
],
dtype
=
'int64'
,
lod_level
=
0
)
emb
=
layers
.
embedding
(
input
=
x
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录