Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
fbd186bd
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看板
提交
fbd186bd
编写于
2月 08, 2019
作者:
Q
Qiao Longfei
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
complete recv op
上级
a7152613
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
53 addition
and
30 deletion
+53
-30
paddle/fluid/operators/distributed_ops/recv_op.cc
paddle/fluid/operators/distributed_ops/recv_op.cc
+36
-22
python/paddle/fluid/transpiler/distribute_transpiler.py
python/paddle/fluid/transpiler/distribute_transpiler.py
+17
-8
未找到文件。
paddle/fluid/operators/distributed_ops/recv_op.cc
浏览文件 @
fbd186bd
...
@@ -20,6 +20,7 @@ limitations under the License. */
...
@@ -20,6 +20,7 @@ limitations under the License. */
#include "paddle/fluid/framework/lod_tensor.h"
#include "paddle/fluid/framework/lod_tensor.h"
#include "paddle/fluid/framework/op_registry.h"
#include "paddle/fluid/framework/op_registry.h"
#include "paddle/fluid/operators/distributed/distributed.h"
#include "paddle/fluid/operators/distributed/distributed.h"
#include "paddle/fluid/operators/distributed/parameter_recv.h"
#include "paddle/fluid/platform/profiler.h"
#include "paddle/fluid/platform/profiler.h"
namespace
paddle
{
namespace
paddle
{
...
@@ -48,6 +49,18 @@ class RecvOp : public framework::OperatorBase {
...
@@ -48,6 +49,18 @@ class RecvOp : public framework::OperatorBase {
distributed
::
RPCClient
::
GetInstance
<
RPCCLIENT_T
>
(
distributed
::
RPCClient
::
GetInstance
<
RPCCLIENT_T
>
(
Attr
<
int
>
(
"trainer_id"
));
Attr
<
int
>
(
"trainer_id"
));
std
::
vector
<
std
::
string
>
recv_varnames
=
Attr
<
std
::
vector
<
std
::
string
>>
(
"recv_varnames"
);
if
(
recv_varnames
.
size
()
>
0
)
{
framework
::
RuntimeContext
ctx
(
Inputs
(),
Outputs
(),
scope
);
platform
::
DeviceContextPool
&
pool
=
platform
::
DeviceContextPool
::
Instance
();
auto
*
dev_ctx
=
pool
.
Get
(
place
);
auto
exe_ctx
=
framework
::
ExecutionContext
(
*
this
,
scope
,
*
dev_ctx
,
ctx
);
auto
recv_functor
=
distributed
::
ParameterRecv
<
float
>
();
recv_functor
(
outs
[
0
],
recv_varnames
,
epmap
,
exe_ctx
,
scope
);
}
else
{
if
(
with_barrier
)
{
if
(
with_barrier
)
{
std
::
vector
<
distributed
::
VarHandlePtr
>
rets
;
std
::
vector
<
distributed
::
VarHandlePtr
>
rets
;
for
(
size_t
i
=
0
;
i
<
outs
.
size
();
i
++
)
{
for
(
size_t
i
=
0
;
i
<
outs
.
size
();
i
++
)
{
...
@@ -76,6 +89,7 @@ class RecvOp : public framework::OperatorBase {
...
@@ -76,6 +89,7 @@ class RecvOp : public framework::OperatorBase {
}
}
}
}
}
}
}
};
};
class
RecvOpMaker
:
public
framework
::
OpProtoAndCheckerMaker
{
class
RecvOpMaker
:
public
framework
::
OpProtoAndCheckerMaker
{
...
...
python/paddle/fluid/transpiler/distribute_transpiler.py
浏览文件 @
fbd186bd
...
@@ -519,12 +519,20 @@ class DistributeTranspiler(object):
...
@@ -519,12 +519,20 @@ class DistributeTranspiler(object):
param_varname
,
height_sections
,
eps
,
table_names
)
param_varname
,
height_sections
,
eps
,
table_names
)
else
:
else
:
all_recv_outputs
.
extend
(
splited_var
)
all_recv_outputs
.
extend
(
splited_var
)
recv_varnames
=
[]
if
self
.
config
.
runtime_split_send_recv
:
orig_param
=
program
.
global_block
().
vars
[
param_varname
]
recv_varnames
=
[
var
.
name
for
var
in
splited_vars
]
splited_var
=
[
orig_param
]
program
.
global_block
().
append_op
(
program
.
global_block
().
append_op
(
type
=
"recv"
,
type
=
"recv"
,
inputs
=
{
"X"
:
[
recv_dep_in
]},
inputs
=
{
"X"
:
[
recv_dep_in
]},
outputs
=
{
"Out"
:
splited_var
},
outputs
=
{
"Out"
:
splited_var
},
attrs
=
{
attrs
=
{
"epmap"
:
eps
,
"epmap"
:
eps
,
"recv_varnames"
:
recv_varnames
,
"trainer_id"
:
self
.
trainer_id
,
"trainer_id"
:
self
.
trainer_id
,
RPC_OP_ROLE_ATTR_NAME
:
RPC_OP_ROLE_ATTR_VALUE
,
RPC_OP_ROLE_ATTR_NAME
:
RPC_OP_ROLE_ATTR_VALUE
,
OP_ROLE_VAR_ATTR_NAME
:
OP_ROLE_VAR_ATTR_NAME
:
...
@@ -549,6 +557,7 @@ class DistributeTranspiler(object):
...
@@ -549,6 +557,7 @@ class DistributeTranspiler(object):
continue
continue
orig_param
=
program
.
global_block
().
vars
[
param_varname
]
orig_param
=
program
.
global_block
().
vars
[
param_varname
]
if
param_varname
not
in
self
.
sparse_param_to_height_sections
:
if
param_varname
not
in
self
.
sparse_param_to_height_sections
:
if
not
self
.
config
.
runtime_split_send_recv
:
program
.
global_block
().
append_op
(
program
.
global_block
().
append_op
(
type
=
"concat"
,
type
=
"concat"
,
inputs
=
{
"X"
:
splited_var
},
inputs
=
{
"X"
:
splited_var
},
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录