Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Serving
提交
99781bce
S
Serving
项目概览
PaddlePaddle
/
Serving
1 年多 前同步成功
通知
186
Star
833
Fork
253
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
105
列表
看板
标记
里程碑
合并请求
10
Wiki
2
Wiki
分析
仓库
DevOps
项目成员
Pages
S
Serving
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
105
Issue
105
列表
看板
标记
里程碑
合并请求
10
合并请求
10
Pages
分析
分析
仓库分析
DevOps
Wiki
2
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
99781bce
编写于
8月 13, 2020
作者:
B
barriery
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add logid in op
上级
e69c6357
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
38 addition
and
22 deletion
+38
-22
core/general-server/op/general_copy_op.cpp
core/general-server/op/general_copy_op.cpp
+14
-9
core/general-server/op/general_dist_kv_infer_op.cpp
core/general-server/op/general_dist_kv_infer_op.cpp
+12
-7
core/general-server/op/general_dist_kv_quant_infer_op.cpp
core/general-server/op/general_dist_kv_quant_infer_op.cpp
+10
-5
core/general-server/op/general_text_response_op.cpp
core/general-server/op/general_text_response_op.cpp
+2
-1
未找到文件。
core/general-server/op/general_copy_op.cpp
浏览文件 @
99781bce
...
...
@@ -45,36 +45,41 @@ int GeneralCopyOp::inference() {
const
std
::
string
pre_name
=
pre_node_names
[
0
];
const
GeneralBlob
*
input_blob
=
get_depend_argument
<
GeneralBlob
>
(
pre_name
);
VLOG
(
2
)
<<
"precedent name: "
<<
pre_name
;
uint64_t
log_id
=
input_blob
->
GetLogId
();
VLOG
(
2
)
<<
"(logid="
<<
log_id
<<
") precedent name: "
<<
pre_name
;
const
TensorVector
*
in
=
&
input_blob
->
tensor_vector
;
VLOG
(
2
)
<<
"input size: "
<<
in
->
size
();
VLOG
(
2
)
<<
"
(logid="
<<
log_id
<<
")
input size: "
<<
in
->
size
();
int
batch_size
=
input_blob
->
GetBatchSize
();
int
input_var_num
=
0
;
GeneralBlob
*
res
=
mutable_data
<
GeneralBlob
>
();
res
->
SetLogId
(
log_id
);
TensorVector
*
out
=
&
res
->
tensor_vector
;
VLOG
(
2
)
<<
"input batch size: "
<<
batch_size
;
VLOG
(
2
)
<<
"
(logid="
<<
log_id
<<
")
input batch size: "
<<
batch_size
;
res
->
SetBatchSize
(
batch_size
);
if
(
!
res
)
{
LOG
(
ERROR
)
<<
"Failed get op tls reader object output"
;
LOG
(
ERROR
)
<<
"(logid="
<<
log_id
<<
") Failed get op tls reader object output"
;
}
Timer
timeline
;
int64_t
start
=
timeline
.
TimeStampUS
();
VLOG
(
2
)
<<
"Going to init lod tensor"
;
VLOG
(
2
)
<<
"
(logid="
<<
log_id
<<
")
Going to init lod tensor"
;
for
(
int
i
=
0
;
i
<
in
->
size
();
++
i
)
{
paddle
::
PaddleTensor
lod_tensor
;
CopyLod
(
&
in
->
at
(
i
),
&
lod_tensor
);
lod_tensor
.
dtype
=
in
->
at
(
i
).
dtype
;
lod_tensor
.
name
=
in
->
at
(
i
).
name
;
VLOG
(
2
)
<<
"lod tensor ["
<<
i
<<
"].name = "
<<
lod_tensor
.
name
;
VLOG
(
2
)
<<
"(logid="
<<
log_id
<<
") lod tensor ["
<<
i
<<
"].name = "
<<
lod_tensor
.
name
;
out
->
push_back
(
lod_tensor
);
}
VLOG
(
2
)
<<
"pack done."
;
VLOG
(
2
)
<<
"
(logid="
<<
log_id
<<
")
pack done."
;
for
(
int
i
=
0
;
i
<
out
->
size
();
++
i
)
{
int64_t
*
src_ptr
=
static_cast
<
int64_t
*>
(
in
->
at
(
i
).
data
.
data
());
...
...
@@ -86,7 +91,7 @@ int GeneralCopyOp::inference() {
}
}
VLOG
(
2
)
<<
"output done."
;
VLOG
(
2
)
<<
"
(logid="
<<
log_id
<<
")
output done."
;
timeline
.
Pause
();
int64_t
end
=
timeline
.
TimeStampUS
();
...
...
@@ -94,7 +99,7 @@ int GeneralCopyOp::inference() {
AddBlobInfo
(
res
,
start
);
AddBlobInfo
(
res
,
end
);
VLOG
(
2
)
<<
"read data from client success"
;
VLOG
(
2
)
<<
"
(logid="
<<
log_id
<<
")
read data from client success"
;
return
0
;
}
...
...
core/general-server/op/general_dist_kv_infer_op.cpp
浏览文件 @
99781bce
...
...
@@ -50,18 +50,20 @@ int GeneralDistKVInferOp::inference() {
const
std
::
string
pre_name
=
pre_node_names
[
0
];
const
GeneralBlob
*
input_blob
=
get_depend_argument
<
GeneralBlob
>
(
pre_name
);
VLOG
(
2
)
<<
"Get precedent op name: "
<<
pre_name
;
uint64_t
log_id
=
input_blob
->
GetLogId
();
VLOG
(
2
)
<<
"(logid="
<<
log_id
<<
") Get precedent op name: "
<<
pre_name
;
GeneralBlob
*
output_blob
=
mutable_data
<
GeneralBlob
>
();
if
(
!
input_blob
)
{
LOG
(
ERROR
)
<<
"Failed mutable depended argument, op:"
<<
pre_name
;
LOG
(
ERROR
)
<<
"(logid="
<<
log_id
<<
") Failed mutable depended argument, op:"
<<
pre_name
;
return
-
1
;
}
const
TensorVector
*
in
=
&
input_blob
->
tensor_vector
;
TensorVector
*
out
=
&
output_blob
->
tensor_vector
;
int
batch_size
=
input_blob
->
GetBatchSize
();
VLOG
(
2
)
<<
"input batch size: "
<<
batch_size
;
VLOG
(
2
)
<<
"
(logid="
<<
log_id
<<
")
input batch size: "
<<
batch_size
;
std
::
vector
<
uint64_t
>
keys
;
std
::
vector
<
rec
::
mcube
::
CubeValue
>
values
;
int
sparse_count
=
0
;
...
...
@@ -96,13 +98,14 @@ int GeneralDistKVInferOp::inference() {
rec
::
mcube
::
CubeAPI
*
cube
=
rec
::
mcube
::
CubeAPI
::
instance
();
std
::
vector
<
std
::
string
>
table_names
=
cube
->
get_table_names
();
if
(
table_names
.
size
()
==
0
)
{
LOG
(
ERROR
)
<<
"cube init error or cube config not given."
;
LOG
(
ERROR
)
<<
"(logid="
<<
log_id
<<
") cube init error or cube config not given."
;
return
-
1
;
}
int
ret
=
cube
->
seek
(
table_names
[
0
],
keys
,
&
values
);
int64_t
cube_end
=
timeline
.
TimeStampUS
();
if
(
values
.
size
()
!=
keys
.
size
()
||
values
[
0
].
buff
.
size
()
==
0
)
{
LOG
(
ERROR
)
<<
"cube value return null"
;
LOG
(
ERROR
)
<<
"
(logid="
<<
log_id
<<
")
cube value return null"
;
}
size_t
EMBEDDING_SIZE
=
values
[
0
].
buff
.
size
()
/
sizeof
(
float
);
TensorVector
sparse_out
;
...
...
@@ -153,14 +156,16 @@ int GeneralDistKVInferOp::inference() {
infer_in
.
insert
(
infer_in
.
end
(),
sparse_out
.
begin
(),
sparse_out
.
end
());
output_blob
->
SetBatchSize
(
batch_size
);
output_blob
->
SetLogId
(
log_id
);
VLOG
(
2
)
<<
"infer batch size: "
<<
batch_size
;
VLOG
(
2
)
<<
"
(logid="
<<
log_id
<<
")
infer batch size: "
<<
batch_size
;
int64_t
start
=
timeline
.
TimeStampUS
();
if
(
InferManager
::
instance
().
infer
(
engine_name
().
c_str
(),
&
infer_in
,
out
,
batch_size
))
{
LOG
(
ERROR
)
<<
"Failed do infer in fluid model: "
<<
engine_name
();
LOG
(
ERROR
)
<<
"(logid="
<<
log_id
<<
") Failed do infer in fluid model: "
<<
engine_name
();
return
-
1
;
}
...
...
core/general-server/op/general_dist_kv_quant_infer_op.cpp
浏览文件 @
99781bce
...
...
@@ -59,10 +59,13 @@ int GeneralDistKVQuantInferOp::inference() {
return
-
1
;
}
uint64_t
log_id
=
input_blob
->
GetLogId
();
output_blob
->
SetLogId
(
log_id
);
const
TensorVector
*
in
=
&
input_blob
->
tensor_vector
;
TensorVector
*
out
=
&
output_blob
->
tensor_vector
;
int
batch_size
=
input_blob
->
GetBatchSize
();
VLOG
(
2
)
<<
"input batch size: "
<<
batch_size
;
VLOG
(
2
)
<<
"
(logid="
<<
log_id
<<
")
input batch size: "
<<
batch_size
;
std
::
vector
<
uint64_t
>
keys
;
std
::
vector
<
rec
::
mcube
::
CubeValue
>
values
;
int
sparse_count
=
0
;
...
...
@@ -94,13 +97,14 @@ int GeneralDistKVQuantInferOp::inference() {
rec
::
mcube
::
CubeAPI
*
cube
=
rec
::
mcube
::
CubeAPI
::
instance
();
std
::
vector
<
std
::
string
>
table_names
=
cube
->
get_table_names
();
if
(
table_names
.
size
()
==
0
)
{
LOG
(
ERROR
)
<<
"cube init error or cube config not given."
;
LOG
(
ERROR
)
<<
"(logid="
<<
log_id
<<
") cube init error or cube config not given."
;
return
-
1
;
}
int
ret
=
cube
->
seek
(
table_names
[
0
],
keys
,
&
values
);
if
(
values
.
size
()
!=
keys
.
size
()
||
values
[
0
].
buff
.
size
()
==
0
)
{
LOG
(
ERROR
)
<<
"cube value return null"
;
LOG
(
ERROR
)
<<
"
(logid="
<<
log_id
<<
")
cube value return null"
;
}
TensorVector
sparse_out
;
...
...
@@ -182,7 +186,7 @@ int GeneralDistKVQuantInferOp::inference() {
output_blob
->
SetBatchSize
(
batch_size
);
VLOG
(
2
)
<<
"infer batch size: "
<<
batch_size
;
VLOG
(
2
)
<<
"
(logid="
<<
log_id
<<
")
infer batch size: "
<<
batch_size
;
Timer
timeline
;
int64_t
start
=
timeline
.
TimeStampUS
();
...
...
@@ -190,7 +194,8 @@ int GeneralDistKVQuantInferOp::inference() {
if
(
InferManager
::
instance
().
infer
(
engine_name
().
c_str
(),
&
infer_in
,
out
,
batch_size
))
{
LOG
(
ERROR
)
<<
"Failed do infer in fluid model: "
<<
engine_name
();
LOG
(
ERROR
)
<<
"(logid="
<<
log_id
<<
") Failed do infer in fluid model: "
<<
engine_name
();
return
-
1
;
}
...
...
core/general-server/op/general_text_response_op.cpp
浏览文件 @
99781bce
...
...
@@ -74,9 +74,10 @@ int GeneralTextResponseOp::inference() {
return
-
1
;
}
uint64_t
log_id
=
input_blob
->
GetLogId
();
const
TensorVector
*
in
=
&
input_blob
->
tensor_vector
;
int
batch_size
=
input_blob
->
GetBatchSize
();
VLOG
(
2
)
<<
"input batch size: "
<<
batch_size
;
VLOG
(
2
)
<<
"
(logid="
<<
log_id
<<
")
input batch size: "
<<
batch_size
;
ModelOutput
*
output
=
res
->
add_outputs
();
output
->
set_engine_name
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录