Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
94c80347
P
PaddleDetection
项目概览
PaddlePaddle
/
PaddleDetection
大约 1 年 前同步成功
通知
695
Star
11112
Fork
2696
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
184
列表
看板
标记
里程碑
合并请求
40
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
184
Issue
184
列表
看板
标记
里程碑
合并请求
40
合并请求
40
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
94c80347
编写于
1月 02, 2019
作者:
Y
Yancey1989
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update by comment
上级
af91444c
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
9 addition
and
8 deletion
+9
-8
paddle/fluid/framework/details/parallel_ssa_graph_executor.cc
...le/fluid/framework/details/parallel_ssa_graph_executor.cc
+6
-6
paddle/fluid/framework/parallel_executor.cc
paddle/fluid/framework/parallel_executor.cc
+3
-2
未找到文件。
paddle/fluid/framework/details/parallel_ssa_graph_executor.cc
浏览文件 @
94c80347
...
@@ -34,7 +34,7 @@ ParallelSSAGraphExecutor::ParallelSSAGraphExecutor(
...
@@ -34,7 +34,7 @@ ParallelSSAGraphExecutor::ParallelSSAGraphExecutor(
?
1UL
?
1UL
:
strategy_
.
num_threads_
/
places_
.
size
();
:
strategy_
.
num_threads_
/
places_
.
size
();
VLOG
(
1
)
<<
"set num_threads: "
<<
strategy_
.
num_threads_
VLOG
(
1
)
<<
"set num_threads: "
<<
strategy_
.
num_threads_
<<
" to
schedule operators
on each device."
;
<<
" to
run the operators of the graph
on each device."
;
for
(
size_t
i
=
0
;
i
<
places
.
size
();
++
i
)
{
for
(
size_t
i
=
0
;
i
<
places
.
size
();
++
i
)
{
executors_
.
emplace_back
(
new
details
::
ThreadedSSAGraphExecutor
(
executors_
.
emplace_back
(
new
details
::
ThreadedSSAGraphExecutor
(
strategy_
,
{
local_scopes_
[
i
]},
{
places_
[
i
]},
std
::
move
(
graphs_
[
i
])));
strategy_
,
{
local_scopes_
[
i
]},
{
places_
[
i
]},
std
::
move
(
graphs_
[
i
])));
...
@@ -45,10 +45,10 @@ FeedFetchList ParallelSSAGraphExecutor::Run(
...
@@ -45,10 +45,10 @@ FeedFetchList ParallelSSAGraphExecutor::Run(
const
std
::
vector
<
std
::
string
>
&
fetch_tensors
)
{
const
std
::
vector
<
std
::
string
>
&
fetch_tensors
)
{
std
::
vector
<
std
::
future
<
FeedFetchList
>>
run_futures
;
std
::
vector
<
std
::
future
<
FeedFetchList
>>
run_futures
;
std
::
vector
<
FeedFetchList
>
fetch_data
s
;
std
::
vector
<
FeedFetchList
>
fetch_data
;
FeedFetchList
ret
;
FeedFetchList
ret
;
fetch_data
s
.
reserve
(
places_
.
size
());
fetch_data
.
reserve
(
places_
.
size
());
ret
.
reserve
(
fetch_tensors
.
size
());
ret
.
reserve
(
fetch_tensors
.
size
());
exception_holder_
.
Clear
();
exception_holder_
.
Clear
();
...
@@ -65,7 +65,7 @@ FeedFetchList ParallelSSAGraphExecutor::Run(
...
@@ -65,7 +65,7 @@ FeedFetchList ParallelSSAGraphExecutor::Run(
if
(
pool_
)
{
if
(
pool_
)
{
run_futures
.
emplace_back
(
pool_
->
enqueue
(
std
::
move
(
call
)));
run_futures
.
emplace_back
(
pool_
->
enqueue
(
std
::
move
(
call
)));
}
else
{
}
else
{
fetch_data
s
.
emplace_back
(
std
::
move
(
call
()));
fetch_data
.
emplace_back
(
std
::
move
(
call
()));
}
}
}
}
...
@@ -74,7 +74,7 @@ FeedFetchList ParallelSSAGraphExecutor::Run(
...
@@ -74,7 +74,7 @@ FeedFetchList ParallelSSAGraphExecutor::Run(
if
(
exception_holder_
.
IsCaught
())
{
if
(
exception_holder_
.
IsCaught
())
{
f
.
wait
();
f
.
wait
();
}
else
{
}
else
{
fetch_data
s
.
emplace_back
(
std
::
move
(
f
.
get
()));
fetch_data
.
emplace_back
(
std
::
move
(
f
.
get
()));
}
}
}
}
}
}
...
@@ -86,7 +86,7 @@ FeedFetchList ParallelSSAGraphExecutor::Run(
...
@@ -86,7 +86,7 @@ FeedFetchList ParallelSSAGraphExecutor::Run(
std
::
vector
<
const
LoDTensor
*>
lodtensor_ptrs
;
std
::
vector
<
const
LoDTensor
*>
lodtensor_ptrs
;
lodtensor_ptrs
.
reserve
(
local_scopes_
.
size
());
lodtensor_ptrs
.
reserve
(
local_scopes_
.
size
());
for
(
size_t
scope_idx
=
0
;
scope_idx
<
local_scopes_
.
size
();
++
scope_idx
)
{
for
(
size_t
scope_idx
=
0
;
scope_idx
<
local_scopes_
.
size
();
++
scope_idx
)
{
lodtensor_ptrs
.
push_back
(
&
fetch_data
s
.
at
(
scope_idx
).
at
(
fetch_idx
));
lodtensor_ptrs
.
push_back
(
&
fetch_data
.
at
(
scope_idx
).
at
(
fetch_idx
));
}
}
ret
.
emplace_back
();
ret
.
emplace_back
();
ret
.
back
().
MergeLoDTensor
(
lodtensor_ptrs
,
platform
::
CPUPlace
());
ret
.
back
().
MergeLoDTensor
(
lodtensor_ptrs
,
platform
::
CPUPlace
());
...
...
paddle/fluid/framework/parallel_executor.cc
浏览文件 @
94c80347
...
@@ -469,8 +469,9 @@ void ParallelExecutor::FeedAndSplitTensorIntoLocalScopes(
...
@@ -469,8 +469,9 @@ void ParallelExecutor::FeedAndSplitTensorIntoLocalScopes(
bool
ParallelExecutor
::
EnableParallelGraphExecution
(
bool
ParallelExecutor
::
EnableParallelGraphExecution
(
const
ProgramDesc
&
main_program
,
const
ExecutionStrategy
&
exec_strategy
,
const
ProgramDesc
&
main_program
,
const
ExecutionStrategy
&
exec_strategy
,
const
BuildStrategy
&
build_strategy
)
const
{
const
BuildStrategy
&
build_strategy
)
const
{
bool
enable_parallel_graph
=
tru
e
;
if
(
!
FLAGS_enable_parallel_graph
)
return
fals
e
;
bool
enable_parallel_graph
=
true
;
// TODO(Yancey1989): support sparse update in ParallelGraph mode.
// TODO(Yancey1989): support sparse update in ParallelGraph mode.
for
(
auto
&
var_desc
:
main_program
.
Block
(
0
).
AllVars
())
{
for
(
auto
&
var_desc
:
main_program
.
Block
(
0
).
AllVars
())
{
if
(
var_desc
->
GetType
()
==
proto
::
VarType
::
SELECTED_ROWS
)
{
if
(
var_desc
->
GetType
()
==
proto
::
VarType
::
SELECTED_ROWS
)
{
...
@@ -492,7 +493,7 @@ bool ParallelExecutor::EnableParallelGraphExecution(
...
@@ -492,7 +493,7 @@ bool ParallelExecutor::EnableParallelGraphExecution(
if
(
build_strategy
.
enable_sequential_execution_
||
if
(
build_strategy
.
enable_sequential_execution_
||
exec_strategy
.
type_
==
ExecutionStrategy
::
ExecutorType
::
kExperimental
)
exec_strategy
.
type_
==
ExecutionStrategy
::
ExecutorType
::
kExperimental
)
enable_parallel_graph
=
false
;
enable_parallel_graph
=
false
;
return
enable_parallel_graph
&&
FLAGS_enable_parallel_graph
;
return
enable_parallel_graph
;
}
}
ParallelExecutor
::~
ParallelExecutor
()
{
ParallelExecutor
::~
ParallelExecutor
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录