Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
milvus
提交
248bdbf0
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,发现更多精彩内容 >>
提交
248bdbf0
编写于
9月 06, 2019
作者:
H
Heisenberg
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
MS-496 Change the top_k limitation from 1024 to 2048
Former-commit-id: d63d6d69432888324424ed1daf0b1236a5243f4e
上级
d6c7909b
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
60 addition
and
11 deletion
+60
-11
cpp/CHANGELOG.md
cpp/CHANGELOG.md
+1
-0
cpp/src/utils/ValidationUtil.cpp
cpp/src/utils/ValidationUtil.cpp
+1
-1
cpp/src/wrapper/knowhere/vec_index.cpp
cpp/src/wrapper/knowhere/vec_index.cpp
+52
-2
cpp/src/wrapper/knowhere/vec_index.h
cpp/src/wrapper/knowhere/vec_index.h
+6
-8
未找到文件。
cpp/CHANGELOG.md
浏览文件 @
248bdbf0
...
...
@@ -92,6 +92,7 @@ Please mark all change in change log and use the ticket from JIRA.
-
MS-487 - Define metric type in CreateTable
-
MS-488 - Improve code format in scheduler
-
MS-495 - cmake: integrated knowhere
-
MS-496 - Change the top_k limitation from 1024 to 2048
## New Feature
-
MS-343 - Implement ResourceMgr
...
...
cpp/src/utils/ValidationUtil.cpp
浏览文件 @
248bdbf0
...
...
@@ -94,7 +94,7 @@ ValidationUtil::ValidateTableIndexMetricType(int32_t metric_type) {
ServerError
ValidationUtil
::
ValidateSearchTopk
(
int64_t
top_k
,
const
engine
::
meta
::
TableSchema
&
table_schema
)
{
if
(
top_k
<=
0
||
top_k
>
1024
)
{
if
(
top_k
<=
0
)
{
return
SERVER_INVALID_TOPK
;
}
...
...
cpp/src/wrapper/knowhere/vec_index.cpp
浏览文件 @
248bdbf0
...
...
@@ -14,6 +14,8 @@
#include "vec_impl.h"
#include "wrapper_log.h"
#include <cuda.h>
namespace
zilliz
{
namespace
milvus
{
...
...
@@ -241,19 +243,67 @@ void AutoGenParams(const IndexType &type, const long &size, zilliz::knowhere::Co
#define GPU_MAX_NRPOBE 1024
#endif
#define GPU_MAX_TOP_K GPU_MAX_NRPOBE
// TODO(yzb): may be changed latter
#define CPU_MAX_TOP_K GPU_MAX_TOP_K
#define DEFAULT_MAX_TOP_K GPU_MAX_TOP_K
void
ParameterValidation
(
const
IndexType
&
type
,
Config
&
cfg
)
{
switch
(
type
)
{
case
IndexType
::
FAISS_IVFFLAT_CPU
:
case
IndexType
::
FAISS_IVFPQ_CPU
:
case
IndexType
::
FAISS_IVFSQ8_CPU
:
{
//search on CPU
if
(
cfg
.
get_with_default
(
"k"
,
0
)
!=
0
)
{
auto
k
=
cfg
[
"k"
].
as
<
int
>
();
if
(
k
>
CPU_MAX_TOP_K
)
{
WRAPPER_LOG_WARNING
<<
"When search with CPU, top_k shoud be no more than "
<<
CPU_MAX_TOP_K
<<
", but you passed "
<<
k
<<
". Search with "
<<
CPU_MAX_TOP_K
<<
" instead"
;
cfg
.
insert_or_assign
(
"k"
,
CPU_MAX_TOP_K
);
}
}
break
;
}
case
IndexType
::
FAISS_IVFSQ8_GPU
:
case
IndexType
::
FAISS_IVFFLAT_GPU
:
case
IndexType
::
FAISS_IVFPQ_GPU
:
{
//search on GPU
if
(
cfg
.
get_with_default
(
"nprobe"
,
0
)
!=
0
)
{
auto
nprobe
=
cfg
[
"nprobe"
].
as
<
int
>
();
if
(
nprobe
>
GPU_MAX_NRPOBE
)
{
WRAPPER_LOG_WARNING
<<
"When search with GPU, nprobe shoud be no more than "
<<
GPU_MAX_NRPOBE
<<
", but you passed "
<<
nprobe
WRAPPER_LOG_WARNING
<<
"When search with GPU, nprobe shoud be no more than "
<<
GPU_MAX_NRPOBE
<<
", but you passed "
<<
nprobe
<<
". Search with "
<<
GPU_MAX_NRPOBE
<<
" instead"
;
cfg
.
insert_or_assign
(
"nprobe"
,
GPU_MAX_NRPOBE
);
}
}
if
(
cfg
.
get_with_default
(
"k"
,
0
)
!=
0
)
{
auto
k
=
cfg
[
"k"
].
as
<
int
>
();
if
(
k
>
GPU_MAX_TOP_K
)
{
WRAPPER_LOG_WARNING
<<
"When search with GPU, top_k shoud be no more than "
<<
GPU_MAX_TOP_K
<<
", but you passed "
<<
k
<<
". Search with "
<<
GPU_MAX_TOP_K
<<
" instead"
;
cfg
.
insert_or_assign
(
"k"
,
GPU_MAX_TOP_K
);
}
}
break
;
}
case
IndexType
::
FAISS_IDMAP
:
case
IndexType
::
FAISS_IVFFLAT_MIX
:
case
IndexType
::
SPTAG_KDT_RNT_CPU
:
case
IndexType
::
FAISS_IVFSQ8_MIX
:
case
IndexType
::
NSG_MIX
:
{
// TODO(yzb): need to figure out where it search
if
(
cfg
.
get_with_default
(
"k"
,
0
)
!=
0
)
{
auto
k
=
cfg
[
"k"
].
as
<
int
>
();
if
(
k
>
DEFAULT_MAX_TOP_K
)
{
WRAPPER_LOG_WARNING
<<
"top_k shoud be no more than "
<<
DEFAULT_MAX_TOP_K
<<
", but you passed "
<<
k
<<
". Search with "
<<
DEFAULT_MAX_TOP_K
<<
" instead"
;
cfg
.
insert_or_assign
(
"k"
,
DEFAULT_MAX_TOP_K
);
}
}
break
;
}
default:
break
;
...
...
cpp/src/wrapper/knowhere/vec_index.h
浏览文件 @
248bdbf0
...
...
@@ -14,8 +14,6 @@
#include "knowhere/common/config.h"
#include "knowhere/common/binary_set.h"
#include "cuda.h"
namespace
zilliz
{
namespace
milvus
{
...
...
@@ -62,7 +60,7 @@ class VecIndex {
long
*
ids
,
const
Config
&
cfg
=
Config
())
=
0
;
virtual
VecIndexPtr
CopyToGpu
(
const
int64_t
&
device_id
,
virtual
VecIndexPtr
CopyToGpu
(
const
int64_t
&
device_id
,
const
Config
&
cfg
=
Config
())
=
0
;
virtual
VecIndexPtr
CopyToCpu
(
const
Config
&
cfg
=
Config
())
=
0
;
...
...
@@ -86,16 +84,16 @@ extern server::KnowhereError write_index(VecIndexPtr index, const std::string &l
extern
VecIndexPtr
read_index
(
const
std
::
string
&
location
);
extern
VecIndexPtr
GetVecIndexFactory
(
const
IndexType
&
type
,
const
Config
&
cfg
=
Config
());
extern
VecIndexPtr
GetVecIndexFactory
(
const
IndexType
&
type
,
const
Config
&
cfg
=
Config
());
extern
VecIndexPtr
LoadVecIndex
(
const
IndexType
&
index_type
,
const
zilliz
::
knowhere
::
BinarySet
&
index_binary
);
extern
void
AutoGenParams
(
const
IndexType
&
type
,
const
long
&
size
,
Config
&
cfg
);
extern
void
AutoGenParams
(
const
IndexType
&
type
,
const
long
&
size
,
Config
&
cfg
);
extern
void
ParameterValidation
(
const
IndexType
&
type
,
Config
&
cfg
);
extern
void
ParameterValidation
(
const
IndexType
&
type
,
Config
&
cfg
);
extern
IndexType
ConvertToCpuIndexType
(
const
IndexType
&
type
);
extern
IndexType
ConvertToGpuIndexType
(
const
IndexType
&
type
);
extern
IndexType
ConvertToCpuIndexType
(
const
IndexType
&
type
);
extern
IndexType
ConvertToGpuIndexType
(
const
IndexType
&
type
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录