Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
milvus
提交
bbc2c907
milvus
项目概览
BaiXuePrincess
/
milvus
与 Fork 源项目一致
从无法访问的项目Fork
通知
7
Star
4
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
milvus
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
bbc2c907
编写于
10月 21, 2019
作者:
S
starlord
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
format code
Former-commit-id: 1e15f2112b93a17958c2e663fafc79cf39dd3148
上级
0d33778a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
17 addition
and
16 deletion
+17
-16
core/src/scheduler/task/SearchTask.cpp
core/src/scheduler/task/SearchTask.cpp
+2
-2
core/src/scheduler/task/SearchTask.h
core/src/scheduler/task/SearchTask.h
+4
-4
core/unittest/db/test_search.cpp
core/unittest/db/test_search.cpp
+11
-10
未找到文件。
core/src/scheduler/task/SearchTask.cpp
浏览文件 @
bbc2c907
...
@@ -307,8 +307,8 @@ XSearchTask::MergeTopkToResultSet(const std::vector<int64_t>& input_ids, const s
...
@@ -307,8 +307,8 @@ XSearchTask::MergeTopkToResultSet(const std::vector<int64_t>& input_ids, const s
}
}
}
}
//void
//
void
//XSearchTask::MergeTopkArray(std::vector<int64_t>& tar_ids, std::vector<float>& tar_distance, uint64_t& tar_input_k,
//
XSearchTask::MergeTopkArray(std::vector<int64_t>& tar_ids, std::vector<float>& tar_distance, uint64_t& tar_input_k,
// const std::vector<int64_t>& src_ids, const std::vector<float>& src_distance,
// const std::vector<int64_t>& src_ids, const std::vector<float>& src_distance,
// uint64_t src_input_k, uint64_t nq, uint64_t topk, bool ascending) {
// uint64_t src_input_k, uint64_t nq, uint64_t topk, bool ascending) {
// if (src_ids.empty() || src_distance.empty()) {
// if (src_ids.empty() || src_distance.empty()) {
...
...
core/src/scheduler/task/SearchTask.h
浏览文件 @
bbc2c907
...
@@ -42,10 +42,10 @@ class XSearchTask : public Task {
...
@@ -42,10 +42,10 @@ class XSearchTask : public Task {
MergeTopkToResultSet
(
const
std
::
vector
<
int64_t
>&
input_ids
,
const
std
::
vector
<
float
>&
input_distance
,
MergeTopkToResultSet
(
const
std
::
vector
<
int64_t
>&
input_ids
,
const
std
::
vector
<
float
>&
input_distance
,
uint64_t
input_k
,
uint64_t
nq
,
uint64_t
topk
,
bool
ascending
,
scheduler
::
ResultSet
&
result
);
uint64_t
input_k
,
uint64_t
nq
,
uint64_t
topk
,
bool
ascending
,
scheduler
::
ResultSet
&
result
);
// static void
// static void
// MergeTopkArray(std::vector<int64_t>& tar_ids, std::vector<float>& tar_distance, uint64_t& tar_input_k,
// MergeTopkArray(std::vector<int64_t>& tar_ids, std::vector<float>& tar_distance, uint64_t& tar_input_k,
// const std::vector<int64_t>& src_ids, const std::vector<float>& src_distance, uint64_t src_input_k,
// const std::vector<int64_t>& src_ids, const std::vector<float>& src_distance, uint64_t
//
uint64_t nq, uint64_t topk, bool ascending);
// src_input_k,
uint64_t nq, uint64_t topk, bool ascending);
public:
public:
TableFileSchemaPtr
file_
;
TableFileSchemaPtr
file_
;
...
...
core/unittest/db/test_search.cpp
浏览文件 @
bbc2c907
...
@@ -46,7 +46,7 @@ BuildResult(std::vector<int64_t>& output_ids,
...
@@ -46,7 +46,7 @@ BuildResult(std::vector<int64_t>& output_ids,
output_distance
[
i
*
topk
+
j
]
=
ascending
?
(
j
+
drand48
())
:
((
input_k
-
j
)
+
drand48
());
output_distance
[
i
*
topk
+
j
]
=
ascending
?
(
j
+
drand48
())
:
((
input_k
-
j
)
+
drand48
());
}
}
//insert invalid items
//insert invalid items
for
(
uint64_t
j
=
input_k
;
j
<
topk
;
j
++
)
{
for
(
uint64_t
j
=
input_k
;
j
<
topk
;
j
++
)
{
output_ids
[
i
*
topk
+
j
]
=
-
1
;
output_ids
[
i
*
topk
+
j
]
=
-
1
;
output_distance
[
i
*
topk
+
j
]
=
-
1.0
;
output_distance
[
i
*
topk
+
j
]
=
-
1.0
;
}
}
...
@@ -113,7 +113,7 @@ CheckTopkResult(const std::vector<int64_t>& input_ids_1,
...
@@ -113,7 +113,7 @@ CheckTopkResult(const std::vector<int64_t>& input_ids_1,
uint64_t
n
=
std
::
min
(
topk
,
result
[
i
].
size
());
uint64_t
n
=
std
::
min
(
topk
,
result
[
i
].
size
());
for
(
uint64_t
j
=
0
;
j
<
n
;
j
++
)
{
for
(
uint64_t
j
=
0
;
j
<
n
;
j
++
)
{
if
(
result
[
i
][
j
].
first
<
0
)
{
if
(
result
[
i
][
j
].
first
<
0
)
{
continue
;
continue
;
}
}
if
(
src_vec
[
j
]
!=
result
[
i
][
j
].
second
)
{
if
(
src_vec
[
j
]
!=
result
[
i
][
j
].
second
)
{
...
@@ -126,7 +126,8 @@ CheckTopkResult(const std::vector<int64_t>& input_ids_1,
...
@@ -126,7 +126,8 @@ CheckTopkResult(const std::vector<int64_t>& input_ids_1,
}
// namespace
}
// namespace
void
MergeTopkToResultSetTest
(
uint64_t
topk_1
,
uint64_t
topk_2
,
uint64_t
nq
,
uint64_t
topk
,
bool
ascending
)
{
void
MergeTopkToResultSetTest
(
uint64_t
topk_1
,
uint64_t
topk_2
,
uint64_t
nq
,
uint64_t
topk
,
bool
ascending
)
{
std
::
vector
<
int64_t
>
ids1
,
ids2
;
std
::
vector
<
int64_t
>
ids1
,
ids2
;
std
::
vector
<
float
>
dist1
,
dist2
;
std
::
vector
<
float
>
dist1
,
dist2
;
ms
::
ResultSet
result
;
ms
::
ResultSet
result
;
...
@@ -150,12 +151,12 @@ TEST(DBSearchTest, MERGE_RESULT_SET_TEST) {
...
@@ -150,12 +151,12 @@ TEST(DBSearchTest, MERGE_RESULT_SET_TEST) {
MergeTopkToResultSetTest
(
TOP_K
,
TOP_K
,
NQ
,
TOP_K
,
false
);
MergeTopkToResultSetTest
(
TOP_K
,
TOP_K
,
NQ
,
TOP_K
,
false
);
/* test3, id1/dist1 small topk */
/* test3, id1/dist1 small topk */
MergeTopkToResultSetTest
(
TOP_K
/
2
,
TOP_K
,
NQ
,
TOP_K
,
true
);
MergeTopkToResultSetTest
(
TOP_K
/
2
,
TOP_K
,
NQ
,
TOP_K
,
true
);
MergeTopkToResultSetTest
(
TOP_K
/
2
,
TOP_K
,
NQ
,
TOP_K
,
false
);
MergeTopkToResultSetTest
(
TOP_K
/
2
,
TOP_K
,
NQ
,
TOP_K
,
false
);
/* test4, id1/dist1 small topk, id2/dist2 small topk */
/* test4, id1/dist1 small topk, id2/dist2 small topk */
MergeTopkToResultSetTest
(
TOP_K
/
2
,
TOP_K
/
3
,
NQ
,
TOP_K
,
true
);
MergeTopkToResultSetTest
(
TOP_K
/
2
,
TOP_K
/
3
,
NQ
,
TOP_K
,
true
);
MergeTopkToResultSetTest
(
TOP_K
/
2
,
TOP_K
/
3
,
NQ
,
TOP_K
,
false
);
MergeTopkToResultSetTest
(
TOP_K
/
2
,
TOP_K
/
3
,
NQ
,
TOP_K
,
false
);
}
}
//void MergeTopkArrayTest(uint64_t topk_1, uint64_t topk_2, uint64_t nq, uint64_t topk, bool ascending) {
//void MergeTopkArrayTest(uint64_t topk_1, uint64_t topk_2, uint64_t nq, uint64_t topk, bool ascending) {
...
@@ -224,8 +225,8 @@ TEST(DBSearchTest, REDUCE_PERF_TEST) {
...
@@ -224,8 +225,8 @@ TEST(DBSearchTest, REDUCE_PERF_TEST) {
std
::
vector
<
int32_t
>
thread_vec
=
{
4
,
8
};
std
::
vector
<
int32_t
>
thread_vec
=
{
4
,
8
};
std
::
vector
<
int32_t
>
nq_vec
=
{
1
,
10
,
100
};
std
::
vector
<
int32_t
>
nq_vec
=
{
1
,
10
,
100
};
std
::
vector
<
int32_t
>
topk_vec
=
{
1
,
4
,
16
,
64
};
std
::
vector
<
int32_t
>
topk_vec
=
{
1
,
4
,
16
,
64
};
int32_t
NQ
=
nq_vec
[
nq_vec
.
size
()
-
1
];
int32_t
NQ
=
nq_vec
[
nq_vec
.
size
()
-
1
];
int32_t
TOPK
=
topk_vec
[
topk_vec
.
size
()
-
1
];
int32_t
TOPK
=
topk_vec
[
topk_vec
.
size
()
-
1
];
std
::
vector
<
std
::
vector
<
int64_t
>>
id_vec
;
std
::
vector
<
std
::
vector
<
int64_t
>>
id_vec
;
std
::
vector
<
std
::
vector
<
float
>>
dist_vec
;
std
::
vector
<
std
::
vector
<
float
>>
dist_vec
;
...
@@ -255,7 +256,7 @@ TEST(DBSearchTest, REDUCE_PERF_TEST) {
...
@@ -255,7 +256,7 @@ TEST(DBSearchTest, REDUCE_PERF_TEST) {
}
}
std
::
string
str1
=
"Method-1 "
+
std
::
to_string
(
max_thread_num
)
+
" "
+
std
::
string
str1
=
"Method-1 "
+
std
::
to_string
(
max_thread_num
)
+
" "
+
std
::
to_string
(
nq
)
+
" "
+
std
::
to_string
(
top_k
);
std
::
to_string
(
nq
)
+
" "
+
std
::
to_string
(
top_k
);
milvus
::
TimeRecorder
rc1
(
str1
);
milvus
::
TimeRecorder
rc1
(
str1
);
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录