Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
milvus
提交
fc5a6b3c
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,发现更多精彩内容 >>
提交
fc5a6b3c
编写于
10月 14, 2019
作者:
Y
Yu Kun
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'upstream/branch-0.5.0' into branch-0.5.0-yk
Former-commit-id: dd16511856cac95f72d9dbb07301f5c11ffebeb9
上级
96c2f9ca
325bb1dc
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
111 addition
and
67 deletion
+111
-67
ci/jenkinsfile/milvus_build.groovy
ci/jenkinsfile/milvus_build.groovy
+1
-1
ci/jenkinsfile/milvus_build_no_ut.groovy
ci/jenkinsfile/milvus_build_no_ut.groovy
+1
-1
core/CHANGELOG.md
core/CHANGELOG.md
+1
-0
core/cmake/ThirdPartyPackages.cmake
core/cmake/ThirdPartyPackages.cmake
+8
-4
core/src/index/cmake/ThirdPartyPackagesCore.cmake
core/src/index/cmake/ThirdPartyPackagesCore.cmake
+4
-0
core/src/index/knowhere/knowhere/index/vector_index/IndexIVFSQHybrid.cpp
...knowhere/knowhere/index/vector_index/IndexIVFSQHybrid.cpp
+19
-2
core/src/scheduler/task/SearchTask.cpp
core/src/scheduler/task/SearchTask.cpp
+6
-3
core/unittest/db/test_search.cpp
core/unittest/db/test_search.cpp
+71
-56
未找到文件。
ci/jenkinsfile/milvus_build.groovy
浏览文件 @
fc5a6b3c
container
(
'milvus-build-env'
)
{
timeout
(
time:
4
0
,
unit:
'MINUTES'
)
{
timeout
(
time:
12
0
,
unit:
'MINUTES'
)
{
gitlabCommitStatus
(
name:
'Build Engine'
)
{
dir
(
"milvus_engine"
)
{
try
{
...
...
ci/jenkinsfile/milvus_build_no_ut.groovy
浏览文件 @
fc5a6b3c
container
(
'milvus-build-env'
)
{
timeout
(
time:
4
0
,
unit:
'MINUTES'
)
{
timeout
(
time:
12
0
,
unit:
'MINUTES'
)
{
gitlabCommitStatus
(
name:
'Build Engine'
)
{
dir
(
"milvus_engine"
)
{
try
{
...
...
core/CHANGELOG.md
浏览文件 @
fc5a6b3c
...
...
@@ -20,6 +20,7 @@ Please mark all change in change log and use the ticket from JIRA.
-
MS-647 - [monitor] grafana display average cpu-temp
-
MS-644 - Search crashed with index-type: flat
-
MS-624 - Search vectors failed if time ranges long enough
-
MS-652 - IVFSQH quantization double free
## Improvement
-
MS-552 - Add and change the easylogging library
...
...
core/cmake/ThirdPartyPackages.cmake
浏览文件 @
fc5a6b3c
...
...
@@ -158,6 +158,10 @@ if(USE_JFROG_CACHE STREQUAL "ON")
endif
()
set
(
THIRDPARTY_PACKAGE_CACHE
"
${
THIRDPARTY_DIR
}
/cache"
)
if
(
NOT EXISTS
${
THIRDPARTY_PACKAGE_CACHE
}
)
message
(
STATUS
"Will create cached directory:
${
THIRDPARTY_PACKAGE_CACHE
}
"
)
file
(
MAKE_DIRECTORY
${
THIRDPARTY_PACKAGE_CACHE
}
)
endif
()
endif
()
macro
(
resolve_dependency DEPENDENCY_NAME
)
...
...
@@ -324,8 +328,8 @@ if(DEFINED ENV{MILVUS_SQLITE_ORM_URL})
set
(
SQLITE_ORM_SOURCE_URL
"$ENV{MILVUS_SQLITE_ORM_URL}"
)
else
()
set
(
SQLITE_ORM_SOURCE_URL
"http://192.168.1.105:6060/Test/sqlite_orm/-/archive/master/sqlite_orm-master.zip"
)
#
"https://github.com/fnc12/sqlite_orm/archive/${SQLITE_ORM_VERSION}.zip")
#
"http://192.168.1.105:6060/Test/sqlite_orm/-/archive/master/sqlite_orm-master.zip")
"https://github.com/fnc12/sqlite_orm/archive/
${
SQLITE_ORM_VERSION
}
.zip"
)
endif
()
set
(
SQLITE_ORM_MD5
"ba9a405a8a1421c093aa8ce988ff8598"
)
...
...
@@ -370,9 +374,9 @@ if(DEFINED ENV{MILVUS_GRPC_URL})
set
(
GRPC_SOURCE_URL
"$ENV{MILVUS_GRPC_URL}"
)
else
()
set
(
GRPC_SOURCE_URL
"http
://git.zilliz.tech/kun.yu/grpc/-/archive/master/grpc-master.tar.gz
"
)
"http
s://github.com/youny626/grpc-milvus/archive/
${
GRPC_VERSION
}
.zip
"
)
endif
()
set
(
GRPC_MD5
"
7ec59ad54c85a12dcbbfede09bf413a9
"
)
set
(
GRPC_MD5
"
0362ba219f59432c530070b5f5c3df73
"
)
# ----------------------------------------------------------------------
...
...
core/src/index/cmake/ThirdPartyPackagesCore.cmake
浏览文件 @
fc5a6b3c
...
...
@@ -125,6 +125,10 @@ endif()
if
(
USE_JFROG_CACHE STREQUAL
"ON"
)
set
(
JFROG_ARTFACTORY_CACHE_URL
"
${
JFROG_ARTFACTORY_URL
}
/milvus/thirdparty/cache/
${
CMAKE_OS_NAME
}
/
${
KNOWHERE_BUILD_ARCH
}
/
${
BUILD_TYPE
}
"
)
set
(
THIRDPARTY_PACKAGE_CACHE
"
${
THIRDPARTY_DIR
}
/cache"
)
if
(
NOT EXISTS
${
THIRDPARTY_PACKAGE_CACHE
}
)
message
(
STATUS
"Will create cached directory:
${
THIRDPARTY_PACKAGE_CACHE
}
"
)
file
(
MAKE_DIRECTORY
${
THIRDPARTY_PACKAGE_CACHE
}
)
endif
()
endif
()
macro
(
resolve_dependency DEPENDENCY_NAME
)
...
...
core/src/index/knowhere/knowhere/index/vector_index/IndexIVFSQHybrid.cpp
浏览文件 @
fc5a6b3c
...
...
@@ -27,6 +27,7 @@
namespace
knowhere
{
#ifdef CUSTOMIZATION
IndexModelPtr
IVFSQHybrid
::
Train
(
const
DatasetPtr
&
dataset
,
const
Config
&
config
)
{
auto
build_cfg
=
std
::
dynamic_pointer_cast
<
IVFSQCfg
>
(
config
);
...
...
@@ -79,8 +80,24 @@ IVFSQHybrid::CopyGpuToCpu(const Config& config) {
VectorIndexPtr
IVFSQHybrid
::
CopyCpuToGpu
(
const
int64_t
&
device_id
,
const
Config
&
config
)
{
auto
p
=
CopyCpuToGpuWithQuantizer
(
device_id
,
config
);
return
p
.
first
;
if
(
auto
res
=
FaissGpuResourceMgr
::
GetInstance
().
GetRes
(
device_id
))
{
ResScope
rs
(
res
,
device_id
,
false
);
faiss
::
gpu
::
GpuClonerOptions
option
;
option
.
allInGpu
=
true
;
faiss
::
IndexComposition
index_composition
;
index_composition
.
index
=
index_
.
get
();
index_composition
.
quantizer
=
nullptr
;
index_composition
.
mode
=
0
;
// copy all
auto
gpu_index
=
faiss
::
gpu
::
index_cpu_to_gpu
(
res
->
faiss_res
.
get
(),
device_id
,
&
index_composition
,
&
option
);
std
::
shared_ptr
<
faiss
::
Index
>
device_index
=
std
::
shared_ptr
<
faiss
::
Index
>
(
gpu_index
);
auto
new_idx
=
std
::
make_shared
<
IVFSQHybrid
>
(
device_index
,
device_id
,
res
);
return
new_idx
;
}
else
{
KNOWHERE_THROW_MSG
(
"CopyCpuToGpu Error, can't get gpu_resource"
);
}
}
void
...
...
core/src/scheduler/task/SearchTask.cpp
浏览文件 @
fc5a6b3c
...
...
@@ -315,10 +315,10 @@ XSearchTask::MergeTopkArray(std::vector<int64_t>& tar_ids, std::vector<float>& t
return
;
}
std
::
vector
<
int64_t
>
id_buf
(
nq
*
topk
,
-
1
);
std
::
vector
<
float
>
dist_buf
(
nq
*
topk
,
0.0
);
uint64_t
output_k
=
std
::
min
(
topk
,
tar_input_k
+
src_input_k
);
std
::
vector
<
int64_t
>
id_buf
(
nq
*
output_k
,
-
1
);
std
::
vector
<
float
>
dist_buf
(
nq
*
output_k
,
0.0
);
uint64_t
buf_k
,
src_k
,
tar_k
;
uint64_t
src_idx
,
tar_idx
,
buf_idx
;
uint64_t
src_input_k_multi_i
,
tar_input_k_multi_i
,
buf_k_multi_i
;
...
...
@@ -349,6 +349,7 @@ XSearchTask::MergeTopkArray(std::vector<int64_t>& tar_ids, std::vector<float>& t
if
(
src_k
<
src_input_k
)
{
while
(
buf_k
<
output_k
&&
src_k
<
src_input_k
)
{
src_idx
=
src_input_k_multi_i
+
src_k
;
buf_idx
=
buf_k_multi_i
+
buf_k
;
id_buf
[
buf_idx
]
=
src_ids
[
src_idx
];
dist_buf
[
buf_idx
]
=
src_distance
[
src_idx
];
src_k
++
;
...
...
@@ -356,6 +357,8 @@ XSearchTask::MergeTopkArray(std::vector<int64_t>& tar_ids, std::vector<float>& t
}
}
else
{
while
(
buf_k
<
output_k
&&
tar_k
<
tar_input_k
)
{
tar_idx
=
tar_input_k_multi_i
+
tar_k
;
buf_idx
=
buf_k_multi_i
+
buf_k
;
id_buf
[
buf_idx
]
=
tar_ids
[
tar_idx
];
dist_buf
[
buf_idx
]
=
tar_distance
[
tar_idx
];
tar_k
++
;
...
...
core/unittest/db/test_search.cpp
浏览文件 @
fc5a6b3c
...
...
@@ -110,87 +110,102 @@ CheckTopkResult(const std::vector<int64_t>& input_ids_1,
}
// namespace
TEST
(
DBSearchTest
,
TOPK_TEST
)
{
uint64_t
NQ
=
15
;
uint64_t
TOP_K
=
64
;
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
<
float
>
dist1
,
dist2
;
ms
::
ResultSet
result
;
BuildResult
(
ids1
,
dist1
,
topk_1
,
nq
,
ascending
);
BuildResult
(
ids2
,
dist2
,
topk_2
,
nq
,
ascending
);
ms
::
XSearchTask
::
MergeTopkToResultSet
(
ids1
,
dist1
,
topk_1
,
nq
,
topk
,
ascending
,
result
);
ms
::
XSearchTask
::
MergeTopkToResultSet
(
ids2
,
dist2
,
topk_2
,
nq
,
topk
,
ascending
,
result
);
CheckTopkResult
(
ids1
,
dist1
,
ids2
,
dist2
,
topk
,
nq
,
ascending
,
result
);
}
TEST
(
DBSearchTest
,
MERGE_RESULT_SET_TEST
)
{
uint64_t
NQ
=
15
;
uint64_t
TOP_K
=
64
;
/* test1, id1/dist1 valid, id2/dist2 empty */
ascending
=
true
;
BuildResult
(
ids1
,
dist1
,
TOP_K
,
NQ
,
ascending
);
ms
::
XSearchTask
::
MergeTopkToResultSet
(
ids1
,
dist1
,
TOP_K
,
NQ
,
TOP_K
,
ascending
,
result
);
CheckTopkResult
(
ids1
,
dist1
,
ids2
,
dist2
,
TOP_K
,
NQ
,
ascending
,
result
);
MergeTopkToResultSetTest
(
TOP_K
,
0
,
NQ
,
TOP_K
,
true
);
MergeTopkToResultSetTest
(
TOP_K
,
0
,
NQ
,
TOP_K
,
false
);
/* test2, id1/dist1 valid, id2/dist2 valid */
BuildResult
(
ids2
,
dist2
,
TOP_K
,
NQ
,
ascending
);
ms
::
XSearchTask
::
MergeTopkToResultSet
(
ids2
,
dist2
,
TOP_K
,
NQ
,
TOP_K
,
ascending
,
result
);
CheckTopkResult
(
ids1
,
dist1
,
ids2
,
dist2
,
TOP_K
,
NQ
,
ascending
,
result
);
MergeTopkToResultSetTest
(
TOP_K
,
TOP_K
,
NQ
,
TOP_K
,
true
);
MergeTopkToResultSetTest
(
TOP_K
,
TOP_K
,
NQ
,
TOP_K
,
false
);
/* test3, id1/dist1 small topk */
ids1
.
clear
();
dist1
.
clear
();
result
.
clear
();
BuildResult
(
ids1
,
dist1
,
TOP_K
/
2
,
NQ
,
ascending
);
ms
::
XSearchTask
::
MergeTopkToResultSet
(
ids1
,
dist1
,
TOP_K
/
2
,
NQ
,
TOP_K
,
ascending
,
result
);
ms
::
XSearchTask
::
MergeTopkToResultSet
(
ids2
,
dist2
,
TOP_K
,
NQ
,
TOP_K
,
ascending
,
result
);
CheckTopkResult
(
ids1
,
dist1
,
ids2
,
dist2
,
TOP_K
,
NQ
,
ascending
,
result
);
MergeTopkToResultSetTest
(
TOP_K
/
2
,
TOP_K
,
NQ
,
TOP_K
,
true
);
MergeTopkToResultSetTest
(
TOP_K
/
2
,
TOP_K
,
NQ
,
TOP_K
,
false
);
/* test4, id1/dist1 small topk, id2/dist2 small topk */
ids2
.
clear
();
dist2
.
clear
();
result
.
clear
();
BuildResult
(
ids2
,
dist2
,
TOP_K
/
3
,
NQ
,
ascending
);
ms
::
XSearchTask
::
MergeTopkToResultSet
(
ids1
,
dist1
,
TOP_K
/
2
,
NQ
,
TOP_K
,
ascending
,
result
);
ms
::
XSearchTask
::
MergeTopkToResultSet
(
ids2
,
dist2
,
TOP_K
/
3
,
NQ
,
TOP_K
,
ascending
,
result
);
CheckTopkResult
(
ids1
,
dist1
,
ids2
,
dist2
,
TOP_K
,
NQ
,
ascending
,
result
);
/////////////////////////////////////////////////////////////////////////////////////////
ascending
=
false
;
ids1
.
clear
();
dist1
.
clear
();
ids2
.
clear
();
dist2
.
clear
();
result
.
clear
();
MergeTopkToResultSetTest
(
TOP_K
/
2
,
TOP_K
/
3
,
NQ
,
TOP_K
,
true
);
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
)
{
std
::
vector
<
int64_t
>
ids1
,
ids2
;
std
::
vector
<
float
>
dist1
,
dist2
;
ms
::
ResultSet
result
;
BuildResult
(
ids1
,
dist1
,
topk_1
,
nq
,
ascending
);
BuildResult
(
ids2
,
dist2
,
topk_2
,
nq
,
ascending
);
uint64_t
result_topk
=
std
::
min
(
topk
,
topk_1
+
topk_2
);
ms
::
XSearchTask
::
MergeTopkArray
(
ids1
,
dist1
,
topk_1
,
ids2
,
dist2
,
topk_2
,
nq
,
topk
,
ascending
);
if
(
ids1
.
size
()
!=
result_topk
*
nq
)
{
std
::
cout
<<
ids1
.
size
()
<<
" "
<<
result_topk
*
nq
<<
std
::
endl
;
}
ASSERT_TRUE
(
ids1
.
size
()
==
result_topk
*
nq
);
ASSERT_TRUE
(
dist1
.
size
()
==
result_topk
*
nq
);
for
(
uint64_t
i
=
0
;
i
<
nq
;
i
++
)
{
for
(
uint64_t
k
=
1
;
k
<
result_topk
;
k
++
)
{
if
(
ascending
)
{
if
(
dist1
[
i
*
result_topk
+
k
]
<
dist1
[
i
*
result_topk
+
k
-
1
])
{
std
::
cout
<<
dist1
[
i
*
result_topk
+
k
-
1
]
<<
" "
<<
dist1
[
i
*
result_topk
+
k
]
<<
std
::
endl
;
}
ASSERT_TRUE
(
dist1
[
i
*
result_topk
+
k
]
>=
dist1
[
i
*
result_topk
+
k
-
1
]);
}
else
{
if
(
dist1
[
i
*
result_topk
+
k
]
>
dist1
[
i
*
result_topk
+
k
-
1
])
{
std
::
cout
<<
dist1
[
i
*
result_topk
+
k
-
1
]
<<
" "
<<
dist1
[
i
*
result_topk
+
k
]
<<
std
::
endl
;
}
ASSERT_TRUE
(
dist1
[
i
*
result_topk
+
k
]
<=
dist1
[
i
*
result_topk
+
k
-
1
]);
}
}
}
}
TEST
(
DBSearchTest
,
MERGE_ARRAY_TEST
)
{
uint64_t
NQ
=
15
;
uint64_t
TOP_K
=
64
;
/* test1, id1/dist1 valid, id2/dist2 empty */
BuildResult
(
ids1
,
dist1
,
TOP_K
,
NQ
,
ascending
);
ms
::
XSearchTask
::
MergeTopkToResultSet
(
ids1
,
dist1
,
TOP_K
,
NQ
,
TOP_K
,
ascending
,
result
);
CheckTopkResult
(
ids1
,
dist1
,
ids2
,
dist2
,
TOP_K
,
NQ
,
ascending
,
result
);
MergeTopkArrayTest
(
TOP_K
,
0
,
NQ
,
TOP_K
,
true
);
MergeTopkArrayTest
(
TOP_K
,
0
,
NQ
,
TOP_K
,
false
);
MergeTopkArrayTest
(
0
,
TOP_K
,
NQ
,
TOP_K
,
true
);
MergeTopkArrayTest
(
0
,
TOP_K
,
NQ
,
TOP_K
,
false
);
/* test2, id1/dist1 valid, id2/dist2 valid */
BuildResult
(
ids2
,
dist2
,
TOP_K
,
NQ
,
ascending
);
ms
::
XSearchTask
::
MergeTopkToResultSet
(
ids2
,
dist2
,
TOP_K
,
NQ
,
TOP_K
,
ascending
,
result
);
CheckTopkResult
(
ids1
,
dist1
,
ids2
,
dist2
,
TOP_K
,
NQ
,
ascending
,
result
);
MergeTopkArrayTest
(
TOP_K
,
TOP_K
,
NQ
,
TOP_K
,
true
);
MergeTopkArrayTest
(
TOP_K
,
TOP_K
,
NQ
,
TOP_K
,
false
);
/* test3, id1/dist1 small topk */
ids1
.
clear
();
dist1
.
clear
();
result
.
clear
();
BuildResult
(
ids1
,
dist1
,
TOP_K
/
2
,
NQ
,
ascending
);
ms
::
XSearchTask
::
MergeTopkToResultSet
(
ids1
,
dist1
,
TOP_K
/
2
,
NQ
,
TOP_K
,
ascending
,
result
);
ms
::
XSearchTask
::
MergeTopkToResultSet
(
ids2
,
dist2
,
TOP_K
,
NQ
,
TOP_K
,
ascending
,
result
);
CheckTopkResult
(
ids1
,
dist1
,
ids2
,
dist2
,
TOP_K
,
NQ
,
ascending
,
result
);
MergeTopkArrayTest
(
TOP_K
/
2
,
TOP_K
,
NQ
,
TOP_K
,
true
);
MergeTopkArrayTest
(
TOP_K
/
2
,
TOP_K
,
NQ
,
TOP_K
,
false
);
MergeTopkArrayTest
(
TOP_K
,
TOP_K
/
2
,
NQ
,
TOP_K
,
true
);
MergeTopkArrayTest
(
TOP_K
,
TOP_K
/
2
,
NQ
,
TOP_K
,
false
);
/* test4, id1/dist1 small topk, id2/dist2 small topk */
ids2
.
clear
();
dist2
.
clear
();
result
.
clear
();
BuildResult
(
ids2
,
dist2
,
TOP_K
/
3
,
NQ
,
ascending
);
ms
::
XSearchTask
::
MergeTopkToResultSet
(
ids1
,
dist1
,
TOP_K
/
2
,
NQ
,
TOP_K
,
ascending
,
result
);
ms
::
XSearchTask
::
MergeTopkToResultSet
(
ids2
,
dist2
,
TOP_K
/
3
,
NQ
,
TOP_K
,
ascending
,
result
);
CheckTopkResult
(
ids1
,
dist1
,
ids2
,
dist2
,
TOP_K
,
NQ
,
ascending
,
result
);
MergeTopkArrayTest
(
TOP_K
/
2
,
TOP_K
/
3
,
NQ
,
TOP_K
,
true
);
MergeTopkArrayTest
(
TOP_K
/
2
,
TOP_K
/
3
,
NQ
,
TOP_K
,
false
);
MergeTopkArrayTest
(
TOP_K
/
3
,
TOP_K
/
2
,
NQ
,
TOP_K
,
true
);
MergeTopkArrayTest
(
TOP_K
/
3
,
TOP_K
/
2
,
NQ
,
TOP_K
,
false
);
}
TEST
(
DBSearchTest
,
REDUCE_PERF_TEST
)
{
int32_t
index_file_num
=
478
;
/* sift1B dataset, index files num */
bool
ascending
=
true
;
std
::
vector
<
int32_t
>
thread_vec
=
{
4
,
8
,
11
};
std
::
vector
<
int32_t
>
nq_vec
=
{
1
,
10
,
100
,
1000
};
std
::
vector
<
int32_t
>
topk_vec
=
{
1
,
4
,
16
,
64
,
256
,
1024
};
std
::
vector
<
int32_t
>
thread_vec
=
{
4
,
8
};
std
::
vector
<
int32_t
>
nq_vec
=
{
1
,
10
,
100
};
std
::
vector
<
int32_t
>
topk_vec
=
{
1
,
4
,
16
,
64
};
int32_t
NQ
=
nq_vec
[
nq_vec
.
size
()
-
1
];
int32_t
TOPK
=
topk_vec
[
topk_vec
.
size
()
-
1
];
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录