Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
ab369976
P
Paddle
项目概览
BaiXuePrincess
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
ab369976
编写于
10月 19, 2022
作者:
C
Chen Weihang
提交者:
GitHub
10月 19, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove fluid symbol depend in sync bn (#47122)
上级
d00b7d83
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
36 addition
and
10 deletion
+36
-10
paddle/phi/kernels/gpu/sync_batch_norm_kernel.cu
paddle/phi/kernels/gpu/sync_batch_norm_kernel.cu
+22
-10
paddle/phi/kernels/sync_batch_norm_kernel.h
paddle/phi/kernels/sync_batch_norm_kernel.h
+14
-0
未找到文件。
paddle/phi/kernels/gpu/sync_batch_norm_kernel.cu
浏览文件 @
ab369976
...
...
@@ -18,6 +18,26 @@
#include "paddle/phi/kernels/gpu/sync_batch_norm_utils.h"
namespace
phi
{
namespace
detail
{
ccl
::
CCLComm
GetCCLComm
(
const
Place
&
place
,
int
global_gid
)
{
#if defined(PADDLE_WITH_NCCL) || defined(PADDLE_WITH_RCCL)
ncclComm_t
comm
=
nullptr
;
if
(
paddle
::
distributed
::
ProcessGroupMapFromGid
::
getInstance
()
->
has
(
global_gid
))
{
auto
*
nccl_pg
=
static_cast
<
paddle
::
distributed
::
ProcessGroupNCCL
*>
(
paddle
::
distributed
::
ProcessGroupMapFromGid
::
getInstance
()
->
get
(
global_gid
));
comm
=
nccl_pg
->
NCCLComm
(
place
);
}
return
comm
;
#else
return
nullptr
;
#endif
}
}
// namespace detail
template
<
typename
T
,
typename
Context
>
void
SyncBatchNormKernel
(
const
Context
&
ctx
,
...
...
@@ -102,16 +122,8 @@ void SyncBatchNormKernel(const Context &ctx,
}
#if defined(PADDLE_WITH_NCCL) || defined(PADDLE_WITH_RCCL)
int
global_gid
=
0
;
ncclComm_t
comm
=
nullptr
;
if
(
paddle
::
distributed
::
ProcessGroupMapFromGid
::
getInstance
()
->
has
(
global_gid
))
{
auto
*
nccl_pg
=
static_cast
<
paddle
::
distributed
::
ProcessGroupNCCL
*>
(
paddle
::
distributed
::
ProcessGroupMapFromGid
::
getInstance
()
->
get
(
global_gid
));
comm
=
nccl_pg
->
NCCLComm
(
x
.
place
());
}
else
{
ncclComm_t
comm
=
static_cast
<
ncclComm_t
>
(
detail
::
GetCCLComm
(
x
.
place
(),
0
));
if
(
comm
==
nullptr
)
{
comm
=
ctx
.
nccl_comm
();
}
...
...
paddle/phi/kernels/sync_batch_norm_kernel.h
浏览文件 @
ab369976
...
...
@@ -16,9 +16,23 @@
#include <string>
#include "paddle/phi/backends/c_comm_lib.h"
#include "paddle/phi/core/dense_tensor.h"
namespace
phi
{
namespace
detail
{
// FIXME(paddle-dev): Since the singleton of ProcessGroup in fluid is used in
// SyncBN, the fluid symbol will be dependent on external hardware access.
// Here, the part that depends on the fluid symbol is individually encapsulated
// as a temporary function to isolate external symbol dependencies.
// In the future, the dependence on the singleton in fluid in SyncBN needs
// to be removed.
// In principle, the PHI Kernel cannot use the global singleton internally,
// and the required members need to be passed in from the eucalyptus tree.
ccl
::
CCLComm
GetCCLComm
(
const
Place
&
place
,
int
global_gid
=
0
);
}
// namespace detail
template
<
typename
T
,
typename
Context
>
void
SyncBatchNormKernel
(
const
Context
&
dev_ctx
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录