Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
999d9a59
P
Paddle
项目概览
Crayon鑫
/
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看板
未验证
提交
999d9a59
编写于
6月 27, 2019
作者:
T
tangwei12
提交者:
GitHub
6月 27, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix communicator with pyreader (#18350)
* add is_runnning in communicator, test=develop
上级
cff2c2d8
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
38 addition
and
6 deletion
+38
-6
paddle/fluid/framework/details/async_ssa_graph_executor.cc
paddle/fluid/framework/details/async_ssa_graph_executor.cc
+8
-3
paddle/fluid/operators/distributed/communicator.h
paddle/fluid/operators/distributed/communicator.h
+2
-0
paddle/fluid/pybind/communicator_py.cc
paddle/fluid/pybind/communicator_py.cc
+2
-1
python/paddle/fluid/communicator.py
python/paddle/fluid/communicator.py
+18
-0
python/paddle/fluid/incubate/fleet/parameter_server/distribute_transpiler/__init__.py
.../fleet/parameter_server/distribute_transpiler/__init__.py
+8
-2
未找到文件。
paddle/fluid/framework/details/async_ssa_graph_executor.cc
浏览文件 @
999d9a59
...
...
@@ -87,9 +87,14 @@ void ProcessGraph(std::vector<ir::Graph *> graphs, Scope *scope) {
// init communicator here
if
(
send_varname_to_ctx
.
size
()
>
0
)
{
VLOG
(
3
)
<<
"this is distribute mode, will use communicator"
;
operators
::
distributed
::
Communicator
::
Init
(
send_varname_to_ctx
,
recv_varname_to_ctx
,
scope
);
operators
::
distributed
::
Communicator
::
GetInstance
()
->
Start
();
if
(
operators
::
distributed
::
Communicator
::
GetInstance
()
==
nullptr
)
{
operators
::
distributed
::
Communicator
::
Init
(
send_varname_to_ctx
,
recv_varname_to_ctx
,
scope
);
operators
::
distributed
::
Communicator
::
GetInstance
()
->
Start
();
}
else
{
VLOG
(
3
)
<<
"communicator has been initialized, skip"
;
}
}
#endif
}
...
...
paddle/fluid/operators/distributed/communicator.h
浏览文件 @
999d9a59
...
...
@@ -167,6 +167,8 @@ class Communicator {
void
Start
();
void
Stop
();
bool
IsRunning
()
{
return
running_
;
}
// send grad
void
Send
(
const
std
::
string
&
var_name
,
const
framework
::
Scope
&
scope
);
...
...
paddle/fluid/pybind/communicator_py.cc
浏览文件 @
999d9a59
...
...
@@ -40,7 +40,8 @@ void BindCommunicator(py::module* m) {
return
Communicator
::
GetInstantcePtr
();
}))
.
def
(
"stop"
,
&
Communicator
::
Stop
)
.
def
(
"start"
,
&
Communicator
::
Start
);
.
def
(
"start"
,
&
Communicator
::
Start
)
.
def
(
"is_running"
,
&
Communicator
::
IsRunning
);
}
}
// namespace pybind
...
...
python/paddle/fluid/communicator.py
浏览文件 @
999d9a59
...
...
@@ -86,3 +86,21 @@ class Communicator(object):
comm.stop()
"""
self
.
communicator_
.
stop
()
def
is_running
(
self
):
"""
Get communicator is running or stop.
Returns:
bool
Examples:
.. code-block:: python
import paddle.fluid as fluid
prog = fluid.Program()
comm = fluid.communicator.Communicator(prog)
comm.is_running()
"""
self
.
communicator_
.
is_running
()
python/paddle/fluid/incubate/fleet/parameter_server/distribute_transpiler/__init__.py
浏览文件 @
999d9a59
...
...
@@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import
os
import
warnings
import
paddle.fluid.io
as
io
from
paddle.fluid.communicator
import
Communicator
...
...
@@ -53,7 +54,11 @@ class DistributedTranspiler(Fleet):
"""
if
not
self
.
_transpile_config
.
sync_mode
:
self
.
_communicator
=
Communicator
(
self
.
main_program
)
self
.
_communicator
.
start
()
if
not
self
.
_communicator
.
is_running
():
self
.
_communicator
.
start
()
else
:
warnings
.
warn
(
"communicator has been initialized, skip"
)
def
init_server
(
self
,
model_dir
=
None
):
"""
...
...
@@ -104,7 +109,8 @@ class DistributedTranspiler(Fleet):
Returns:
None
"""
if
not
self
.
_transpile_config
.
sync_mode
:
if
not
self
.
_transpile_config
.
sync_mode
and
self
.
_communicator
.
is_running
(
):
self
.
_communicator
.
stop
()
self
.
_executor
.
close
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录