Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
e9a0fbff
P
Paddle
项目概览
BaiXuePrincess
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
e9a0fbff
编写于
9月 17, 2020
作者:
Y
Yi Liu
提交者:
GitHub
9月 17, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
OP报错信息优化 (#27301)
paddle/fluid/operators/distributed_ops OP报错信息优化
上级
da583edf
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
37 addition
and
12 deletion
+37
-12
paddle/fluid/operators/distributed_ops/fake_init_op.cc
paddle/fluid/operators/distributed_ops/fake_init_op.cc
+2
-2
paddle/fluid/operators/distributed_ops/listen_and_serv_op.cc
paddle/fluid/operators/distributed_ops/listen_and_serv_op.cc
+35
-10
未找到文件。
paddle/fluid/operators/distributed_ops/fake_init_op.cc
浏览文件 @
e9a0fbff
...
...
@@ -43,9 +43,9 @@ class FakeInitOp : public framework::OperatorBase {
tensor
=
out_var
.
GetMutable
<
framework
::
SelectedRows
>
()
->
mutable_value
();
tensor
->
Resize
(
framework
::
make_ddim
(
Attr
<
std
::
vector
<
int64_t
>>
(
"shape"
)));
}
else
{
PADDLE_THROW
(
PADDLE_THROW
(
platform
::
errors
::
InvalidArgument
(
"fake init op's output only"
"supports SelectedRows and LoDTensor"
);
"supports SelectedRows and LoDTensor"
)
)
;
}
}
};
...
...
paddle/fluid/operators/distributed_ops/listen_and_serv_op.cc
浏览文件 @
e9a0fbff
...
...
@@ -134,7 +134,10 @@ void ListenAndServOp::RunSyncLoop(
auto
optimize_blocks
=
Attr
<
std
::
vector
<
framework
::
BlockDesc
*>>
(
kOptimizeBlocks
);
PADDLE_ENFORCE_GE
(
num_blocks
,
2
,
"server program should have at least 2 blocks"
);
platform
::
errors
::
PreconditionNotMet
(
"Invalid number of blocks in server program. Expected "
"equal or greater than 2. Recieved %zu"
,
num_blocks
));
// Prepare all the server block
std
::
vector
<
int
>
optimize_blocks_list
;
...
...
@@ -218,7 +221,8 @@ void ListenAndServOp::ResetReceivedVars(framework::Scope *recv_scope,
VLOG
(
3
)
<<
"reset sparse var: "
<<
varname
;
var
->
GetMutable
<
framework
::
SelectedRows
>
()
->
mutable_rows
()
->
clear
();
}
else
{
PADDLE_THROW
(
"The type of sparse var should be SelectedRows"
);
PADDLE_THROW
(
platform
::
errors
::
PreconditionNotMet
(
"The type of sparse var should be SelectedRows"
));
}
}
if
(
UNLIKELY
(
reset_all
))
{
...
...
@@ -235,7 +239,8 @@ void ListenAndServOp::ResetReceivedVars(framework::Scope *recv_scope,
math
::
set_constant
(
*
dev_ctx
,
var
->
GetMutable
<
framework
::
Tensor
>
(),
static_cast
<
float
>
(
0
));
}
else
{
PADDLE_THROW
(
"The type of dense var should be in [LoDTensor, Tensor]"
);
PADDLE_THROW
(
platform
::
errors
::
PreconditionNotMet
(
"The type of dense var should be in [LoDTensor, Tensor]"
));
}
}
}
...
...
@@ -254,8 +259,15 @@ void ListenAndServOp::RunAsyncLoop(framework::Executor *executor,
std
::
vector
<
std
::
string
>
pieces
;
split
(
grad_and_id
,
':'
,
&
pieces
);
VLOG
(
3
)
<<
"after split, key = "
<<
pieces
[
0
]
<<
", id="
<<
pieces
[
1
];
PADDLE_ENFORCE_EQ
(
pieces
.
size
(),
2
);
PADDLE_ENFORCE_EQ
(
out_map
->
count
(
pieces
[
0
]),
0
);
PADDLE_ENFORCE_EQ
(
pieces
.
size
(),
2
,
platform
::
errors
::
PreconditionNotMet
(
"Invalid format of grad_and_id argument. "
"Expected
\"
grad:block_id
\"
. Recieved %s"
,
grad_and_id
.
c_str
()));
PADDLE_ENFORCE_EQ
(
out_map
->
count
(
pieces
[
0
]),
0
,
platform
::
errors
::
AlreadyExists
(
"The gradient name %s has already existed in out_map"
,
pieces
[
0
].
c_str
()));
int
block_id
=
std
::
stoi
(
pieces
[
1
]);
(
*
out_map
)[
pieces
[
0
]]
=
block_id
;
...
...
@@ -267,7 +279,10 @@ void ListenAndServOp::RunAsyncLoop(framework::Executor *executor,
size_t
num_blocks
=
program
->
Size
();
PADDLE_ENFORCE_GE
(
num_blocks
,
2
,
"server program should have at least 2 blocks"
);
platform
::
errors
::
PreconditionNotMet
(
"Invalid number of blocks in server program. Expected "
"equal or greater than 2. Recieved %zu"
,
num_blocks
));
std
::
vector
<
int
>
block_list
;
for
(
size_t
blkid
=
1
;
blkid
<
num_blocks
;
++
blkid
)
{
block_list
.
push_back
(
blkid
);
...
...
@@ -342,9 +357,9 @@ void ListenAndServOp::CacheVarsType(const std::vector<std::string> &varnames,
var
->
IsType
<
framework
::
Tensor
>
())
{
dense_vars_
.
push_back
(
varname
);
}
else
{
PADDLE_THROW
(
PADDLE_THROW
(
platform
::
errors
::
PreconditionNotMet
(
"The type of received var should be in [SelectedRows, LoDTensor, "
"Tensor]."
);
"Tensor]."
)
)
;
}
}
}
...
...
@@ -450,7 +465,12 @@ void ListenAndServOp::RunImpl(const framework::Scope &scope,
split
(
prefetch_var_name_and_id
,
':'
,
&
pieces
);
VLOG
(
3
)
<<
"after split, prefetch_var = "
<<
pieces
[
0
]
<<
", id="
<<
pieces
[
1
];
PADDLE_ENFORCE_EQ
(
pieces
.
size
(),
2
);
PADDLE_ENFORCE_EQ
(
pieces
.
size
(),
2
,
platform
::
errors
::
PreconditionNotMet
(
"Invalid format of prefetch_var_name_and_id argument. "
"Expected
\"
xxx:xxx
\"
. Recieved %s"
,
prefetch_var_name_and_id
.
c_str
()));
int
block_id
=
std
::
stoi
(
pieces
[
1
]);
prefetch_block_id_list
.
push_back
(
block_id
);
...
...
@@ -476,7 +496,12 @@ void ListenAndServOp::RunImpl(const framework::Scope &scope,
sparse_grad_name_to_param_name_str
)
{
std
::
vector
<
std
::
string
>
pieces
;
split
(
sparse_grad_name_and_param_name
,
':'
,
&
pieces
);
PADDLE_ENFORCE_EQ
(
pieces
.
size
(),
2
);
PADDLE_ENFORCE_EQ
(
pieces
.
size
(),
2
,
platform
::
errors
::
PreconditionNotMet
(
"Invalid format of sparse_grad_name_and_param_name argument. "
"Expected
\"
xxx:xxx
\"
. Recieved %s"
,
sparse_grad_name_and_param_name
.
c_str
()));
VLOG
(
3
)
<<
"after split, sparse_grad_name = "
<<
pieces
[
0
]
<<
", param_name = "
<<
pieces
[
1
];
sparse_grad_name_to_param_name
[
pieces
[
0
]]
=
pieces
[
1
];
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录