Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
dc847f12
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看板
提交
dc847f12
编写于
6月 25, 2018
作者:
T
tangwei12
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
bug fix and code optimize
上级
fb7e4791
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
17 addition
and
18 deletion
+17
-18
paddle/fluid/operators/distributed/request_handler_impl.cc
paddle/fluid/operators/distributed/request_handler_impl.cc
+2
-2
paddle/fluid/operators/listen_and_serv_op.cc
paddle/fluid/operators/listen_and_serv_op.cc
+10
-9
paddle/fluid/operators/save_op.cc
paddle/fluid/operators/save_op.cc
+2
-2
python/paddle/fluid/transpiler/distribute_transpiler.py
python/paddle/fluid/transpiler/distribute_transpiler.py
+3
-5
未找到文件。
paddle/fluid/operators/distributed/request_handler_impl.cc
浏览文件 @
dc847f12
...
@@ -30,7 +30,7 @@ namespace distributed {
...
@@ -30,7 +30,7 @@ namespace distributed {
// define LOOKUP_TABLE_PATH for checkpoint notify to save lookup table variables
// define LOOKUP_TABLE_PATH for checkpoint notify to save lookup table variables
// to directory specified.
// to directory specified.
constexpr
char
LOOKUP_TABLE_PATH
[]
=
"
lookup_table_p
ath"
;
constexpr
char
LOOKUP_TABLE_PATH
[]
=
"
kLookupTableP
ath"
;
bool
RequestSendHandler
::
Handle
(
const
std
::
string
&
varname
,
bool
RequestSendHandler
::
Handle
(
const
std
::
string
&
varname
,
framework
::
Scope
*
scope
,
framework
::
Scope
*
scope
,
...
@@ -136,7 +136,7 @@ bool RequestCheckpointHandler::Handle(const std::string& varname,
...
@@ -136,7 +136,7 @@ bool RequestCheckpointHandler::Handle(const std::string& varname,
auto
*
lt_var
=
scope
->
FindVar
(
LOOKUP_TABLE_PATH
)
->
GetMutable
<
std
::
string
>
();
auto
*
lt_var
=
scope
->
FindVar
(
LOOKUP_TABLE_PATH
)
->
GetMutable
<
std
::
string
>
();
lt_var
->
clear
();
lt_var
->
clear
();
lt_var
->
append
(
out_var_name
);
lt_var
->
append
(
out_var_name
);
VLOG
(
4
)
<<
"RequestCheckpointHandler update var
lookup_table_p
ath to: "
VLOG
(
4
)
<<
"RequestCheckpointHandler update var
kLookupTableP
ath to: "
<<
out_var_name
;
<<
out_var_name
;
executor_
->
RunPreparedContext
(
checkpoint_prepared_ctx_
.
get
(),
scope
);
executor_
->
RunPreparedContext
(
checkpoint_prepared_ctx_
.
get
(),
scope
);
return
true
;
return
true
;
...
...
paddle/fluid/operators/listen_and_serv_op.cc
浏览文件 @
dc847f12
...
@@ -206,7 +206,7 @@ void ListenAndServOp::RunAsyncLoop(framework::Executor *executor,
...
@@ -206,7 +206,7 @@ void ListenAndServOp::RunAsyncLoop(framework::Executor *executor,
VLOG
(
3
)
<<
"RunAsyncLoop into while"
;
VLOG
(
3
)
<<
"RunAsyncLoop into while"
;
while
(
true
)
{
while
(
true
)
{
if
(
rpc_service_
->
IsExit
())
{
if
(
rpc_service_
->
IsExit
())
{
LOG
(
INFO
)
<<
"get exit!rpc_processor break!"
;
VLOG
(
4
)
<<
"get exit!rpc_processor break!"
;
break
;
break
;
}
}
...
@@ -245,11 +245,11 @@ void ListenAndServOp::RunImpl(const framework::Scope &scope,
...
@@ -245,11 +245,11 @@ void ListenAndServOp::RunImpl(const framework::Scope &scope,
PADDLE_ENFORCE
(
!
rpc_service_
);
PADDLE_ENFORCE
(
!
rpc_service_
);
std
::
string
endpoint
=
Attr
<
std
::
string
>
(
"endpoint"
);
std
::
string
endpoint
=
Attr
<
std
::
string
>
(
"endpoint"
);
int
checkpoint_
notify_
block_id
=
Attr
<
int
>
(
kCheckpointBlockId
);
int
checkpoint_block_id
=
Attr
<
int
>
(
kCheckpointBlockId
);
LOG
(
INFO
)
<<
"sync_mode:"
<<
sync_mode
<<
", fan_in:"
<<
fan_in
VLOG
(
4
)
<<
"sync_mode:"
<<
sync_mode
<<
", fan_in:"
<<
fan_in
<<
", end_point:"
<<
endpoint
<<
", end_point:"
<<
endpoint
<<
", CheckpointNotify Id: "
<<
checkpoint_notify
_block_id
;
<<
", checkpoint_block_id: "
<<
checkpoint
_block_id
;
rpc_service_
.
reset
(
new
RPCSERVER_T
(
endpoint
,
fan_in
));
rpc_service_
.
reset
(
new
RPCSERVER_T
(
endpoint
,
fan_in
));
...
@@ -258,7 +258,7 @@ void ListenAndServOp::RunImpl(const framework::Scope &scope,
...
@@ -258,7 +258,7 @@ void ListenAndServOp::RunImpl(const framework::Scope &scope,
request_prefetch_handler_
.
reset
(
request_prefetch_handler_
.
reset
(
new
distributed
::
RequestPrefetchHandler
(
sync_mode
));
new
distributed
::
RequestPrefetchHandler
(
sync_mode
));
request_checkpoint_handler_
.
reset
(
new
distributed
::
RequestCheckpointHandler
(
request_checkpoint_handler_
.
reset
(
new
distributed
::
RequestCheckpointHandler
(
sync_mode
,
checkpoint_
notify_
block_id
));
sync_mode
,
checkpoint_block_id
));
rpc_service_
->
RegisterRPC
(
distributed
::
kRequestSend
,
rpc_service_
->
RegisterRPC
(
distributed
::
kRequestSend
,
request_send_handler_
.
get
());
request_send_handler_
.
get
());
...
@@ -277,8 +277,9 @@ void ListenAndServOp::RunImpl(const framework::Scope &scope,
...
@@ -277,8 +277,9 @@ void ListenAndServOp::RunImpl(const framework::Scope &scope,
framework
::
Executor
executor
(
dev_place
);
framework
::
Executor
executor
(
dev_place
);
std
::
shared_ptr
<
framework
::
ExecutorPrepareContext
>
ckpt_pre_context
=
nullptr
;
std
::
shared_ptr
<
framework
::
ExecutorPrepareContext
>
ckpt_pre_context
=
nullptr
;
if
(
checkpoint_notify_block_id
!=
-
1
)
{
if
(
checkpoint_block_id
!=
-
1
)
{
auto
ctx
=
executor
.
Prepare
(
*
program
,
checkpoint_notify_block_id
);
auto
ctx
=
executor
.
Prepare
(
*
program
,
checkpoint_block_id
);
// see: https://stackoverflow.com/a/14856553
ckpt_pre_context
=
std
::
move
(
ctx
);
ckpt_pre_context
=
std
::
move
(
ctx
);
}
}
...
@@ -335,7 +336,7 @@ void ListenAndServOp::RunImpl(const framework::Scope &scope,
...
@@ -335,7 +336,7 @@ void ListenAndServOp::RunImpl(const framework::Scope &scope,
SavePort
();
SavePort
();
if
(
sync_mode
)
{
if
(
sync_mode
)
{
RunSyncLoop
(
&
executor
,
program
,
&
recv_scope
,
prefetch_block_id_list
,
RunSyncLoop
(
&
executor
,
program
,
&
recv_scope
,
prefetch_block_id_list
,
checkpoint_
notify_
block_id
);
checkpoint_block_id
);
}
else
{
}
else
{
RunAsyncLoop
(
&
executor
,
program
);
RunAsyncLoop
(
&
executor
,
program
);
}
}
...
...
paddle/fluid/operators/save_op.cc
浏览文件 @
dc847f12
...
@@ -31,7 +31,7 @@ namespace operators {
...
@@ -31,7 +31,7 @@ namespace operators {
// define LOOKUP_TABLE_PATH for checkpoint notify to save lookup table variables
// define LOOKUP_TABLE_PATH for checkpoint notify to save lookup table variables
// to directory specified.
// to directory specified.
constexpr
char
LOOKUP_TABLE_PATH
[]
=
"
lookup_table_p
ath"
;
constexpr
char
LOOKUP_TABLE_PATH
[]
=
"
kLookupTableP
ath"
;
// TODO(yuyang18): If the functions below are needed by other files, move them
// TODO(yuyang18): If the functions below are needed by other files, move them
// to paddle::filesystem namespace.
// to paddle::filesystem namespace.
...
@@ -138,7 +138,7 @@ class SaveOp : public framework::OperatorBase {
...
@@ -138,7 +138,7 @@ class SaveOp : public framework::OperatorBase {
auto
*
lt_var
=
scope
.
FindVar
(
LOOKUP_TABLE_PATH
)
->
GetMutable
<
std
::
string
>
();
auto
*
lt_var
=
scope
.
FindVar
(
LOOKUP_TABLE_PATH
)
->
GetMutable
<
std
::
string
>
();
PADDLE_ENFORCE
(
PADDLE_ENFORCE
(
lt_var
!=
nullptr
,
lt_var
!=
nullptr
,
"Can not find variable
lookup_table_p
ath for SaveSelectedRows"
);
"Can not find variable
kLookupTableP
ath for SaveSelectedRows"
);
std
::
string
filename
=
lt_var
->
data
();
std
::
string
filename
=
lt_var
->
data
();
VLOG
(
4
)
<<
"SaveSelectedRows get File name: "
<<
filename
;
VLOG
(
4
)
<<
"SaveSelectedRows get File name: "
<<
filename
;
...
...
python/paddle/fluid/transpiler/distribute_transpiler.py
浏览文件 @
dc847f12
...
@@ -920,19 +920,17 @@ class DistributeTranspiler(object):
...
@@ -920,19 +920,17 @@ class DistributeTranspiler(object):
import
os
import
os
pserver_program
.
global_block
().
create_var
(
pserver_program
.
global_block
().
create_var
(
name
=
"
lookup_table_p
ath"
,
name
=
"
kLookupTableP
ath"
,
persistable
=
True
,
persistable
=
True
,
type
=
core
.
VarDesc
.
VarType
.
RAW
)
type
=
core
.
VarDesc
.
VarType
.
RAW
)
checkpoint_save_block
=
pserver_program
.
create_block
(
pre_block_idx
)
checkpoint_save_block
=
pserver_program
.
create_block
(
pre_block_idx
)
# this 'file_path' do not be used in save lookup table variable
checkpoint_save_block
.
append_op
(
checkpoint_save_block
.
append_op
(
type
=
'save'
,
type
=
'save'
,
inputs
=
{
'X'
:
[
self
.
table_name
]},
inputs
=
{
'X'
:
[
self
.
table_name
]},
outputs
=
{},
outputs
=
{},
attrs
=
{
attrs
=
{
'file_path'
:
""
})
'file_path'
:
"this 'file_path' do not be used in save lookup table variable"
})
return
checkpoint_save_block
.
idx
return
checkpoint_save_block
.
idx
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录