Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Serving
提交
43562c3d
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看板
提交
43562c3d
编写于
7月 31, 2019
作者:
X
xulongteng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add cube init
上级
765e5daa
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
61 addition
and
3 deletion
+61
-3
configure/proto/server_configure.proto
configure/proto/server_configure.proto
+2
-0
predictor/common/constant.cpp
predictor/common/constant.cpp
+1
-0
predictor/common/constant.h
predictor/common/constant.h
+3
-0
predictor/framework/resource.cpp
predictor/framework/resource.cpp
+44
-2
predictor/framework/resource.h
predictor/framework/resource.h
+3
-1
predictor/src/pdserving.cpp
predictor/src/pdserving.cpp
+8
-0
未找到文件。
configure/proto/server_configure.proto
浏览文件 @
43562c3d
...
...
@@ -35,6 +35,8 @@ message ModelToolkitConf { repeated EngineDesc engines = 1; };
message
ResourceConf
{
required
string
model_toolkit_path
=
1
;
required
string
model_toolkit_file
=
2
;
optional
string
cube_config_path
=
3
;
optional
string
cube_config_file
=
4
;
};
// DAG node depency info
...
...
predictor/common/constant.cpp
浏览文件 @
43562c3d
...
...
@@ -40,6 +40,7 @@ DEFINE_int32(
DEFINE_int32
(
reload_interval_s
,
10
,
""
);
DEFINE_bool
(
enable_model_toolkit
,
false
,
"enable model toolkit"
);
DEFINE_string
(
enable_protocol_list
,
"baidu_std"
,
"set protocol list"
);
DEFINE_bool
(
enable_cube
,
false
,
"enable cube"
);
const
char
*
START_OP_NAME
=
"startup_op"
;
}
// namespace predictor
...
...
predictor/common/constant.h
浏览文件 @
43562c3d
...
...
@@ -39,6 +39,9 @@ DECLARE_int32(num_threads);
DECLARE_int32
(
reload_interval_s
);
DECLARE_bool
(
enable_model_toolkit
);
DECLARE_string
(
enable_protocol_list
);
DECLARE_bool
(
enable_cube
);
DECLARE_string
(
cube_config_path
);
DECLARE_string
(
cube_config_file
);
// STATIC Variables
extern
const
char
*
START_OP_NAME
;
...
...
predictor/framework/resource.cpp
浏览文件 @
43562c3d
...
...
@@ -22,7 +22,7 @@ namespace paddle_serving {
namespace
predictor
{
using
configure
::
ResourceConf
;
using
rec
::
mcube
::
CubeAPI
;
// __thread bool p_thread_initialized = false;
static
void
dynamic_resource_deleter
(
void
*
d
)
{
...
...
@@ -91,6 +91,45 @@ int Resource::initialize(const std::string& path, const std::string& file) {
return
0
;
}
int
Resource
::
cube_initialize
(
const
std
::
string
&
path
,
const
std
::
string
&
file
)
{
// cube
if
(
!
FLAGS_enable_cube
)
{
return
0
;
}
ResourceConf
resource_conf
;
if
(
configure
::
read_proto_conf
(
path
,
file
,
&
resource_conf
)
!=
0
)
{
LOG
(
ERROR
)
<<
"Failed initialize resource from: "
<<
path
<<
"/"
<<
file
;
return
-
1
;
}
int
err
=
0
;
std
::
string
cube_config_path
=
resource_conf
.
cube_config_path
();
if
(
err
!=
0
)
{
LOG
(
ERROR
)
<<
"reade cube_config_path failed, path["
<<
path
<<
"], file["
<<
cube_config_path
<<
"]"
;
return
-
1
;
}
std
::
string
cube_config_file
=
resource_conf
.
cube_config_file
();
if
(
err
!=
0
)
{
LOG
(
ERROR
)
<<
"reade cube_config_file failed, path["
<<
path
<<
"], file["
<<
cube_config_file
<<
"]"
;
return
-
1
;
}
err
=
CubeAPI
::
instance
()
->
init
(
cube_config_path
.
c_str
(),
cube_config_file
.
c_str
());
if
(
err
!=
0
)
{
LOG
(
ERROR
)
<<
"failed initialize cube, config: "
<<
cube_config_path
<<
"/"
<<
cube_config_file
<<
" error code : "
<<
err
;
return
-
1
;
}
LOG
(
INFO
)
<<
"Successfully initialize cube"
;
return
0
;
}
int
Resource
::
thread_initialize
()
{
// mempool
if
(
MempoolWrapper
::
instance
().
thread_initialize
()
!=
0
)
{
...
...
@@ -192,7 +231,10 @@ int Resource::finalize() {
LOG
(
ERROR
)
<<
"Failed proc finalize infer manager"
;
return
-
1
;
}
if
(
CubeAPI
::
instance
()
->
destroy
()
!=
0
)
{
LOG
(
ERROR
)
<<
"Destory cube api failed "
;
return
-
1
;
}
THREAD_KEY_DELETE
(
_tls_bspec_key
);
return
0
;
...
...
predictor/framework/resource.h
浏览文件 @
43562c3d
...
...
@@ -13,7 +13,9 @@
// limitations under the License.
#pragma once
#include <memory>
#include <string>
#include "include/cube/cube_api.h"
#include "kvdb/paddle_rocksdb.h"
#include "predictor/common/inner_common.h"
#include "predictor/framework/memory.h"
...
...
@@ -45,7 +47,7 @@ class Resource {
}
int
initialize
(
const
std
::
string
&
path
,
const
std
::
string
&
file
);
int
cube_initialize
(
const
std
::
string
&
path
,
const
std
::
string
&
file
);
int
thread_initialize
();
int
thread_clear
();
...
...
predictor/src/pdserving.cpp
浏览文件 @
43562c3d
...
...
@@ -209,6 +209,14 @@ int main(int argc, char** argv) {
}
LOG
(
INFO
)
<<
"Succ call pthread worker start function"
;
if
(
Resource
::
instance
().
cube_initialize
(
FLAGS_resource_path
,
FLAGS_resource_file
)
!=
0
)
{
LOG
(
ERROR
)
<<
"Failed initialize cube, conf: "
<<
FLAGS_resource_path
<<
"/"
<<
FLAGS_resource_file
;
return
-
1
;
}
LOG
(
INFO
)
<<
"Succ initialize cube"
;
FLAGS_logtostderr
=
false
;
if
(
ServerManager
::
instance
().
start_and_wait
()
!=
0
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录