Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
milvus
提交
3fda33ac
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,发现更多精彩内容 >>
提交
3fda33ac
编写于
7月 02, 2019
作者:
Y
yu yunfeng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
alter nprobe
Former-commit-id: 21cc3f6523580303bf702f7e616bcee7416a053f
上级
f30c3273
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
36 addition
and
4 deletion
+36
-4
cpp/conf/server_config.yaml
cpp/conf/server_config.yaml
+5
-2
cpp/src/wrapper/Index.cpp
cpp/src/wrapper/Index.cpp
+30
-1
cpp/src/wrapper/Operand.cpp
cpp/src/wrapper/Operand.cpp
+1
-1
未找到文件。
cpp/conf/server_config.yaml
浏览文件 @
3fda33ac
...
...
@@ -5,7 +5,7 @@ server_config:
mode
:
single
# milvus deployment type: single, cluster
db_config
:
db_path
:
/
opt
/milvus
# milvus data storage path
db_path
:
/
tmp
/milvus
# milvus data storage path
db_backend_url
:
http://127.0.0.1
# meta database uri
index_building_threshold
:
1024
# index building trigger threshold, default: 1024, unit: MB
archive_disk_threshold
:
512
# triger archive action if storage size exceed this value, unit: GB
...
...
@@ -22,7 +22,10 @@ metric_config:
license_config
:
# license configure
license_path
:
"
/
opt
/milvus/system.license"
# license file path
license_path
:
"
/
tmp
/milvus/system.license"
# license file path
cache_config
:
# cache configure
cpu_cache_capacity
:
16
# how many memory are used as cache, unit: GB, range: 0 ~ less than total memory
engine_config
:
nprobe
:
3000
\ No newline at end of file
cpp/src/wrapper/Index.cpp
浏览文件 @
3fda33ac
...
...
@@ -14,6 +14,8 @@
#include "Index.h"
#include "faiss/index_io.h"
#include "faiss/IndexIVF.h"
#include <faiss/IVFlib.h>
#include "server/ServerConfig.h"
namespace
zilliz
{
namespace
milvus
{
...
...
@@ -23,6 +25,32 @@ using std::string;
using
std
::
unordered_map
;
using
std
::
vector
;
class
Nprobe
{
public:
static
Nprobe
&
GetInstance
()
{
static
Nprobe
instance
;
return
instance
;
}
void
SelectNprobe
()
{
using
namespace
zilliz
::
milvus
::
server
;
ServerConfig
&
config
=
ServerConfig
::
GetInstance
();
ConfigNode
engine_config
=
config
.
GetConfig
(
CONFIG_ENGINE
);
nprobe_
=
engine_config
.
GetInt32Value
(
CONFIG_NPROBE
,
1000
);
}
size_t
GetNprobe
()
{
return
nprobe_
;
}
private:
Nprobe
()
:
nprobe_
(
1000
)
{
SelectNprobe
();
}
private:
size_t
nprobe_
;
};
Index
::
Index
(
const
std
::
shared_ptr
<
faiss
::
Index
>
&
raw_index
)
{
index_
=
raw_index
;
dim
=
index_
->
d
;
...
...
@@ -57,7 +85,8 @@ bool Index::add_with_ids(idx_t n, const float *xdata, const long *xids) {
bool
Index
::
search
(
idx_t
n
,
const
float
*
data
,
idx_t
k
,
float
*
distances
,
long
*
labels
)
const
{
try
{
if
(
auto
ivf_index
=
std
::
dynamic_pointer_cast
<
faiss
::
IndexIVF
>
(
index_
))
{
ivf_index
->
nprobe
=
100
;
ivf_index
->
nprobe
=
Nprobe
::
GetInstance
().
GetNprobe
();
std
::
cout
<<
"nprobe = "
<<
ivf_index
->
nprobe
<<
std
::
endl
;
}
index_
->
search
(
n
,
data
,
k
,
distances
,
labels
);
}
...
...
cpp/src/wrapper/Operand.cpp
浏览文件 @
3fda33ac
...
...
@@ -39,7 +39,7 @@ string Operand::get_index_type(const int &nb) {
}
case
IVF
:
{
index_str
+=
(
ncent
!=
0
?
index_type
+
std
::
to_string
(
ncent
)
:
index_type
+
std
::
to_string
(
int
(
nb
/
1000000.0
*
1638
)));
index_type
+
std
::
to_string
(
int
(
nb
/
1000000.0
*
1638
4
)));
break
;
}
case
IDMAP
:
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录