Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Serving
提交
7c8783d3
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看板
提交
7c8783d3
编写于
7月 08, 2020
作者:
M
MRXLT
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refine cube_cli.cpp
上级
66cb0449
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
25 addition
and
60 deletion
+25
-60
core/cube/cube-api/src/cube_cli.cpp
core/cube/cube-api/src/cube_cli.cpp
+21
-58
python/examples/criteo_ctr_with_cube/benchmark_cube.sh
python/examples/criteo_ctr_with_cube/benchmark_cube.sh
+4
-2
未找到文件。
core/cube/cube-api/src/cube_cli.cpp
浏览文件 @
7c8783d3
...
...
@@ -31,8 +31,9 @@ DEFINE_bool(print_output, false, "print output flag");
DEFINE_int32
(
thread_num
,
1
,
"thread num"
);
std
::
atomic
<
int
>
g_concurrency
(
0
);
std
::
vector
<
uint64_t
>
time_list
;
std
::
vector
<
std
::
vector
<
uint64_t
>
>
time_list
;
std
::
vector
<
uint64_t
>
request_list
;
int
turns
=
1000000
/
FLAGS_batch
;
namespace
{
inline
uint64_t
time_diff
(
const
struct
timeval
&
start_time
,
...
...
@@ -97,7 +98,7 @@ int run(int argc, char** argv, int thread_id) {
while
(
g_concurrency
.
load
()
>=
FLAGS_thread_num
)
{
}
g_concurrency
++
;
time_list
[
thread_id
].
resize
(
turns
);
while
(
index
<
file_size
)
{
// uint64_t key = strtoul(buffer, NULL, 10);
...
...
@@ -121,47 +122,12 @@ int run(int argc, char** argv, int thread_id) {
}
++
seek_counter
;
uint64_t
seek_cost
=
time_diff
(
seek_start
,
seek_end
);
seek_cost_total
+=
seek_cost
;
if
(
seek_cost
>
seek_cost_max
)
{
seek_cost_max
=
seek_cost
;
}
if
(
seek_cost
<
seek_cost_min
)
{
seek_cost_min
=
seek_cost
;
}
time_list
[
thread_id
][
request
-
1
]
=
seek_cost
;
keys
.
clear
();
values
.
clear
();
}
}
/*
if (keys.size() > 0) {
int ret = 0;
values.resize(keys.size());
TIME_FLAG(seek_start);
ret = cube->seek(FLAGS_dict, keys, &values);
TIME_FLAG(seek_end);
if (ret != 0) {
LOG(WARNING) << "cube seek failed";
} else if (FLAGS_print_output) {
for (size_t i = 0; i < keys.size(); ++i) {
fprintf(stdout,
"key:%lu value:%s\n",
keys[i],
string_to_hex(values[i].buff).c_str());
}
}
++seek_counter;
uint64_t seek_cost = time_diff(seek_start, seek_end);
seek_cost_total += seek_cost;
if (seek_cost > seek_cost_max) {
seek_cost_max = seek_cost;
}
if (seek_cost < seek_cost_min) {
seek_cost_min = seek_cost;
}
}
*/
g_concurrency
--
;
// fclose(key_file);
...
...
@@ -171,12 +137,6 @@ int run(int argc, char** argv, int thread_id) {
LOG
(
WARNING
)
<<
"destroy cube api failed err="
<<
ret
;
}
uint64_t
seek_cost_avg
=
seek_cost_total
/
seek_counter
;
LOG
(
INFO
)
<<
"seek cost avg = "
<<
seek_cost_avg
;
LOG
(
INFO
)
<<
"seek cost max = "
<<
seek_cost_max
;
LOG
(
INFO
)
<<
"seek cost min = "
<<
seek_cost_min
;
time_list
[
thread_id
]
=
seek_cost_avg
;
request_list
[
thread_id
]
=
request
;
return
0
;
...
...
@@ -202,24 +162,27 @@ int run_m(int argc, char** argv) {
uint64_t
min_time
=
1000000
;
uint64_t
request_num
=
0
;
for
(
int
i
=
0
;
i
<
thread_num
;
i
++
)
{
sum_time
+=
time_list
[
i
];
if
(
time_list
[
i
]
>
max_time
)
{
max_time
=
time_list
[
i
];
}
if
(
time_list
[
i
]
<
min_time
)
{
min_time
=
time_list
[
i
];
for
(
int
j
=
0
;
j
<
request_list
[
i
];
j
++
)
{
sum_time
+=
time_list
[
i
][
j
];
if
(
time_list
[
i
][
j
]
>
max_time
)
{
max_time
=
time_list
[
i
][
j
];
}
if
(
time_list
[
i
][
j
]
<
min_time
)
{
min_time
=
time_list
[
i
][
j
];
}
}
request_num
+=
request_list
[
i
];
}
uint64_t
mean_time
=
sum_time
/
thread_num
;
uint64_t
mean_time
=
sum_time
/
(
thread_num
*
turns
)
;
uint64_t
main_time
=
time_diff
(
main_start
,
main_end
);
LOG
(
INFO
)
<<
thread_num
<<
" thread seek cost"
<<
" avg = "
<<
std
::
to_string
(
mean_time
)
<<
" max = "
<<
std
::
to_string
(
max_time
)
<<
" min = "
<<
std
::
to_string
(
min_time
);
LOG
(
INFO
)
<<
" total_request = "
<<
std
::
to_string
(
request_num
)
<<
" speed = "
<<
std
::
to_string
(
request_num
*
1000000
/
main_time
)
// mean_time us
LOG
(
INFO
)
<<
"
\n
"
<<
thread_num
<<
" thread seek cost"
<<
"
\n
avg = "
<<
std
::
to_string
(
mean_time
)
<<
"
\n
max = "
<<
std
::
to_string
(
max_time
)
<<
"
\n
min = "
<<
std
::
to_string
(
min_time
);
LOG
(
INFO
)
<<
"
\n
total_request = "
<<
std
::
to_string
(
request_num
)
<<
"
\n
speed = "
<<
std
::
to_string
(
request_num
*
1000000
/
main_time
)
// mean_time us
<<
" query per second"
;
return
0
;
}
...
...
python/examples/criteo_ctr_with_cube/benchmark_cube.sh
浏览文件 @
7c8783d3
rm
profile_log
#
wget https://paddle-serving.bj.bcebos.com/unittest/ctr_cube_unittest.tar.gz --no-check-certificate
wget https://paddle-serving.bj.bcebos.com/unittest/ctr_cube_unittest.tar.gz
--no-check-certificate
tar
xf ctr_cube_unittest.tar.gz
mv
models/ctr_client_conf ./
mv
models/ctr_serving_model_kv ./
mv
models/data ./cube/
#
wget https://paddle-serving.bj.bcebos.com/others/cube_app.tar.gz --no-check-certificate
wget https://paddle-serving.bj.bcebos.com/others/cube_app.tar.gz
--no-check-certificate
tar
xf cube_app.tar.gz
mv
cube_app/cube
*
./cube/
sh cube_prepare.sh &
...
...
@@ -24,7 +24,9 @@ do
echo
"========================================"
echo
"batch size :
$batch_size
"
>>
profile_log
echo
"thread num :
$thread_num
"
>>
profile_log
tail
-n
7 profile |
head
-n
4
>>
profile_log
tail
-n
2 profile
>>
profile_log
done
done
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录