Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
ee178d5a
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看板
提交
ee178d5a
编写于
4月 10, 2018
作者:
J
JiayiFeng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix bugs
上级
fe48dfcb
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
12 addition
and
20 deletion
+12
-20
paddle/fluid/framework/parallel_executor.cc
paddle/fluid/framework/parallel_executor.cc
+1
-3
paddle/fluid/operators/read_op.cc
paddle/fluid/operators/read_op.cc
+0
-7
paddle/fluid/operators/reader/create_threaded_reader_op.cc
paddle/fluid/operators/reader/create_threaded_reader_op.cc
+4
-4
python/paddle/fluid/layers/io.py
python/paddle/fluid/layers/io.py
+7
-6
未找到文件。
paddle/fluid/framework/parallel_executor.cc
浏览文件 @
ee178d5a
...
...
@@ -115,14 +115,12 @@ void ParallelExecutor::BCastParamsToGPUs(
for
(
auto
&
var
:
vars
)
{
auto
*
main_var
=
main_scope
->
FindVar
(
var
);
if
(
!
main_var
->
IsType
<
LoDTensor
>
())
{
if
(
main_var
==
nullptr
||
!
main_var
->
IsType
<
LoDTensor
>
())
{
continue
;
}
auto
&
main_tensor
=
main_var
->
Get
<
LoDTensor
>
();
auto
&
dims
=
main_tensor
.
dims
();
if
(
paddle
::
platform
::
is_gpu_place
(
main_tensor
.
place
()))
{
size_t
numel
=
main_tensor
.
numel
();
ncclDataType_t
data_type
=
platform
::
ToNCCLDataType
(
main_tensor
.
type
());
...
...
paddle/fluid/operators/read_op.cc
浏览文件 @
ee178d5a
...
...
@@ -66,13 +66,6 @@ class ReadOp : public framework::OperatorBase {
std
::
vector
<
std
::
string
>
out_arg_names
=
Outputs
(
"Out"
);
std
::
vector
<
framework
::
LoDTensor
>
ins
;
reader
->
ReadNext
(
&
ins
);
if
(
ins
.
empty
())
{
reader
->
ReInit
();
reader
->
ReadNext
(
&
ins
);
PADDLE_ENFORCE
(
!
ins
.
empty
(),
"Reader can not read the next data even it has been re-initialized."
);
}
PADDLE_ENFORCE_EQ
(
ins
.
size
(),
out_arg_names
.
size
());
for
(
size_t
i
=
0
;
i
<
ins
.
size
();
++
i
)
{
auto
*
out
=
...
...
paddle/fluid/operators/reader/create_threaded_reader_op.cc
浏览文件 @
ee178d5a
...
...
@@ -111,7 +111,7 @@ class CreateThreadedReaderOpMaker : public DecoratedReaderMakerBase {
"When 'unsafe_mode' is false, invoking 'HasNext()' or "
"'ReInit()' is not allowed to avoid unexpected bugs in "
"multi-thread environment."
)
.
SetDefault
(
fals
e
);
.
SetDefault
(
tru
e
);
AddComment
(
R"DOC(
CreateThreadedReader Operator
...
...
@@ -134,6 +134,6 @@ class CreateThreadedReaderOpMaker : public DecoratedReaderMakerBase {
}
// namespace paddle
namespace
reader
=
paddle
::
operators
::
reader
;
REGISTER_
FILE
_READER_OPERATOR
(
create_threaded_reader
,
reader
::
CreateThreadedReaderOp
,
reader
::
CreateThreadedReaderOpMaker
);
REGISTER_
DECORATED
_READER_OPERATOR
(
create_threaded_reader
,
reader
::
CreateThreadedReaderOp
,
reader
::
CreateThreadedReaderOpMaker
);
python/paddle/fluid/layers/io.py
浏览文件 @
ee178d5a
...
...
@@ -350,7 +350,7 @@ def open_recordio_file(filename,
main_prog_var
=
multi_pass
(
reader
=
main_prog_var
,
pass_num
=
pass_num
)
if
for_parallel
:
main_prog_var
=
for_parallel
(
reader
=
main_prog_var
)
main_prog_var
=
parallelize
(
reader
=
main_prog_var
)
return
monkey_patch_reader_methods
(
main_prog_var
)
...
...
@@ -435,12 +435,12 @@ def open_files(filenames,
reader
=
main_prog_reader
,
pass_num
=
pass_num
)
if
for_parallel
:
main_prog_reader
=
for_parallel
(
reader
=
main_prog_reader
)
main_prog_reader
=
parallelize
(
reader
=
main_prog_reader
)
return
monkey_patch_reader_methods
(
main_prog_reader
)
def
__create_
unshared_decorated_reader__
(
op_type
,
reader
,
attrs
=
{}
):
def
__create_
shared_decorated_reader__
(
op_type
,
reader
,
attrs
):
var_name
=
unique_name
(
op_type
)
startup_blk
=
default_startup_program
().
current_block
()
startup_var
=
startup_blk
.
create_var
(
name
=
var_name
)
...
...
@@ -456,7 +456,7 @@ def __create_unshared_decorated_reader__(op_type, reader, attrs={}):
return
monkey_patch_reader_methods
(
main_prog_var
)
def
__create_
shared_decorated_reader__
(
op_type
,
reader
,
attrs
=
{}
):
def
__create_
unshared_decorated_reader__
(
op_type
,
reader
,
attrs
):
new_reader_name
=
unique_name
(
op_type
)
main_blk
=
default_main_program
().
current_block
()
new_reader
=
main_blk
.
create_var
(
name
=
new_reader_name
)
...
...
@@ -488,8 +488,9 @@ def multi_pass(reader, pass_num):
'create_multi_pass_reader'
,
reader
,
{
'pass_num'
:
int
(
pass_num
)})
def
for_parallel
(
reader
):
return
__create_shared_decorated_reader__
(
'create_threaded_reader'
,
reader
)
def
parallelize
(
reader
):
return
__create_shared_decorated_reader__
(
'create_threaded_reader'
,
reader
,
{})
def
read_file
(
file_obj
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录