Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Serving
提交
17e655f8
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看板
未验证
提交
17e655f8
编写于
9月 07, 2021
作者:
Z
Zhang Yulong
提交者:
GitHub
9月 07, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' into ci-test
上级
72f70587
0c04805c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
92 addition
and
3 deletion
+92
-3
core/general-server/op/general_dist_kv_infer_op.cpp
core/general-server/op/general_dist_kv_infer_op.cpp
+1
-1
core/predictor/framework/dag_view.cpp
core/predictor/framework/dag_view.cpp
+80
-0
core/predictor/framework/dag_view.h
core/predictor/framework/dag_view.h
+11
-2
未找到文件。
core/general-server/op/general_dist_kv_infer_op.cpp
浏览文件 @
17e655f8
...
...
@@ -181,7 +181,7 @@ int GeneralDistKVInferOp::inference() {
continue
;
}
VLOG
(
2
)
<<
"(logid="
<<
log_id
<<
") key: "
<<
keys
[
cube_val_idx
]
<<
" , cube value len:"
<<
cur_val
->
buff
.
size
();
memcpy
(
data_ptr
,
cur_val
->
buff
.
data
()
,
cur_val
->
buff
.
size
()
);
memcpy
(
data_ptr
,
cur_val
->
buff
.
data
()
+
10
,
sizeof
(
float
)
*
EMBEDDING_SIZE
);
//VLOG(3) << keys[cube_val_idx] << ":" << data_ptr[0] << ", " << data_ptr[1] << ", " <<data_ptr[2] << ", " <<data_ptr[3] << ", " <<data_ptr[4] << ", " <<data_ptr[5] << ", " <<data_ptr[6] << ", " <<data_ptr[7] << ", " <<data_ptr[8];
++
cube_key_found
;
++
cube_val_idx
;
...
...
core/predictor/framework/dag_view.cpp
浏览文件 @
17e655f8
...
...
@@ -21,6 +21,15 @@
#include <string>
#include "core/predictor/common/inner_common.h"
#include "core/predictor/framework/op_repository.h"
#ifdef BCLOUD
#include <base/atomicops.h>
#else
#include <butil/atomicops.h>
#endif
#include <errno.h>
#include "core/predictor/framework/resource.h"
using
baidu
::
paddle_serving
::
predictor
::
Resource
;
namespace
baidu
{
namespace
paddle_serving
{
...
...
@@ -238,6 +247,77 @@ const Channel* DagView::get_response_channel(const uint64_t log_id) const {
return
last_op
->
mutable_channel
();
}
void
*
call_back
(
void
*
ori_args
)
{
Resource
::
instance
().
thread_initialize
();
Args
*
args
=
(
Args
*
)
ori_args
;
Op
*
op
=
static_cast
<
Op
*>
(
args
->
_op
);
uint64_t
log_id
=
static_cast
<
uint64_t
>
(
args
->
_log_id
);
bool
debug
=
static_cast
<
bool
>
(
args
->
_debug
);
args
->
errcode
=
op
->
process
(
log_id
,
debug
);
return
nullptr
;
}
int
ParallelDagView
::
execute_one_stage
(
ViewStage
*
vstage
,
const
uint64_t
log_id
,
butil
::
IOBufBuilder
*
debug_os
)
{
butil
::
Timer
stage_time
(
butil
::
Timer
::
STARTED
);
uint32_t
node_size
=
vstage
->
nodes
.
size
();
std
::
vector
<
THREAD_T
>
tids
(
node_size
);
Args
*
args
=
new
Args
[
node_size
];
VLOG
(
2
)
<<
"(logid="
<<
log_id
<<
") vstage->nodes.size(): "
<<
node_size
;
for
(
uint32_t
ni
=
0
;
ni
<
node_size
;
ni
++
)
{
ViewNode
*
vnode
=
vstage
->
nodes
[
ni
];
DagNode
*
conf
=
vnode
->
conf
;
Op
*
op
=
vnode
->
op
;
TRACEPRINTF
(
"(logid=%"
PRIu64
") start to execute op[%s]"
,
log_id
,
op
->
name
());
args
[
ni
].
_op
=
op
;
args
[
ni
].
_log_id
=
log_id
;
args
[
ni
].
_debug
=
(
debug_os
!=
NULL
);
int
rc
=
THREAD_CREATE
(
&
tids
[
ni
],
NULL
,
call_back
,
(
void
*
)(
args
+
ni
));
if
(
rc
!=
0
)
{
LOG
(
ERROR
)
<<
"failed to create ParallelDagView worker thread: index="
<<
ni
<<
", rc="
<<
rc
<<
", errno="
<<
errno
<<
":"
<<
strerror
(
errno
);
delete
[]
args
;
return
-
1
;
}
}
for
(
uint32_t
ni
=
0
;
ni
<
node_size
;
ni
++
)
{
THREAD_JOIN
(
tids
[
ni
],
NULL
);
int
errcode
=
args
[
ni
].
errcode
;
Op
*
op
=
args
[
ni
].
_op
;
TRACEPRINTF
(
"(logid=%"
PRIu64
") finish to execute op[%s]"
,
log_id
,
op
->
name
());
if
(
errcode
<
0
)
{
LOG
(
ERROR
)
<<
"(logid="
<<
log_id
<<
") Execute failed, Op:"
<<
op
->
debug_string
();
delete
[]
args
;
return
errcode
;
}
if
(
errcode
>
0
)
{
LOG
(
INFO
)
<<
"(logid="
<<
log_id
<<
") Execute ignore, Op:"
<<
op
->
debug_string
();
continue
;
}
if
(
debug_os
)
{
(
*
debug_os
)
<<
"(logid="
<<
log_id
<<
") {
\"
op_name
\"
:
\"
"
<<
op
->
name
()
<<
"
\"
,
\"
debug_str:
\"
:
\"
"
<<
op
->
debug_string
()
<<
"
\"
,
\"
time_info
\"
:
\"
"
<<
op
->
time_info
()
<<
"
\"
}"
;
}
// LOG(DEBUG) << "Execute succ, Op:" << op->debug_string();
}
stage_time
.
stop
();
PredictorMetric
::
GetInstance
()
->
update_latency_metric
(
STAGE_METRIC_PREFIX
+
vstage
->
full_name
,
stage_time
.
u_elapsed
());
delete
[]
args
;
return
ERR_OK
;
}
}
// namespace predictor
}
// namespace paddle_serving
}
// namespace baidu
core/predictor/framework/dag_view.h
浏览文件 @
17e655f8
...
...
@@ -24,7 +24,7 @@ namespace baidu {
namespace
paddle_serving
{
namespace
predictor
{
class
Op
;
//
class Op;
struct
ViewNode
{
Op
*
op
;
// op->full_name == service_workflow_stageindex_opname
...
...
@@ -75,11 +75,20 @@ class DagView {
Bus
*
_bus
;
};
struct
Args
{
Op
*
_op
;
uint64_t
_log_id
;
bool
_debug
;
int
errcode
;
};
// The derived DagView supports parallel execution
// strategy, by implments the execute_one_stage().
class
ParallelDagView
:
public
DagView
{
public:
int
execute_one_stage
(
ViewStage
*
vstage
,
butil
::
IOBufBuilder
*
)
{
return
0
;
}
virtual
int
execute_one_stage
(
ViewStage
*
vstage
,
const
uint64_t
log_id
,
butil
::
IOBufBuilder
*
debug_os
);
};
}
// namespace predictor
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录