Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Serving
提交
3a62e888
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看板
提交
3a62e888
编写于
9月 27, 2019
作者:
W
wangguibao
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' into binary_inference_lib
上级
e906e4b8
5a36fa53
变更
18
显示空白变更内容
内联
并排
Showing
18 changed file
with
64 addition
and
51 deletion
+64
-51
cube/cube-api/include/cube_api.h
cube/cube-api/include/cube_api.h
+5
-0
cube/cube-api/include/meta.h
cube/cube-api/include/meta.h
+14
-0
cube/cube-api/src/cube_api.cpp
cube/cube-api/src/cube_api.cpp
+10
-0
cube/cube-api/src/meta.cpp
cube/cube-api/src/meta.cpp
+4
-0
cube/cube-builder/CMakeLists.txt
cube/cube-builder/CMakeLists.txt
+1
-5
cube/cube-server/conf/gflags.conf
cube/cube-server/conf/gflags.conf
+2
-2
doc/CTR_PREDICTION.md
doc/CTR_PREDICTION.md
+1
-1
doc/INSTALL.md
doc/INSTALL.md
+3
-1
inferencer-fluid-cpu/CMakeLists.txt
inferencer-fluid-cpu/CMakeLists.txt
+1
-1
inferencer-fluid-gpu/CMakeLists.txt
inferencer-fluid-gpu/CMakeLists.txt
+1
-1
kvdb/CMakeLists.txt
kvdb/CMakeLists.txt
+1
-0
kvdb/include/kvdb/kvdb_impl.h
kvdb/include/kvdb/kvdb_impl.h
+1
-0
kvdb/include/kvdb/paddle_rocksdb.h
kvdb/include/kvdb/paddle_rocksdb.h
+1
-1
kvdb/include/kvdb/rocksdb_impl.h
kvdb/include/kvdb/rocksdb_impl.h
+1
-0
kvdb/src/gtest_kvdb.cpp
kvdb/src/gtest_kvdb.cpp
+1
-37
kvdb/src/mock_param_dict_impl.cpp
kvdb/src/mock_param_dict_impl.cpp
+2
-1
kvdb/src/paddle_rocksdb.cpp
kvdb/src/paddle_rocksdb.cpp
+8
-0
kvdb/src/rockskvdb_impl.cpp
kvdb/src/rockskvdb_impl.cpp
+7
-1
未找到文件。
cube/cube-api/include/cube_api.h
浏览文件 @
3a62e888
...
@@ -18,7 +18,12 @@
...
@@ -18,7 +18,12 @@
#include <string>
#include <string>
#include <vector>
#include <vector>
#ifdef BCLOUD
#include "baidu/rpc/server.h"
#else
#include "brpc/server.h"
#include "brpc/server.h"
#endif
#include "cube/cube-api/cube.pb.h"
#include "cube/cube-api/cube.pb.h"
#include "cube/cube-api/include/meta.h"
#include "cube/cube-api/include/meta.h"
...
...
cube/cube-api/include/meta.h
浏览文件 @
3a62e888
...
@@ -19,11 +19,25 @@
...
@@ -19,11 +19,25 @@
#include <unordered_map>
#include <unordered_map>
#include <vector>
#include <vector>
#ifdef BCLOUD
#include "baidu/rpc/channel.h"
#include "baidu/rpc/parallel_channel.h"
#include "rapidjson/document.h"
#else
#include "brpc/channel.h"
#include "brpc/channel.h"
#include "brpc/parallel_channel.h"
#include "brpc/parallel_channel.h"
#include "butil/third_party/rapidjson/document.h"
#include "butil/third_party/rapidjson/document.h"
#endif
#include "bvar/bvar.h"
#include "bvar/bvar.h"
#ifdef BCLOUD
namespace
brpc
=
baidu
::
rpc
;
#ifndef BUTIL_RAPIDJSON_NAMESPACE
#define BUTIL_RAPIDJSON_NAMESPACE RAPIDJSON_NAMESPACE
#endif
#endif
namespace
rec
{
namespace
rec
{
namespace
mcube
{
namespace
mcube
{
...
...
cube/cube-api/src/cube_api.cpp
浏览文件 @
3a62e888
...
@@ -13,8 +13,14 @@
...
@@ -13,8 +13,14 @@
// limitations under the License.
// limitations under the License.
#include "cube/cube-api/include/cube_api.h"
#include "cube/cube-api/include/cube_api.h"
#ifdef BCLOUD
#include <baidu/rpc/channel.h>
#include <baidu/rpc/parallel_channel.h>
#else
#include <brpc/channel.h>
#include <brpc/channel.h>
#include <brpc/parallel_channel.h>
#include <brpc/parallel_channel.h>
#endif
#include <google/protobuf/descriptor.h>
#include <google/protobuf/descriptor.h>
#include "cube/cube-api/include/cube_api_bvar.h"
#include "cube/cube-api/include/cube_api_bvar.h"
...
@@ -25,6 +31,10 @@ namespace {
...
@@ -25,6 +31,10 @@ namespace {
static
::
rec
::
mcube
::
CubeAPI
*
g_ins
=
NULL
;
static
::
rec
::
mcube
::
CubeAPI
*
g_ins
=
NULL
;
}
}
#ifdef BCLOUD
namespace
brpc
=
baidu
::
rpc
;
#endif
namespace
rec
{
namespace
rec
{
namespace
mcube
{
namespace
mcube
{
...
...
cube/cube-api/src/meta.cpp
浏览文件 @
3a62e888
...
@@ -26,6 +26,10 @@ namespace {
...
@@ -26,6 +26,10 @@ namespace {
static
::
rec
::
mcube
::
Meta
*
g_ins
=
NULL
;
static
::
rec
::
mcube
::
Meta
*
g_ins
=
NULL
;
}
}
#ifdef BCLOUD
namespace
brpc
=
baidu
::
rpc
;
#endif
namespace
rec
{
namespace
rec
{
namespace
mcube
{
namespace
mcube
{
...
...
cube/cube-builder/CMakeLists.txt
浏览文件 @
3a62e888
...
@@ -20,11 +20,6 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
...
@@ -20,11 +20,6 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
include_directories
(
SYSTEM
${
CMAKE_CURRENT_LIST_DIR
}
/include
)
include_directories
(
SYSTEM
${
CMAKE_CURRENT_LIST_DIR
}
/include
)
include_directories
(
SYSTEM
${
CMAKE_CURRENT_BINARY_DIR
}
/../
)
include_directories
(
SYSTEM
${
CMAKE_CURRENT_BINARY_DIR
}
/../
)
find_library
(
CURL_LIB NAMES curl
)
if
(
NOT CURL_LIB
)
message
(
FATAL_ERROR
"Fail to find curl"
)
endif
()
add_executable
(
cube-builder src/main.cpp include/cube-builder/util.h src/util.cpp src/builder_job.cpp include/cube-builder/builder_job.h include/cube-builder/define.h src/seqfile_reader.cpp include/cube-builder/seqfile_reader.h include/cube-builder/raw_reader.h include/cube-builder/vtext.h src/crovl_builder_increment.cpp include/cube-builder/crovl_builder_increment.h src/curl_simple.cpp include/cube-builder/curl_simple.h
)
add_executable
(
cube-builder src/main.cpp include/cube-builder/util.h src/util.cpp src/builder_job.cpp include/cube-builder/builder_job.h include/cube-builder/define.h src/seqfile_reader.cpp include/cube-builder/seqfile_reader.h include/cube-builder/raw_reader.h include/cube-builder/vtext.h src/crovl_builder_increment.cpp include/cube-builder/crovl_builder_increment.h src/curl_simple.cpp include/cube-builder/curl_simple.h
)
add_dependencies
(
cube-builder jsoncpp
)
add_dependencies
(
cube-builder jsoncpp
)
...
@@ -33,6 +28,7 @@ set(DYNAMIC_LIB
...
@@ -33,6 +28,7 @@ set(DYNAMIC_LIB
gflags
gflags
jsoncpp
jsoncpp
brpc
brpc
-lcurl
-lssl
-lssl
-lcrypto
-lcrypto
${
CURL_LIB
}
${
CURL_LIB
}
...
...
cube/cube-server/conf/gflags.conf
浏览文件 @
3a62e888
--
port
=
80
27
--
port
=
80
00
--
dict_split
=
1
--
dict_split
=
1
--
in_mem
=
true
--
in_mem
=
true
--
log_dir
=./
log
/
--
log_dir
=./
log
/
doc/CTR_PREDICTION.md
浏览文件 @
3a62e888
...
@@ -320,7 +320,7 @@ def prune_program():
...
@@ -320,7 +320,7 @@ def prune_program():
### 2.5 裁剪过程串到一起
### 2.5 裁剪过程串到一起
我们提供了完整的裁剪CTR预估模型的脚本文件save_program.py,同
[
CTR分布式训练
任务
](
doc/DISTRIBUTED_TRAINING_AND_SERVING.md
)
一起发布,可以在trainer和pserver容器的训练脚本目录下找到
我们提供了完整的裁剪CTR预估模型的脚本文件save_program.py,同
[
CTR分布式训练
和Serving流程化部署
](
https://github.com/PaddlePaddle/Serving/blob/master/doc/DEPLOY.md
)
一起发布,可以在trainer和pserver容器的训练脚本目录下找到,也可以在
[
这里
](
https://github.com/PaddlePaddle/Serving/tree/master/doc/resource
)
下载。
## 3. 整个预测计算流程
## 3. 整个预测计算流程
...
...
doc/INSTALL.md
浏览文件 @
3a62e888
...
@@ -10,7 +10,9 @@ C++编译器 (验证过的版本:GCC 4.8.2/5.4.0)
...
@@ -10,7 +10,9 @@ C++编译器 (验证过的版本:GCC 4.8.2/5.4.0)
python (验证过的版本:2.7)
python (验证过的版本:2.7)
Go编译器 (验证过的版本:1.9.2)
Go编译器 (验证过的版本:1.9.2/1.12.0)
openssl & openssl-devel
## 编译
## 编译
...
...
inferencer-fluid-cpu/CMakeLists.txt
浏览文件 @
3a62e888
...
@@ -2,7 +2,7 @@ FILE(GLOB fluid_cpu_engine_srcs ${CMAKE_CURRENT_LIST_DIR}/src/*.cpp)
...
@@ -2,7 +2,7 @@ FILE(GLOB fluid_cpu_engine_srcs ${CMAKE_CURRENT_LIST_DIR}/src/*.cpp)
add_library
(
fluid_cpu_engine
${
fluid_cpu_engine_srcs
}
)
add_library
(
fluid_cpu_engine
${
fluid_cpu_engine_srcs
}
)
target_include_directories
(
fluid_cpu_engine PUBLIC
target_include_directories
(
fluid_cpu_engine PUBLIC
${
CMAKE_BINARY_DIR
}
/Paddle/fluid_install_dir/
)
${
CMAKE_BINARY_DIR
}
/Paddle/fluid_install_dir/
)
add_dependencies
(
fluid_cpu_engine pdserving extern_paddle configure
)
add_dependencies
(
fluid_cpu_engine pdserving extern_paddle configure
kvdb
)
target_link_libraries
(
fluid_cpu_engine pdserving paddle_fluid iomp5 mklml_intel -lpthread -lcrypto -lm -lrt -lssl -ldl -lz
)
target_link_libraries
(
fluid_cpu_engine pdserving paddle_fluid iomp5 mklml_intel -lpthread -lcrypto -lm -lrt -lssl -ldl -lz
)
install
(
TARGETS fluid_cpu_engine
install
(
TARGETS fluid_cpu_engine
...
...
inferencer-fluid-gpu/CMakeLists.txt
浏览文件 @
3a62e888
...
@@ -2,7 +2,7 @@ FILE(GLOB fluid_gpu_engine_srcs ${CMAKE_CURRENT_LIST_DIR}/src/*.cpp)
...
@@ -2,7 +2,7 @@ FILE(GLOB fluid_gpu_engine_srcs ${CMAKE_CURRENT_LIST_DIR}/src/*.cpp)
add_library
(
fluid_gpu_engine
${
fluid_gpu_engine_srcs
}
)
add_library
(
fluid_gpu_engine
${
fluid_gpu_engine_srcs
}
)
target_include_directories
(
fluid_gpu_engine PUBLIC
target_include_directories
(
fluid_gpu_engine PUBLIC
${
CMAKE_BINARY_DIR
}
/Paddle/fluid_install_dir/
)
${
CMAKE_BINARY_DIR
}
/Paddle/fluid_install_dir/
)
add_dependencies
(
fluid_gpu_engine pdserving extern_paddle configure
)
add_dependencies
(
fluid_gpu_engine pdserving extern_paddle configure
kvdb
)
target_link_libraries
(
fluid_gpu_engine pdserving paddle_fluid iomp5 mklml_intel -lpthread -lcrypto -lm -lrt -lssl -ldl -lz
)
target_link_libraries
(
fluid_gpu_engine pdserving paddle_fluid iomp5 mklml_intel -lpthread -lcrypto -lm -lrt -lssl -ldl -lz
)
install
(
TARGETS fluid_gpu_engine
install
(
TARGETS fluid_gpu_engine
...
...
kvdb/CMakeLists.txt
浏览文件 @
3a62e888
...
@@ -9,6 +9,7 @@ set(SRC_LIST ${CMAKE_CURRENT_LIST_DIR}/src/test_rocksdb.cpp
...
@@ -9,6 +9,7 @@ set(SRC_LIST ${CMAKE_CURRENT_LIST_DIR}/src/test_rocksdb.cpp
${
CMAKE_CURRENT_LIST_DIR
}
/src/gtest_kvdb.cpp
)
${
CMAKE_CURRENT_LIST_DIR
}
/src/gtest_kvdb.cpp
)
add_library
(
kvdb
${
SRC_LIST
}
)
add_library
(
kvdb
${
SRC_LIST
}
)
add_dependencies
(
kvdb rocksdb
)
install
(
TARGETS kvdb ARCHIVE DESTINATION
${
PADDLE_SERVING_INSTALL_DIR
}
/lib/
)
install
(
TARGETS kvdb ARCHIVE DESTINATION
${
PADDLE_SERVING_INSTALL_DIR
}
/lib/
)
add_executable
(
kvdb_test
${
SRC_LIST
}
)
add_executable
(
kvdb_test
${
SRC_LIST
}
)
...
...
kvdb/include/kvdb/kvdb_impl.h
浏览文件 @
3a62e888
...
@@ -45,6 +45,7 @@ class AbstractKVDB {
...
@@ -45,6 +45,7 @@ class AbstractKVDB {
virtual
void
SetDBName
(
std
::
string
)
=
0
;
virtual
void
SetDBName
(
std
::
string
)
=
0
;
virtual
void
Set
(
std
::
string
key
,
std
::
string
value
)
=
0
;
virtual
void
Set
(
std
::
string
key
,
std
::
string
value
)
=
0
;
virtual
std
::
string
Get
(
std
::
string
key
)
=
0
;
virtual
std
::
string
Get
(
std
::
string
key
)
=
0
;
virtual
void
Close
()
=
0
;
virtual
~
AbstractKVDB
()
=
0
;
virtual
~
AbstractKVDB
()
=
0
;
};
};
...
...
kvdb/include/kvdb/paddle_rocksdb.h
浏览文件 @
3a62e888
...
@@ -32,7 +32,7 @@ class RocksDBWrapper {
...
@@ -32,7 +32,7 @@ class RocksDBWrapper {
void
SetDBName
(
std
::
string
db_name
);
void
SetDBName
(
std
::
string
db_name
);
static
std
::
shared_ptr
<
RocksDBWrapper
>
RocksDBWrapperFactory
(
static
std
::
shared_ptr
<
RocksDBWrapper
>
RocksDBWrapperFactory
(
std
::
string
db_name
=
"SparseMatrix"
);
std
::
string
db_name
=
"SparseMatrix"
);
void
Close
();
private:
private:
rocksdb
::
DB
*
db_
;
rocksdb
::
DB
*
db_
;
std
::
string
db_name_
;
std
::
string
db_name_
;
...
...
kvdb/include/kvdb/rocksdb_impl.h
浏览文件 @
3a62e888
...
@@ -21,6 +21,7 @@ class RocksKVDB : public AbstractKVDB {
...
@@ -21,6 +21,7 @@ class RocksKVDB : public AbstractKVDB {
void
SetDBName
(
std
::
string
);
void
SetDBName
(
std
::
string
);
void
Set
(
std
::
string
key
,
std
::
string
value
);
void
Set
(
std
::
string
key
,
std
::
string
value
);
std
::
string
Get
(
std
::
string
key
);
std
::
string
Get
(
std
::
string
key
);
void
Close
();
~
RocksKVDB
();
~
RocksKVDB
();
private:
private:
...
...
kvdb/src/gtest_kvdb.cpp
浏览文件 @
3a62e888
...
@@ -54,6 +54,7 @@ TEST_F(KVDBTest, AbstractKVDB_Unit_Test) {
...
@@ -54,6 +54,7 @@ TEST_F(KVDBTest, AbstractKVDB_Unit_Test) {
std
::
string
val
=
kvdb
->
Get
(
std
::
to_string
(
i
));
std
::
string
val
=
kvdb
->
Get
(
std
::
to_string
(
i
));
ASSERT_EQ
(
val
,
std
::
to_string
(
i
*
2
));
ASSERT_EQ
(
val
,
std
::
to_string
(
i
*
2
));
}
}
kvdb
->
Close
();
}
}
TEST_F
(
KVDBTest
,
FileReader_Unit_Test
)
{
TEST_F
(
KVDBTest
,
FileReader_Unit_Test
)
{
...
@@ -82,43 +83,6 @@ TEST_F(KVDBTest, FileReader_Unit_Test) {
...
@@ -82,43 +83,6 @@ TEST_F(KVDBTest, FileReader_Unit_Test) {
ASSERT_NE
(
timestamp_2
,
timestamp_3
);
ASSERT_NE
(
timestamp_2
,
timestamp_3
);
}
}
#include <cmath>
#include <cmath>
TEST_F
(
KVDBTest
,
ParamDict_Unit_Test
)
{
std
::
string
test_in_filename
=
"abs_dict_reader_test_in.txt"
;
param_dict
->
SetFileReaderLst
({
test_in_filename
});
param_dict
->
SetReader
([](
std
::
string
text
)
{
auto
split
=
[](
const
std
::
string
&
s
,
std
::
vector
<
std
::
string
>&
sv
,
const
char
*
delim
=
" "
)
{
sv
.
clear
();
char
*
buffer
=
new
char
[
s
.
size
()
+
1
];
std
::
copy
(
s
.
begin
(),
s
.
end
(),
buffer
);
char
*
p
=
strtok
(
buffer
,
delim
);
do
{
sv
.
push_back
(
p
);
}
while
((
p
=
strtok
(
NULL
,
delim
)));
return
;
};
std
::
vector
<
std
::
string
>
text_split
;
split
(
text
,
text_split
,
" "
);
std
::
string
key
=
text_split
[
0
];
text_split
.
erase
(
text_split
.
begin
());
return
make_pair
(
key
,
text_split
);
});
param_dict
->
CreateKVDB
();
GenerateTestIn
(
test_in_filename
);
param_dict
->
UpdateBaseModel
();
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
seconds
(
2
));
std
::
vector
<
float
>
test_vec
=
param_dict
->
GetSparseValue
(
"1"
,
""
);
ASSERT_LT
(
fabs
(
test_vec
[
0
]
-
1.0
),
1e-2
);
UpdateTestIn
(
test_in_filename
);
param_dict
->
UpdateDeltaModel
();
}
void
GenerateTestIn
(
std
::
string
filename
)
{
void
GenerateTestIn
(
std
::
string
filename
)
{
std
::
ifstream
in_file
(
filename
);
std
::
ifstream
in_file
(
filename
);
if
(
in_file
.
good
())
{
if
(
in_file
.
good
())
{
...
...
kvdb/src/mock_param_dict_impl.cpp
浏览文件 @
3a62e888
...
@@ -140,4 +140,5 @@ void ParamDict::CreateKVDB() {
...
@@ -140,4 +140,5 @@ void ParamDict::CreateKVDB() {
this
->
back_db
->
CreateDB
();
this
->
back_db
->
CreateDB
();
}
}
ParamDict
::~
ParamDict
()
{}
ParamDict
::~
ParamDict
()
{
}
kvdb/src/paddle_rocksdb.cpp
浏览文件 @
3a62e888
...
@@ -48,6 +48,14 @@ void RocksDBWrapper::SetDBName(std::string db_name) {
...
@@ -48,6 +48,14 @@ void RocksDBWrapper::SetDBName(std::string db_name) {
this
->
db_name_
=
db_name
;
this
->
db_name_
=
db_name
;
}
}
void
RocksDBWrapper
::
Close
()
{
if
(
db_
!=
nullptr
)
{
db_
->
Close
();
delete
(
db_
);
db_
=
nullptr
;
}
}
std
::
shared_ptr
<
RocksDBWrapper
>
RocksDBWrapper
::
RocksDBWrapperFactory
(
std
::
shared_ptr
<
RocksDBWrapper
>
RocksDBWrapper
::
RocksDBWrapperFactory
(
std
::
string
db_name
)
{
std
::
string
db_name
)
{
return
std
::
make_shared
<
RocksDBWrapper
>
(
db_name
);
return
std
::
make_shared
<
RocksDBWrapper
>
(
db_name
);
...
...
kvdb/src/rockskvdb_impl.cpp
浏览文件 @
3a62e888
...
@@ -32,6 +32,12 @@ void RocksKVDB::Set(std::string key, std::string value) {
...
@@ -32,6 +32,12 @@ void RocksKVDB::Set(std::string key, std::string value) {
return
;
return
;
}
}
void
RocksKVDB
::
Close
()
{
this
->
db_
->
Close
();
}
std
::
string
RocksKVDB
::
Get
(
std
::
string
key
)
{
return
this
->
db_
->
Get
(
key
);
}
std
::
string
RocksKVDB
::
Get
(
std
::
string
key
)
{
return
this
->
db_
->
Get
(
key
);
}
RocksKVDB
::~
RocksKVDB
()
{}
RocksKVDB
::~
RocksKVDB
()
{
this
->
db_
->
Close
();
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录