Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
milvus
提交
cf1e0398
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,发现更多精彩内容 >>
提交
cf1e0398
编写于
11月 25, 2019
作者:
H
Heisenberg
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix issue 527
上级
727ad14d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
28 addition
and
12 deletion
+28
-12
CHANGELOG.md
CHANGELOG.md
+1
-0
core/src/index/unittest/CMakeLists.txt
core/src/index/unittest/CMakeLists.txt
+1
-1
core/src/index/unittest/faiss_benchmark/faiss_benchmark_test.cpp
...c/index/unittest/faiss_benchmark/faiss_benchmark_test.cpp
+26
-11
未找到文件。
CHANGELOG.md
浏览文件 @
cf1e0398
...
@@ -21,6 +21,7 @@ Please mark all change in change log and use the ticket from JIRA.
...
@@ -21,6 +21,7 @@ Please mark all change in change log and use the ticket from JIRA.
-
\#
440 - Server cannot startup with gpu_resource_config.enable=false in GPU version
-
\#
440 - Server cannot startup with gpu_resource_config.enable=false in GPU version
-
\#
458 - Index data is not compatible between 0.5 and 0.6
-
\#
458 - Index data is not compatible between 0.5 and 0.6
-
\#
486 - gpu no usage during index building
-
\#
486 - gpu no usage during index building
-
\#
527 - faiss benchmark not compatible with faiss 1.6.0
## Feature
## Feature
-
\#
12 - Pure CPU version for Milvus
-
\#
12 - Pure CPU version for Milvus
...
...
core/src/index/unittest/CMakeLists.txt
浏览文件 @
cf1e0398
...
@@ -112,6 +112,6 @@ if (KNOWHERE_GPU_VERSION)
...
@@ -112,6 +112,6 @@ if (KNOWHERE_GPU_VERSION)
install
(
TARGETS test_customized_index DESTINATION unittest
)
install
(
TARGETS test_customized_index DESTINATION unittest
)
endif
()
endif
()
#add_subdirectory(faiss_ori)
#add_subdirectory(faiss_ori)
#
add_subdirectory(faiss_benchmark)
add_subdirectory
(
faiss_benchmark
)
add_subdirectory
(
test_nsg
)
add_subdirectory
(
test_nsg
)
core/src/index/unittest/faiss_benchmark/faiss_benchmark_test.cpp
浏览文件 @
cf1e0398
...
@@ -15,6 +15,8 @@
...
@@ -15,6 +15,8 @@
// specific language governing permissions and limitations
// specific language governing permissions and limitations
// under the License.
// under the License.
#define USE_FAISS_V0_2_1 0
#include <gtest/gtest.h>
#include <gtest/gtest.h>
#include <hdf5.h>
#include <hdf5.h>
...
@@ -26,30 +28,29 @@
...
@@ -26,30 +28,29 @@
#include <cstdio>
#include <cstdio>
#include <vector>
#include <vector>
#define USE_FAISS_V1_5_3 0
#include <faiss/AutoTune.h>
#include <faiss/Index.h>
#include <faiss/IndexIVF.h>
#include <faiss/gpu/GpuIndexFlat.h>
#include <faiss/gpu/StandardGpuResources.h>
#include <faiss/index_io.h>
#if USE_FAISS_V
1_5_3
#if USE_FAISS_V
0_2_1
#include <faiss/gpu/GpuAutoTune.h>
#include <faiss/gpu/GpuAutoTune.h>
#include <faiss/utils.h>
#include <faiss/utils.h>
#include <sys/stat.h>
#include <sys/stat.h>
#include <cstdlib>
#include <cstdlib>
#include <cstring>
#include <cstring>
#else
#else
#include <faiss/gpu/GpuCloner.h>
#include <faiss/gpu/GpuCloner.h>
#include <faiss/index_factory.h>
#include <faiss/index_factory.h>
#include <faiss/utils/distances.h>
#include <faiss/utils/distances.h>
#endif
#endif
#include <faiss/AutoTune.h>
#include <faiss/Index.h>
#include <faiss/IndexIVF.h>
#include <faiss/gpu/GpuIndexFlat.h>
#include <faiss/gpu/StandardGpuResources.h>
#include <faiss/index_io.h>
#ifdef CUSTOMIZATION
#ifdef CUSTOMIZATION
#include <faiss/gpu/GpuIndexIVFSQHybrid.h>
#include <faiss/gpu/GpuIndexIVFSQHybrid.h>
#else
#include <faiss/gpu/GpuIndexIVF.h>
#endif
#endif
/*****************************************************
/*****************************************************
...
@@ -295,10 +296,12 @@ load_base_data(faiss::Index*& index, const std::string& ann_test_name, const std
...
@@ -295,10 +296,12 @@ load_base_data(faiss::Index*& index, const std::string& ann_test_name, const std
cpu_index
=
faiss
::
gpu
::
index_gpu_to_cpu
(
gpu_index
);
cpu_index
=
faiss
::
gpu
::
index_gpu_to_cpu
(
gpu_index
);
delete
gpu_index
;
delete
gpu_index
;
#ifdef CUSTOMIZATION
faiss
::
IndexIVF
*
cpu_ivf_index
=
dynamic_cast
<
faiss
::
IndexIVF
*>
(
cpu_index
);
faiss
::
IndexIVF
*
cpu_ivf_index
=
dynamic_cast
<
faiss
::
IndexIVF
*>
(
cpu_index
);
if
(
cpu_ivf_index
!=
nullptr
)
{
if
(
cpu_ivf_index
!=
nullptr
)
{
cpu_ivf_index
->
to_readonly
();
cpu_ivf_index
->
to_readonly
();
}
}
#endif
printf
(
"[%.3f s] Writing index file: %s
\n
"
,
elapsed
()
-
t0
,
index_file_name
.
c_str
());
printf
(
"[%.3f s] Writing index file: %s
\n
"
,
elapsed
()
-
t0
,
index_file_name
.
c_str
());
faiss
::
write_index
(
cpu_index
,
index_file_name
.
c_str
());
faiss
::
write_index
(
cpu_index
,
index_file_name
.
c_str
());
...
@@ -374,13 +377,15 @@ test_with_nprobes(const std::string& ann_test_name, const std::string& index_key
...
@@ -374,13 +377,15 @@ test_with_nprobes(const std::string& ann_test_name, const std::string& index_key
faiss
::
Index
*
gpu_index
,
*
index
;
faiss
::
Index
*
gpu_index
,
*
index
;
if
(
query_mode
!=
MODE_CPU
)
{
if
(
query_mode
!=
MODE_CPU
)
{
faiss
::
gpu
::
GpuClonerOptions
option
;
faiss
::
gpu
::
GpuClonerOptions
option
;
#ifdef CUSTOMIZATION
option
.
allInGpu
=
true
;
option
.
allInGpu
=
true
;
faiss
::
IndexComposition
index_composition
;
faiss
::
IndexComposition
index_composition
;
index_composition
.
index
=
cpu_index
;
index_composition
.
index
=
cpu_index
;
index_composition
.
quantizer
=
nullptr
;
index_composition
.
quantizer
=
nullptr
;
#endif
switch
(
query_mode
)
{
switch
(
query_mode
)
{
#ifdef CUSTOMIZATION
case
MODE_MIX
:
{
case
MODE_MIX
:
{
index_composition
.
mode
=
1
;
// 0: all data, 1: copy quantizer, 2: copy data
index_composition
.
mode
=
1
;
// 0: all data, 1: copy quantizer, 2: copy data
...
@@ -403,7 +408,9 @@ test_with_nprobes(const std::string& ann_test_name, const std::string& index_key
...
@@ -403,7 +408,9 @@ test_with_nprobes(const std::string& ann_test_name, const std::string& index_key
index
=
cpu_index
;
index
=
cpu_index
;
break
;
break
;
}
}
#endif
case
MODE_GPU
:
case
MODE_GPU
:
#ifdef CUSTOMIZATION
index_composition
.
mode
=
0
;
// 0: all data, 1: copy quantizer, 2: copy data
index_composition
.
mode
=
0
;
// 0: all data, 1: copy quantizer, 2: copy data
// warm up the transmission
// warm up the transmission
...
@@ -412,6 +419,14 @@ test_with_nprobes(const std::string& ann_test_name, const std::string& index_key
...
@@ -412,6 +419,14 @@ test_with_nprobes(const std::string& ann_test_name, const std::string& index_key
copy_time
=
elapsed
();
copy_time
=
elapsed
();
gpu_index
=
faiss
::
gpu
::
index_cpu_to_gpu
(
&
res
,
GPU_DEVICE_IDX
,
&
index_composition
,
&
option
);
gpu_index
=
faiss
::
gpu
::
index_cpu_to_gpu
(
&
res
,
GPU_DEVICE_IDX
,
&
index_composition
,
&
option
);
#else
// warm up the transmission
gpu_index
=
faiss
::
gpu
::
index_cpu_to_gpu
(
&
res
,
GPU_DEVICE_IDX
,
cpu_index
,
&
option
);
delete
gpu_index
;
copy_time
=
elapsed
();
gpu_index
=
faiss
::
gpu
::
index_cpu_to_gpu
(
&
res
,
GPU_DEVICE_IDX
,
cpu_index
,
&
option
);
#endif
copy_time
=
elapsed
()
-
copy_time
;
copy_time
=
elapsed
()
-
copy_time
;
printf
(
"[%.3f s] Copy data completed, cost %f s
\n
"
,
elapsed
()
-
t0
,
copy_time
);
printf
(
"[%.3f s] Copy data completed, cost %f s
\n
"
,
elapsed
()
-
t0
,
copy_time
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录