From 31da89d9a286a4bf9b359e085fef7b6cf493333a Mon Sep 17 00:00:00 2001 From: "xiaojun.lin" Date: Sat, 30 Nov 2019 18:07:26 +0800 Subject: [PATCH] format code --- .../knowhere/knowhere/index/vector_index/IndexGPUIDMAP.h | 1 + .../knowhere/knowhere/index/vector_index/IndexNSG.cpp | 2 +- .../index/knowhere/knowhere/index/vector_index/nsg/NSG.h | 4 ++-- core/src/index/unittest/test_nsg/test_nsg.cpp | 9 +++++---- core/src/index/unittest/utils.h | 2 +- core/src/wrapper/ConfAdapter.cpp | 2 +- 6 files changed, 11 insertions(+), 9 deletions(-) diff --git a/core/src/index/knowhere/knowhere/index/vector_index/IndexGPUIDMAP.h b/core/src/index/knowhere/knowhere/index/vector_index/IndexGPUIDMAP.h index d538f2d0da..31c7039f50 100644 --- a/core/src/index/knowhere/knowhere/index/vector_index/IndexGPUIDMAP.h +++ b/core/src/index/knowhere/knowhere/index/vector_index/IndexGPUIDMAP.h @@ -23,6 +23,7 @@ #include #include +#include namespace knowhere { diff --git a/core/src/index/knowhere/knowhere/index/vector_index/IndexNSG.cpp b/core/src/index/knowhere/knowhere/index/vector_index/IndexNSG.cpp index 661bde3bf3..db8b05f992 100644 --- a/core/src/index/knowhere/knowhere/index/vector_index/IndexNSG.cpp +++ b/core/src/index/knowhere/knowhere/index/vector_index/IndexNSG.cpp @@ -25,8 +25,8 @@ #include "knowhere/index/vector_index/helpers/Cloner.h" #endif -#include "knowhere/index/vector_index/IndexIVF.h" #include "knowhere/index/vector_index/IndexIDMAP.h" +#include "knowhere/index/vector_index/IndexIVF.h" #include "knowhere/index/vector_index/nsg/NSG.h" #include "knowhere/index/vector_index/nsg/NSGIO.h" diff --git a/core/src/index/knowhere/knowhere/index/vector_index/nsg/NSG.h b/core/src/index/knowhere/knowhere/index/vector_index/nsg/NSG.h index 3dd827466a..f4eefb476e 100644 --- a/core/src/index/knowhere/knowhere/index/vector_index/nsg/NSG.h +++ b/core/src/index/knowhere/knowhere/index/vector_index/nsg/NSG.h @@ -53,8 +53,8 @@ class NsgIndex { float* ori_data_; int64_t* ids_; - Graph nsg; // final graph - Graph knng; // reset after build + Graph nsg; // final graph + Graph knng; // reset after build node_t navigation_point; // offset of node in origin data diff --git a/core/src/index/unittest/test_nsg/test_nsg.cpp b/core/src/index/unittest/test_nsg/test_nsg.cpp index 450f5a7723..c67fec0e32 100644 --- a/core/src/index/unittest/test_nsg/test_nsg.cpp +++ b/core/src/index/unittest/test_nsg/test_nsg.cpp @@ -22,9 +22,9 @@ #include "knowhere/index/vector_index/FaissBaseIndex.h" #include "knowhere/index/vector_index/IndexNSG.h" #ifdef MILVUS_GPU_VERSION -#include "knowhere/index/vector_index/helpers/FaissGpuResourceMgr.h" #include "knowhere/index/vector_index/IndexGPUIDMAP.h" #include "knowhere/index/vector_index/helpers/Cloner.h" +#include "knowhere/index/vector_index/helpers/FaissGpuResourceMgr.h" #endif #include "knowhere/common/Timer.h" @@ -120,7 +120,7 @@ TEST_F(NSGInterfaceTest, comparetest) { } //#include -//TEST(test, ori_nsg) { +// TEST(test, ori_nsg) { // // float* p_data = nullptr; // size_t rows, dim; // char* filename = "/mnt/112d53a6-5592-4360-a33b-7fd789456fce/workspace/Data/sift/sift_base.fvecs"; @@ -226,7 +226,7 @@ TEST_F(NSGInterfaceTest, comparetest) { // printf("R@100 = %.4f\n", n_100 / float(nq)); //} // -//TEST(testxx, test_idmap){ +// TEST(testxx, test_idmap){ // int k = 50; // std::string knng_filename = // "/mnt/112d53a6-5592-4360-a33b-7fd789456fce/workspace/Cellar/anns/efanna_graph/tests/sift.50NN.graph"; @@ -234,7 +234,8 @@ TEST_F(NSGInterfaceTest, comparetest) { // Load_nns_graph(gt_knng, knng_filename.c_str()); // // size_t rows, dim; -// char* filename = "/mnt/112d53a6-5592-4360-a33b-7fd789456fce/workspace/Cellar/anns/efanna_graph/tests/siftsmall/siftsmall_base.fvecs"; +// char* filename = +// "/mnt/112d53a6-5592-4360-a33b-7fd789456fce/workspace/Cellar/anns/efanna_graph/tests/siftsmall/siftsmall_base.fvecs"; // float* p_data = fvecs_read(filename, &dim, &rows); // // std::vector store_ids(rows); diff --git a/core/src/index/unittest/utils.h b/core/src/index/unittest/utils.h index f11ad28163..03fd157222 100644 --- a/core/src/index/unittest/utils.h +++ b/core/src/index/unittest/utils.h @@ -101,4 +101,4 @@ float* fvecs_read(const char* fname, size_t* d_out, size_t* n_out); int* -ivecs_read(const char* fname, size_t* d_out, size_t* n_out); \ No newline at end of file +ivecs_read(const char* fname, size_t* d_out, size_t* n_out); diff --git a/core/src/wrapper/ConfAdapter.cpp b/core/src/wrapper/ConfAdapter.cpp index b96f2c80e5..6b1667f9d7 100644 --- a/core/src/wrapper/ConfAdapter.cpp +++ b/core/src/wrapper/ConfAdapter.cpp @@ -204,7 +204,7 @@ NSGConfAdapter::Match(const TempMetaConf& metaconf) { auto scale_factor = round(metaconf.dim / 128.0); scale_factor = scale_factor >= 4 ? 4 : scale_factor; conf->nprobe = int64_t(conf->nlist * 0.01); -// conf->knng = 40 + 10 * scale_factor; // the size of knng + // conf->knng = 40 + 10 * scale_factor; // the size of knng conf->knng = 50; conf->search_length = 50 + 5 * scale_factor; conf->out_degree = 50 + 5 * scale_factor;