Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
24fa8eb6
P
Paddle
项目概览
PaddlePaddle
/
Paddle
1 年多 前同步成功
通知
2302
Star
20931
Fork
5422
代码
文件
提交
分支
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看板
提交
24fa8eb6
编写于
10月 25, 2018
作者:
W
wangguibao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rename MultiExecutor to AsyncExecutor
上级
929a9e80
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
21 addition
and
21 deletion
+21
-21
paddle/fluid/framework/async_executor.cc
paddle/fluid/framework/async_executor.cc
+17
-17
paddle/fluid/framework/async_executor.h
paddle/fluid/framework/async_executor.h
+4
-4
未找到文件。
paddle/fluid/framework/async_executor.cc
浏览文件 @
24fa8eb6
...
...
@@ -397,25 +397,25 @@ void ExecutorThreadWorker::SetMaxTrainingEpoch(int max_epoch) {
max_epoch_
=
max_epoch
;
}
MultiExecutor
::
Multi
Executor
(
const
platform
::
Place
&
place
)
:
place_
(
place
)
{}
AsyncExecutor
::
Async
Executor
(
const
platform
::
Place
&
place
)
:
place_
(
place
)
{}
void
Multi
Executor
::
InitRootScope
(
Scope
*
scope
)
{
void
Async
Executor
::
InitRootScope
(
Scope
*
scope
)
{
root_scope_
=
scope
;
}
void
Multi
Executor
::
SetMaxTrainingEpoch
(
int
max_epoch
)
{
void
Async
Executor
::
SetMaxTrainingEpoch
(
int
max_epoch
)
{
max_epoch_
=
max_epoch
;
}
void
Multi
Executor
::
SetDataFeedName
(
const
char
*
feedname
)
{
void
Async
Executor
::
SetDataFeedName
(
const
char
*
feedname
)
{
feed_name_
=
std
::
string
(
feedname
);
}
void
Multi
Executor
::
SetModelPrefix
(
const
std
::
string
&
model_prefix
)
{
void
Async
Executor
::
SetModelPrefix
(
const
std
::
string
&
model_prefix
)
{
model_prefix_
=
model_prefix
;
}
void
Multi
Executor
::
RunStartupProgram
(
const
ProgramDesc
&
program
,
void
Async
Executor
::
RunStartupProgram
(
const
ProgramDesc
&
program
,
Scope
*
scope
)
{
auto
&
block
=
program
.
Block
(
0
);
for
(
auto
&
var
:
block
.
AllVars
())
{
...
...
@@ -456,7 +456,7 @@ void MultiExecutor::RunStartupProgram(const ProgramDesc& program,
// LOGERR("run startup program done.");
}
std
::
unique_ptr
<
ProgramDesc
>
Multi
Executor
::
LoadDescFromFile
(
std
::
unique_ptr
<
ProgramDesc
>
Async
Executor
::
LoadDescFromFile
(
const
std
::
string
&
f
)
{
std
::
string
program_desc_str
;
read_binary_file
(
f
,
&
program_desc_str
);
...
...
@@ -464,7 +464,7 @@ std::unique_ptr<ProgramDesc> MultiExecutor::LoadDescFromFile(
return
program
;
}
void
Multi
Executor
::
SetDenseCommTensor
(
void
Async
Executor
::
SetDenseCommTensor
(
const
std
::
vector
<
std
::
string
>&
dense_comm_tensor
)
{
dense_comm_tensor_
.
resize
(
dense_comm_tensor
.
size
());
for
(
unsigned
int
i
=
0
;
i
<
dense_comm_tensor
.
size
();
++
i
)
{
...
...
@@ -472,7 +472,7 @@ void MultiExecutor::SetDenseCommTensor(
}
}
void
Multi
Executor
::
SetSparseCommTensor
(
void
Async
Executor
::
SetSparseCommTensor
(
const
std
::
vector
<
std
::
string
>&
sparse_comm_tensor
)
{
sparse_comm_tensor_
.
resize
(
sparse_comm_tensor
.
size
());
for
(
unsigned
int
i
=
0
;
i
<
sparse_comm_tensor
.
size
();
++
i
)
{
...
...
@@ -480,13 +480,13 @@ void MultiExecutor::SetSparseCommTensor(
}
}
void
Multi
Executor
::
SetSparseCommData
(
void
Async
Executor
::
SetSparseCommData
(
const
std
::
map
<
std
::
string
,
int
>&
sparse_comm_data
)
{
sparse_comm_data_
=
sparse_comm_data
;
LOG
(
INFO
)
<<
"Sparse comm data: "
<<
sparse_comm_data_
.
size
();
}
void
Multi
Executor
::
SetFileList
(
const
char
*
filelist
)
{
void
Async
Executor
::
SetFileList
(
const
char
*
filelist
)
{
filelist_
.
clear
();
std
::
ifstream
fin
(
filelist
);
std
::
string
filename
;
...
...
@@ -497,25 +497,25 @@ void MultiExecutor::SetFileList(const char* filelist) {
fin
.
close
();
}
void
Multi
Executor
::
SetFileList
(
std
::
vector
<
std
::
string
>
tfiles
)
{
void
Async
Executor
::
SetFileList
(
std
::
vector
<
std
::
string
>
tfiles
)
{
filelist_
.
clear
();
filelist_
.
insert
(
filelist_
.
end
(),
tfiles
.
begin
(),
tfiles
.
end
());
return
;
}
void
Multi
Executor
::
SetInspectVarName
(
const
std
::
string
&
inspect_var_name
)
{
void
Async
Executor
::
SetInspectVarName
(
const
std
::
string
&
inspect_var_name
)
{
inspect_var_name_
=
inspect_var_name
;
}
void
Multi
Executor
::
SetParamNames
(
const
std
::
vector
<
std
::
string
>&
param_names
)
{
void
Async
Executor
::
SetParamNames
(
const
std
::
vector
<
std
::
string
>&
param_names
)
{
model_param_names_
=
param_names
;
}
void
Multi
Executor
::
SetThreadNum
(
const
int
thread_num
)
{
void
Async
Executor
::
SetThreadNum
(
const
int
thread_num
)
{
thread_num_
=
thread_num
;
}
void
Multi
Executor
::
PrepareThreads
(
const
ProgramDesc
&
host_program
)
{
void
Async
Executor
::
PrepareThreads
(
const
ProgramDesc
&
host_program
)
{
workers_
.
resize
(
thread_num_
);
for
(
unsigned
i
=
0
;
i
<
thread_num_
;
++
i
)
{
workers_
[
i
].
reset
(
new
ExecutorThreadWorker
);
...
...
@@ -551,7 +551,7 @@ void MultiExecutor::PrepareThreads(const ProgramDesc& host_program) {
}
}
void
MultiExecutor
::
RunMulti
Executor
(
const
ProgramDesc
&
host_program
)
{
void
AsyncExecutor
::
RunAsync
Executor
(
const
ProgramDesc
&
host_program
)
{
// thread binding here?
PrepareThreads
(
host_program
);
for
(
unsigned
i
=
0
;
i
<
thread_num_
;
++
i
)
{
...
...
paddle/fluid/framework/async_executor.h
浏览文件 @
24fa8eb6
...
...
@@ -106,10 +106,10 @@ class ExecutorThreadWorker {
Scope
*
thread_scope_
;
};
class
Multi
Executor
{
class
Async
Executor
{
public:
explicit
Multi
Executor
(
const
platform
::
Place
&
place
);
virtual
~
Multi
Executor
()
{}
explicit
Async
Executor
(
const
platform
::
Place
&
place
);
virtual
~
Async
Executor
()
{}
static
std
::
unique_ptr
<
ProgramDesc
>
LoadDescFromFile
(
const
std
::
string
&
filename
);
void
InitRootScope
(
Scope
*
scope
);
...
...
@@ -139,7 +139,7 @@ class MultiExecutor {
virtual
void
PrepareThreads
(
const
framework
::
ProgramDesc
&
host_program
);
void
RunStartupProgram
(
const
framework
::
ProgramDesc
&
program
,
framework
::
Scope
*
scope
);
void
Run
Multi
Executor
(
const
ProgramDesc
&
host_program
);
void
Run
Async
Executor
(
const
ProgramDesc
&
host_program
);
public:
unsigned
int
thread_num_
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录