Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
1ac0989a
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看板
提交
1ac0989a
编写于
11月 21, 2018
作者:
B
barrierye
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'async_executor' of
https://github.com/wangguibao/Paddle
into async_executor
上级
9598ebf8
c66e486a
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
22 addition
and
2 deletion
+22
-2
paddle/fluid/framework/data_feed.cc
paddle/fluid/framework/data_feed.cc
+1
-1
paddle/fluid/framework/executor_thread_worker.cc
paddle/fluid/framework/executor_thread_worker.cc
+7
-0
python/paddle/fluid/async_executor.py
python/paddle/fluid/async_executor.py
+14
-1
未找到文件。
paddle/fluid/framework/data_feed.cc
浏览文件 @
1ac0989a
...
@@ -98,7 +98,6 @@ void DataFeed::CheckStart() {
...
@@ -98,7 +98,6 @@ void DataFeed::CheckStart() {
template
<
typename
T
>
template
<
typename
T
>
void
PrivateQueueDataFeed
<
T
>::
SetQueueSize
(
int
queue_size
)
{
void
PrivateQueueDataFeed
<
T
>::
SetQueueSize
(
int
queue_size
)
{
CheckInit
();
if
(
queue_size
<=
0
)
{
if
(
queue_size
<=
0
)
{
LOG
(
ERROR
)
<<
"error: illegal queue size: "
<<
queue_size
;
LOG
(
ERROR
)
<<
"error: illegal queue size: "
<<
queue_size
;
return
;
return
;
...
@@ -165,6 +164,7 @@ void MultiSlotDataFeed::Init(paddle::framework::DataFeedDesc& data_feed_desc) {
...
@@ -165,6 +164,7 @@ void MultiSlotDataFeed::Init(paddle::framework::DataFeedDesc& data_feed_desc) {
}
}
paddle
::
framework
::
MultiSlotDesc
multi_slot_desc
=
data_feed_desc
.
multi_slot_desc
();
paddle
::
framework
::
MultiSlotDesc
multi_slot_desc
=
data_feed_desc
.
multi_slot_desc
();
SetBatchSize
(
data_feed_desc
.
batch
());
SetBatchSize
(
data_feed_desc
.
batch
());
SetQueueSize
(
data_feed_desc
.
batch
());
size_t
all_slot_num
=
multi_slot_desc
.
slots_size
();
size_t
all_slot_num
=
multi_slot_desc
.
slots_size
();
all_slots_
.
resize
(
all_slot_num
);
all_slots_
.
resize
(
all_slot_num
);
all_slots_type_
.
resize
(
all_slot_num
);
all_slots_type_
.
resize
(
all_slot_num
);
...
...
paddle/fluid/framework/executor_thread_worker.cc
浏览文件 @
1ac0989a
...
@@ -176,6 +176,7 @@ void ExecutorThreadWorker::TrainFiles() {
...
@@ -176,6 +176,7 @@ void ExecutorThreadWorker::TrainFiles() {
thread_reader_
->
Start
();
thread_reader_
->
Start
();
int
cur_batch
;
int
cur_batch
;
int
batch_cnt
=
0
;
while
((
cur_batch
=
thread_reader_
->
Next
())
>
0
)
{
while
((
cur_batch
=
thread_reader_
->
Next
())
>
0
)
{
// executor run here
// executor run here
for
(
auto
&
op
:
ops_
)
{
for
(
auto
&
op
:
ops_
)
{
...
@@ -190,8 +191,14 @@ void ExecutorThreadWorker::TrainFiles() {
...
@@ -190,8 +191,14 @@ void ExecutorThreadWorker::TrainFiles() {
fetch_values_
[
i
]
+=
avg_inspect
;
fetch_values_
[
i
]
+=
avg_inspect
;
}
}
++
batch_cnt
;
thread_scope_
->
DropKids
();
thread_scope_
->
DropKids
();
}
}
for
(
int
i
=
0
;
i
<
fetch_var_num
;
++
i
)
{
fetch_values_
[
i
]
=
fetch_values_
[
i
]
/
batch_cnt
;
}
}
}
void
ExecutorThreadWorker
::
SetThreadId
(
int
tid
)
{
void
ExecutorThreadWorker
::
SetThreadId
(
int
tid
)
{
...
...
python/paddle/fluid/async_executor.py
浏览文件 @
1ac0989a
...
@@ -19,7 +19,7 @@ import contextlib
...
@@ -19,7 +19,7 @@ import contextlib
import
six
import
six
from
.framework
import
Program
,
default_main_program
,
Variable
from
.framework
import
Program
,
default_main_program
,
Variable
from
.
import
core
from
.
import
core
from
.executor
import
global_scope
from
.executor
import
global_scope
,
Executor
from
paddle.fluid.proto
import
data_feed_pb2
from
paddle.fluid.proto
import
data_feed_pb2
from
google.protobuf
import
text_format
from
google.protobuf
import
text_format
...
@@ -75,6 +75,19 @@ class AsyncExecutor(object):
...
@@ -75,6 +75,19 @@ class AsyncExecutor(object):
scope
=
global_scope
()
scope
=
global_scope
()
self
.
executor
=
core
.
AsyncExecutor
(
scope
,
p
)
self
.
executor
=
core
.
AsyncExecutor
(
scope
,
p
)
def
run_startup_program
(
self
,
program
=
None
,
place
=
None
):
if
program
is
None
:
program
=
fluid
.
default_startup_program
()
if
place
is
None
:
place
=
core
.
CPUPlace
()
if
not
isinstance
(
place
,
core
.
CPUPlace
):
raise
ValueError
(
"AsyncExecutor only supports CPU device"
)
executor
=
Executor
(
place
)
executor
.
run
(
program
)
def
run
(
self
,
program
,
data_feed
,
filelist
,
thread_num
,
fetch
):
def
run
(
self
,
program
,
data_feed
,
filelist
,
thread_num
,
fetch
):
"""
"""
Run program by this Executor. Feed data by feed map, fetch result by fetch_list.
Run program by this Executor. Feed data by feed map, fetch result by fetch_list.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录