Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
23eb8c42
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看板
提交
23eb8c42
编写于
12月 13, 2018
作者:
Y
Yancey1989
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix ci test=develop
上级
106e2852
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
26 addition
and
9 deletion
+26
-9
paddle/fluid/framework/details/multi_devices_graph_pass.cc
paddle/fluid/framework/details/multi_devices_graph_pass.cc
+7
-3
paddle/fluid/operators/reader/ctr_reader.h
paddle/fluid/operators/reader/ctr_reader.h
+1
-1
paddle/fluid/pybind/pybind.cc
paddle/fluid/pybind/pybind.cc
+12
-1
python/paddle/fluid/tests/unittests/test_parallel_executor_dry_run.py
...e/fluid/tests/unittests/test_parallel_executor_dry_run.py
+6
-4
未找到文件。
paddle/fluid/framework/details/multi_devices_graph_pass.cc
浏览文件 @
23eb8c42
...
@@ -386,12 +386,16 @@ std::unique_ptr<ir::Graph> MultiDevSSAGraphBuilder::ApplyImpl(
...
@@ -386,12 +386,16 @@ std::unique_ptr<ir::Graph> MultiDevSSAGraphBuilder::ApplyImpl(
CreateComputationalOps
(
&
result
,
node
,
places_
.
size
());
CreateComputationalOps
(
&
result
,
node
,
places_
.
size
());
}
}
// if (!is_forwarding && (places_.size() > 1 || num_trainers > 1)) {
// insert synchronous ops at the backpropagation; and
// insert synchronous ops at the backpropagation; and
// insert synchronous ops if the graph contains mutilple places.
// insert synchronous ops if the graph contains mutilple places.
#if defined(PADDLE_WITH_CUDA) && !defined(_WIN32)
if
(
!
is_forwarding
&&
if
(
!
is_forwarding
&&
(
places_
.
size
()
>
1
||
num_trainers
>
1
||
(
places_
.
size
()
>
1
||
num_trainers
>
1
||
(
nccl_ctxs_
&&
nccl_ctxs_
->
contexts_
.
size
()
>
1
)))
{
(
nccl_ctxs_
&&
nccl_ctxs_
->
contexts_
.
size
()
>
1
)))
{
#else
if
(
!
is_forwarding
&&
(
places_
.
size
()
>
1
||
num_trainers
>
1
))
{
#endif
// Currently, we assume that once gradient is generated, it can be
// Currently, we assume that once gradient is generated, it can be
// broadcast, and each gradient is only broadcast once.
// broadcast, and each gradient is only broadcast once.
if
(
static_cast
<
bool
>
(
boost
::
get
<
int
>
(
node
->
Op
()
->
GetAttr
(
if
(
static_cast
<
bool
>
(
boost
::
get
<
int
>
(
node
->
Op
()
->
GetAttr
(
...
...
paddle/fluid/operators/reader/ctr_reader.h
浏览文件 @
23eb8c42
...
@@ -95,7 +95,7 @@ class CTRReader : public framework::FileReader {
...
@@ -95,7 +95,7 @@ class CTRReader : public framework::FileReader {
queue_
->
ReOpen
();
queue_
->
ReOpen
();
VLOG
(
3
)
<<
"reopen success"
;
VLOG
(
3
)
<<
"reopen success"
;
VLOG
(
3
)
<<
"thread_num "
<<
thread_num_
;
VLOG
(
3
)
<<
"thread_num "
<<
thread_num_
;
for
(
in
t
thread_id
=
0
;
thread_id
<
thread_num_
;
thread_id
++
)
{
for
(
size_
t
thread_id
=
0
;
thread_id
<
thread_num_
;
thread_id
++
)
{
read_threads_
.
emplace_back
(
new
std
::
thread
(
read_threads_
.
emplace_back
(
new
std
::
thread
(
std
::
bind
(
&
ReadThread
,
file_groups_
[
thread_id
],
slots_
,
batch_size_
,
std
::
bind
(
&
ReadThread
,
file_groups_
[
thread_id
],
slots_
,
batch_size_
,
thread_id
,
&
read_thread_status_
,
queue_
)));
thread_id
,
&
read_thread_status_
,
queue_
)));
...
...
paddle/fluid/pybind/pybind.cc
浏览文件 @
23eb8c42
...
@@ -789,7 +789,18 @@ All parameter, weight, gradient are variables in Paddle.
...
@@ -789,7 +789,18 @@ All parameter, weight, gradient are variables in Paddle.
[](
ExecutionStrategy
&
self
,
ExecutionStrategy
::
ExecutorType
type
)
{
[](
ExecutionStrategy
&
self
,
ExecutionStrategy
::
ExecutorType
type
)
{
self
.
type_
=
type
;
self
.
type_
=
type
;
},
},
R"DOC()DOC"
);
R"DOC(The type is ExecutorType which is the enum ranging from Default,
ParallelGraph and Experiment:
Default: Compile the main_program into a multi-devices graph,
and execute this graph on multi-devices with multiple threads which
specified by build_strategy.num_threads.
ParallelGraph: Compile the main_program into multiple graphs, and execute each of the graphs on one
device with one thread. Please note, this mode only supports all-reduce mode and use_cuda=True.
This approach can achieve better performance in some scenarios.
Experimental: Compile the main_program into a multi-devices graph,
and executor this graph with a faster execution mode than the Default,
this approach is on the experiments.)DOC"
);
py
::
class_
<
BuildStrategy
>
build_strategy
(
pe
,
"BuildStrategy"
,
R"DOC(
py
::
class_
<
BuildStrategy
>
build_strategy
(
pe
,
"BuildStrategy"
,
R"DOC(
BuildStrategy allows the user to more preciously control how to
BuildStrategy allows the user to more preciously control how to
...
...
python/paddle/fluid/tests/unittests/test_parallel_executor_dry_run.py
浏览文件 @
23eb8c42
...
@@ -17,6 +17,8 @@ import unittest
...
@@ -17,6 +17,8 @@ import unittest
import
logging
import
logging
import
six
import
six
ExecutorType
=
fluid
.
ExecutionStrategy
().
ExecutorType
class
TestBase
(
unittest
.
TestCase
):
class
TestBase
(
unittest
.
TestCase
):
def
main
(
self
,
def
main
(
self
,
...
@@ -24,7 +26,7 @@ class TestBase(unittest.TestCase):
...
@@ -24,7 +26,7 @@ class TestBase(unittest.TestCase):
iter
=
10
,
iter
=
10
,
iter_per_pe
=
10
,
iter_per_pe
=
10
,
use_gpu
=
True
,
use_gpu
=
True
,
use_experimental_executor
=
False
):
exec_type
=
ExecutorType
.
Default
):
if
use_gpu
and
not
fluid
.
core
.
is_compiled_with_cuda
():
if
use_gpu
and
not
fluid
.
core
.
is_compiled_with_cuda
():
logging
.
warning
(
logging
.
warning
(
"Paddle is not compiled with CUDA, skip GPU unittests"
)
"Paddle is not compiled with CUDA, skip GPU unittests"
)
...
@@ -43,7 +45,7 @@ class TestBase(unittest.TestCase):
...
@@ -43,7 +45,7 @@ class TestBase(unittest.TestCase):
for
_
in
six
.
moves
.
xrange
(
iter
):
for
_
in
six
.
moves
.
xrange
(
iter
):
exe_strategy
=
fluid
.
ExecutionStrategy
()
exe_strategy
=
fluid
.
ExecutionStrategy
()
exe_strategy
.
_dry_run
=
True
exe_strategy
.
_dry_run
=
True
exe_strategy
.
use_experimental_executor
=
use_experimental_executor
exe_strategy
.
executor_type
=
exec_type
pe
=
fluid
.
ParallelExecutor
(
pe
=
fluid
.
ParallelExecutor
(
use_cuda
=
use_gpu
,
use_cuda
=
use_gpu
,
loss_name
=
loss
.
name
,
loss_name
=
loss
.
name
,
...
@@ -56,11 +58,11 @@ class TestBase(unittest.TestCase):
...
@@ -56,11 +58,11 @@ class TestBase(unittest.TestCase):
class
TestMNISTDryRun
(
TestBase
):
class
TestMNISTDryRun
(
TestBase
):
def
test_mnist_dry_run
(
self
):
def
test_mnist_dry_run
(
self
):
for
use_gpu
in
(
False
,
True
):
for
use_gpu
in
(
False
,
True
):
for
use_experimental_executor
in
(
False
,
True
):
for
exec_type
in
(
ExecutorType
.
Default
,
ExecutorType
.
Experimental
):
self
.
main
(
self
.
main
(
network_func
=
TestMNISTDryRun
.
network_func
,
network_func
=
TestMNISTDryRun
.
network_func
,
use_gpu
=
use_gpu
,
use_gpu
=
use_gpu
,
use_experimental_executor
=
use_experimental_executor
)
exec_type
=
exec_type
)
@
staticmethod
@
staticmethod
def
network_func
():
def
network_func
():
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录