Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
8ab67f69
M
milvus
项目概览
milvus
/
milvus
大约 1 年 前同步成功
通知
261
Star
22476
Fork
2472
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
milvus
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8ab67f69
编写于
10月 11, 2019
作者:
Y
Yu Kun
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'upstream/branch-0.5.0' into branch-0.5.0-yk
Former-commit-id: a29b4ca4764ad56d6da5d3d7c357a87e318e0704
上级
59f45763
6dee58f9
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
8 addition
and
149 deletion
+8
-149
cpp/src/core/knowhere/knowhere/index/vector_index/nsg/NSG.cpp
...src/core/knowhere/knowhere/index/vector_index/nsg/NSG.cpp
+2
-2
cpp/src/core/thirdparty/SPTAG/build.sh
cpp/src/core/thirdparty/SPTAG/build.sh
+0
-6
cpp/src/core/unittest/test_json.cpp
cpp/src/core/unittest/test_json.cpp
+0
-28
cpp/src/core/unittest/test_nsg.cpp
cpp/src/core/unittest/test_nsg.cpp
+0
-107
cpp/unittest/server/util_test.cpp
cpp/unittest/server/util_test.cpp
+6
-6
未找到文件。
cpp/src/core/knowhere/knowhere/index/vector_index/nsg/NSG.cpp
浏览文件 @
8ab67f69
...
...
@@ -765,8 +765,8 @@ NsgIndex::SetKnnGraph(Graph& g) {
}
// void NsgIndex::GetKnnGraphFromFile() {
// //std::string filename = "
/home/zilliz/opt/workspace/wook/efanna_graph/tests/
sift.1M.50NN.graph";
// std::string filename = "
/home/zilliz/opt/workspace/wook/efanna_graph/tests/
sift.50NN.graph";
// //std::string filename = "sift.1M.50NN.graph";
// std::string filename = "sift.50NN.graph";
//
// std::ifstream in(filename, std::ios::binary);
// unsigned k;
...
...
cpp/src/core/thirdparty/SPTAG/build.sh
浏览文件 @
8ab67f69
...
...
@@ -9,12 +9,6 @@ cd cmake_build
INSTALL_PREFIX
=
$(
pwd
)
/../../build
BOOST_PATH
=
"/home/zilliz/opt/app/boost"
TBB_PATH
=
"/home/zilliz/opt/app/tbb/tbb"
OPTION
=
"-DBOOST_ROOT=
$BOOST_PATH
-DTBB_DIR=
${
TBB_PATH
}
"
# CMAKE_CMD="cmake -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} ${OPTION} ../"
CMAKE_CMD
=
"cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=
${
INSTALL_PREFIX
}
../"
${
CMAKE_CMD
}
...
...
cpp/src/core/unittest/test_json.cpp
已删除
100644 → 0
浏览文件 @
59f45763
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
#include "knowhere/common/config.h"
int
main
()
{
knowhere
::
Config
cfg
;
cfg
[
"size"
]
=
size_t
(
199
);
auto
size
=
cfg
.
get_with_default
(
"size"
,
123
);
auto
size_2
=
cfg
[
"size"
].
as
<
int
>
();
printf
(
"%d"
,
size_2
);
}
cpp/src/core/unittest/test_nsg.cpp
已删除
100644 → 0
浏览文件 @
59f45763
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
#include <fstream>
#include <iostream>
#include "knowhere/index/index.h"
#include "test/utils.h"
//#include <gperftools/profiler.h>
void
load_data
(
std
::
string
&
filename
,
float
*&
data
,
unsigned
&
num
,
unsigned
&
dim
)
{
// load data with sift10K pattern
std
::
ifstream
in
(
filename
,
std
::
ios
::
binary
);
if
(
!
in
.
is_open
())
{
std
::
cout
<<
"open file error"
<<
std
::
endl
;
exit
(
-
1
);
}
in
.
read
((
char
*
)
&
dim
,
4
);
in
.
seekg
(
0
,
std
::
ios
::
end
);
std
::
ios
::
pos_type
ss
=
in
.
tellg
();
size_t
fsize
=
(
size_t
)
ss
;
num
=
(
unsigned
)(
fsize
/
(
dim
+
1
)
/
4
);
data
=
new
float
[(
size_t
)
num
*
(
size_t
)
dim
];
in
.
seekg
(
0
,
std
::
ios
::
beg
);
for
(
size_t
i
=
0
;
i
<
num
;
i
++
)
{
in
.
seekg
(
4
,
std
::
ios
::
cur
);
in
.
read
((
char
*
)(
data
+
i
*
dim
),
dim
*
4
);
}
in
.
close
();
}
void
test_distance
()
{
std
::
vector
<
float
>
xb
{
1
,
2
,
3
,
4
};
std
::
vector
<
float
>
xq
{
2
,
2
,
3
,
4
};
float
r
=
calculate
(
xb
.
data
(),
xq
.
data
(),
4
);
std
::
cout
<<
r
<<
std
::
endl
;
}
int
main
()
{
test_distance
();
BuildParams
params
;
params
.
search_length
=
100
;
params
.
candidate_pool_size
=
100
;
params
.
out_degree
=
50
;
float
*
data
=
nullptr
;
int64_t
*
ids
=
nullptr
;
unsigned
ntotal
,
dim
;
std
::
string
filename
=
"/home/zilliz/opt/workspace/wook/efanna_graph/tests/siftsmall/siftsmall_base.fvecs"
;
// std::string filename = "/home/zilliz/opt/workspace/wook/efanna_graph/tests/sift/sift_base.fvecs";
load_data
(
filename
,
data
,
ntotal
,
dim
);
assert
(
data
);
// float x = calculate(data + dim * 0, data + dim * 62, dim);
// std::cout << x << std::endl;
NsgIndex
index
(
dim
,
ntotal
);
auto
s
=
std
::
chrono
::
high_resolution_clock
::
now
();
index
.
Build_with_ids
(
ntotal
,
data
,
ids
,
params
);
auto
e
=
std
::
chrono
::
high_resolution_clock
::
now
();
std
::
chrono
::
duration
<
double
>
diff
=
e
-
s
;
std
::
cout
<<
"indexing time: "
<<
diff
.
count
()
<<
"
\n
"
;
int
k
=
10
;
int
nq
=
1000
;
SearchParams
s_params
;
s_params
.
search_length
=
50
;
auto
dist
=
new
float
[
nq
*
k
];
auto
ids_b
=
new
int64_t
[
nq
*
k
];
s
=
std
::
chrono
::
high_resolution_clock
::
now
();
// ProfilerStart("xx.prof");
index
.
Search
(
data
,
nq
,
dim
,
k
,
dist
,
ids_b
,
s_params
);
// ProfilerStop();
e
=
std
::
chrono
::
high_resolution_clock
::
now
();
diff
=
e
-
s
;
std
::
cout
<<
"search time: "
<<
diff
.
count
()
<<
"
\n
"
;
for
(
int
i
=
0
;
i
<
k
;
++
i
)
{
std
::
cout
<<
"id "
<<
ids_b
[
i
]
<<
std
::
endl
;
// std::cout << "dist " << dist[i] << std::endl;
}
delete
[]
dist
;
delete
[]
ids_b
;
return
0
;
}
cpp/unittest/server/util_test.cpp
浏览文件 @
8ab67f69
...
...
@@ -107,13 +107,13 @@ TEST(UtilTest, COMMON_TEST) {
}
TEST
(
UtilTest
,
STRINGFUNCTIONS_TEST
)
{
std
::
string
str
=
" test
zilliz
"
;
std
::
string
str
=
" test
str
"
;
milvus
::
server
::
StringHelpFunctions
::
TrimStringBlank
(
str
);
ASSERT_EQ
(
str
,
"test
zilliz
"
);
ASSERT_EQ
(
str
,
"test
str
"
);
str
=
"
\"
test
zilliz
\"
"
;
str
=
"
\"
test
str
\"
"
;
milvus
::
server
::
StringHelpFunctions
::
TrimStringQuote
(
str
,
"
\"
"
);
ASSERT_EQ
(
str
,
"test
zilliz
"
);
ASSERT_EQ
(
str
,
"test
str
"
);
str
=
"a,b,c"
;
std
::
vector
<
std
::
string
>
result
;
...
...
@@ -376,7 +376,7 @@ TEST(UtilTest, ROLLOUTHANDLER_TEST) {
std
::
ofstream
file
;
file
.
open
(
tmp
.
c_str
());
file
<<
"
zilliz
"
<<
std
::
endl
;
file
<<
"
test
"
<<
std
::
endl
;
milvus
::
server
::
RolloutHandler
(
tmp
.
c_str
(),
0
,
list
[
i
]);
...
...
@@ -386,7 +386,7 @@ TEST(UtilTest, ROLLOUTHANDLER_TEST) {
std
::
string
tmp2
;
file2
>>
tmp2
;
ASSERT_EQ
(
tmp2
,
"
zilliz
"
);
ASSERT_EQ
(
tmp2
,
"
test
"
);
}
boost
::
filesystem
::
remove_all
(
dir2
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录