From 0e9a4478e31ecec2c155dc9d22cb3ad3efc8124d Mon Sep 17 00:00:00 2001 From: Cai Yudong Date: Thu, 23 Mar 2023 21:39:59 +0800 Subject: [PATCH] Remove useless index mode (#22934) Signed-off-by: Yudong Cai --- internal/core/src/common/Types.h | 2 - internal/core/src/index/Index.h | 1 - internal/core/src/index/IndexFactory.cpp | 9 +-- internal/core/src/index/IndexFactory.h | 4 +- internal/core/src/index/IndexInfo.h | 1 - internal/core/src/index/Meta.h | 1 - internal/core/src/index/Utils.cpp | 20 ------ internal/core/src/index/Utils.h | 6 -- internal/core/src/index/VectorDiskIndex.cpp | 3 +- internal/core/src/index/VectorDiskIndex.h | 1 - internal/core/src/index/VectorIndex.h | 11 +--- internal/core/src/index/VectorMemIndex.cpp | 5 +- internal/core/src/index/VectorMemIndex.h | 3 +- internal/core/src/index/VectorMemNMIndex.h | 5 +- .../src/indexbuilder/ScalarIndexCreator.cpp | 1 - .../core/src/indexbuilder/VecIndexCreator.cpp | 1 - internal/core/src/segcore/FieldIndexing.cpp | 4 +- internal/core/src/segcore/load_index_c.cpp | 13 ---- internal/core/unittest/bench/bench_search.cpp | 1 - internal/core/unittest/test_c_api.cpp | 65 ++----------------- internal/core/unittest/test_utils/DataGen.h | 3 +- 21 files changed, 18 insertions(+), 142 deletions(-) diff --git a/internal/core/src/common/Types.h b/internal/core/src/common/Types.h index fbbb20292b..806a5fa4f4 100644 --- a/internal/core/src/common/Types.h +++ b/internal/core/src/common/Types.h @@ -130,8 +130,6 @@ using DatasetPtr = knowhere::DataSetPtr; using MetricType = knowhere::MetricType; // TODO :: type define milvus index type(vector index type and scalar index type) using IndexType = knowhere::IndexType; -// TODO :: type define milvus index mode, add transfer func from milvus index mode to knowhere index mode -using IndexMode = knowhere::IndexMode; // Plus 1 because we can't use greater(>) symbol constexpr size_t REF_SIZE_THRESHOLD = 16 + 1; diff --git a/internal/core/src/index/Index.h b/internal/core/src/index/Index.h index 77ae98bea7..2976a83f3e 100644 --- a/internal/core/src/index/Index.h +++ b/internal/core/src/index/Index.h @@ -46,7 +46,6 @@ class IndexBase { protected: IndexType index_type_ = ""; - IndexMode index_mode_ = IndexMode::MODE_CPU; }; using IndexBasePtr = std::unique_ptr; diff --git a/internal/core/src/index/IndexFactory.cpp b/internal/core/src/index/IndexFactory.cpp index c6ae68029a..0b593cdd5d 100644 --- a/internal/core/src/index/IndexFactory.cpp +++ b/internal/core/src/index/IndexFactory.cpp @@ -75,7 +75,6 @@ IndexFactory::CreateVectorIndex(const CreateIndexInfo& create_index_info, auto data_type = create_index_info.field_type; auto index_type = create_index_info.index_type; auto metric_type = create_index_info.metric_type; - auto index_mode = create_index_info.index_mode; #ifdef BUILD_DISK_ANN // create disk index @@ -83,7 +82,7 @@ IndexFactory::CreateVectorIndex(const CreateIndexInfo& create_index_info, switch (data_type) { case DataType::VECTOR_FLOAT: { return std::make_unique>( - index_type, metric_type, index_mode, file_manager); + index_type, metric_type, file_manager); } default: throw std::invalid_argument( @@ -94,12 +93,10 @@ IndexFactory::CreateVectorIndex(const CreateIndexInfo& create_index_info, #endif if (is_in_nm_list(index_type)) { - return std::make_unique( - index_type, metric_type, index_mode); + return std::make_unique(index_type, metric_type); } // create mem index - return std::make_unique( - index_type, metric_type, index_mode); + return std::make_unique(index_type, metric_type); } } // namespace milvus::index diff --git a/internal/core/src/index/IndexFactory.h b/internal/core/src/index/IndexFactory.h index e8a5afd2ec..daa525f29c 100644 --- a/internal/core/src/index/IndexFactory.h +++ b/internal/core/src/index/IndexFactory.h @@ -63,8 +63,8 @@ class IndexFactory { IndexBasePtr CreateScalarIndex(const CreateIndexInfo& create_index_info); - // IndexBasePtr - // CreateIndex(DataType dtype, const IndexType& index_type, const IndexMode& index_mode = IndexMode::MODE_CPU); + // IndexBasePtr + // CreateIndex(DataType dtype, const IndexType& index_type); private: template ScalarIndexPtr diff --git a/internal/core/src/index/IndexInfo.h b/internal/core/src/index/IndexInfo.h index f68c7e95fc..47dd21c0fd 100644 --- a/internal/core/src/index/IndexInfo.h +++ b/internal/core/src/index/IndexInfo.h @@ -24,7 +24,6 @@ struct CreateIndexInfo { DataType field_type; IndexType index_type; MetricType metric_type; - IndexMode index_mode = IndexMode::MODE_CPU; }; } // namespace milvus::index diff --git a/internal/core/src/index/Meta.h b/internal/core/src/index/Meta.h index 0b76b2a369..489a8afe50 100644 --- a/internal/core/src/index/Meta.h +++ b/internal/core/src/index/Meta.h @@ -31,7 +31,6 @@ constexpr const char* MARISA_TRIE_INDEX = "marisa_trie_index"; constexpr const char* MARISA_STR_IDS = "marisa_trie_str_ids"; constexpr const char* INDEX_TYPE = "index_type"; -constexpr const char* INDEX_MODE = "index_mode"; constexpr const char* METRIC_TYPE = "metric_type"; // scalar index type diff --git a/internal/core/src/index/Utils.cpp b/internal/core/src/index/Utils.cpp index 33cac8e727..809a6bccf5 100644 --- a/internal/core/src/index/Utils.cpp +++ b/internal/core/src/index/Utils.cpp @@ -122,26 +122,6 @@ GetIndexTypeFromConfig(const Config& config) { return index_type.value(); } -IndexMode -GetIndexModeFromConfig(const Config& config) { - auto mode = GetValueFromConfig(config, INDEX_MODE); - return mode.has_value() ? GetIndexMode(mode.value()) - : knowhere::IndexMode::MODE_CPU; -} - -IndexMode -GetIndexMode(const std::string_view index_mode) { - if (index_mode.compare("CPU") == 0 || index_mode.compare("cpu") == 0) { - return IndexMode::MODE_CPU; - } - - if (index_mode.compare("GPU") == 0 || index_mode.compare("gpu") == 0) { - return IndexMode::MODE_GPU; - } - - PanicInfo("unsupported index mode"); -} - // TODO :: too ugly storage::FieldDataMeta GetFieldDataMetaFromConfig(const Config& config) { diff --git a/internal/core/src/index/Utils.h b/internal/core/src/index/Utils.h index 8a8c84b026..160fec8359 100644 --- a/internal/core/src/index/Utils.h +++ b/internal/core/src/index/Utils.h @@ -108,12 +108,6 @@ GetMetricTypeFromConfig(const Config& config); std::string GetIndexTypeFromConfig(const Config& config); -IndexMode -GetIndexModeFromConfig(const Config& config); - -IndexMode -GetIndexMode(const std::string_view index_mode); - storage::FieldDataMeta GetFieldDataMetaFromConfig(const Config& config); diff --git a/internal/core/src/index/VectorDiskIndex.cpp b/internal/core/src/index/VectorDiskIndex.cpp index e80badcb65..dba5b1b0ed 100644 --- a/internal/core/src/index/VectorDiskIndex.cpp +++ b/internal/core/src/index/VectorDiskIndex.cpp @@ -38,9 +38,8 @@ template VectorDiskAnnIndex::VectorDiskAnnIndex( const IndexType& index_type, const MetricType& metric_type, - const IndexMode& index_mode, storage::FileManagerImplPtr file_manager) - : VectorIndex(index_type, index_mode, metric_type) { + : VectorIndex(index_type, metric_type) { file_manager_ = std::dynamic_pointer_cast(file_manager); auto& local_chunk_manager = storage::LocalChunkManager::GetInstance(); diff --git a/internal/core/src/index/VectorDiskIndex.h b/internal/core/src/index/VectorDiskIndex.h index 885dd87c1c..2425ad5f16 100644 --- a/internal/core/src/index/VectorDiskIndex.h +++ b/internal/core/src/index/VectorDiskIndex.h @@ -30,7 +30,6 @@ class VectorDiskAnnIndex : public VectorIndex { public: explicit VectorDiskAnnIndex(const IndexType& index_type, const MetricType& metric_type, - const IndexMode& index_mode, storage::FileManagerImplPtr file_manager); BinarySet Serialize(const Config& config) override { diff --git a/internal/core/src/index/VectorIndex.h b/internal/core/src/index/VectorIndex.h index 7fb513ebdd..e70ee79564 100644 --- a/internal/core/src/index/VectorIndex.h +++ b/internal/core/src/index/VectorIndex.h @@ -33,11 +33,8 @@ namespace milvus::index { class VectorIndex : public IndexBase { public: explicit VectorIndex(const IndexType& index_type, - const IndexMode& index_mode, const MetricType& metric_type) - : index_type_(index_type), - index_mode_(index_mode), - metric_type_(metric_type) { + : index_type_(index_type), metric_type_(metric_type) { } public: @@ -63,11 +60,6 @@ class VectorIndex : public IndexBase { return metric_type_; } - IndexMode - GetIndexMode() const { - return index_mode_; - } - int64_t GetDim() const { return dim_; @@ -84,7 +76,6 @@ class VectorIndex : public IndexBase { private: IndexType index_type_; - IndexMode index_mode_; MetricType metric_type_; int64_t dim_; }; diff --git a/internal/core/src/index/VectorMemIndex.cpp b/internal/core/src/index/VectorMemIndex.cpp index 373e5cda45..0e18d95357 100644 --- a/internal/core/src/index/VectorMemIndex.cpp +++ b/internal/core/src/index/VectorMemIndex.cpp @@ -33,9 +33,8 @@ namespace milvus::index { VectorMemIndex::VectorMemIndex(const IndexType& index_type, - const MetricType& metric_type, - const IndexMode& index_mode) - : VectorIndex(index_type, index_mode, metric_type) { + const MetricType& metric_type) + : VectorIndex(index_type, metric_type) { AssertInfo(!is_unsupported(index_type, metric_type), index_type + " doesn't support metric: " + metric_type); diff --git a/internal/core/src/index/VectorMemIndex.h b/internal/core/src/index/VectorMemIndex.h index 2e2b97bfbc..dbd91e14eb 100644 --- a/internal/core/src/index/VectorMemIndex.h +++ b/internal/core/src/index/VectorMemIndex.h @@ -29,8 +29,7 @@ namespace milvus::index { class VectorMemIndex : public VectorIndex { public: explicit VectorMemIndex(const IndexType& index_type, - const MetricType& metric_type, - const IndexMode& index_mode); + const MetricType& metric_type); BinarySet Serialize(const Config& config) override; diff --git a/internal/core/src/index/VectorMemNMIndex.h b/internal/core/src/index/VectorMemNMIndex.h index 8e98b85313..49ee54e7cc 100644 --- a/internal/core/src/index/VectorMemNMIndex.h +++ b/internal/core/src/index/VectorMemNMIndex.h @@ -29,9 +29,8 @@ namespace milvus::index { class VectorMemNMIndex : public VectorMemIndex { public: explicit VectorMemNMIndex(const IndexType& index_type, - const MetricType& metric_type, - const IndexMode& index_mode) - : VectorMemIndex(index_type, metric_type, index_mode) { + const MetricType& metric_type) + : VectorMemIndex(index_type, metric_type) { AssertInfo(is_in_nm_list(index_type), "not valid nm index type"); } diff --git a/internal/core/src/indexbuilder/ScalarIndexCreator.cpp b/internal/core/src/indexbuilder/ScalarIndexCreator.cpp index cbd5d2fdc9..6f3f5d329c 100644 --- a/internal/core/src/indexbuilder/ScalarIndexCreator.cpp +++ b/internal/core/src/indexbuilder/ScalarIndexCreator.cpp @@ -43,7 +43,6 @@ ScalarIndexCreator::ScalarIndexCreator(DataType dtype, milvus::index::CreateIndexInfo index_info; index_info.field_type = dtype_; index_info.index_type = index_type(); - index_info.index_mode = IndexMode::MODE_CPU; index_ = index::IndexFactory::GetInstance().CreateIndex(index_info, nullptr); } diff --git a/internal/core/src/indexbuilder/VecIndexCreator.cpp b/internal/core/src/indexbuilder/VecIndexCreator.cpp index f729c1d147..18c2eace60 100644 --- a/internal/core/src/indexbuilder/VecIndexCreator.cpp +++ b/internal/core/src/indexbuilder/VecIndexCreator.cpp @@ -47,7 +47,6 @@ VecIndexCreator::VecIndexCreator(DataType data_type, index::CreateIndexInfo index_info; index_info.field_type = data_type_; - index_info.index_mode = index::GetIndexModeFromConfig(config_); index_info.index_type = index::GetIndexTypeFromConfig(config_); index_info.metric_type = index::GetMetricTypeFromConfig(config_); diff --git a/internal/core/src/segcore/FieldIndexing.cpp b/internal/core/src/segcore/FieldIndexing.cpp index 817459e58f..0c05337e01 100644 --- a/internal/core/src/segcore/FieldIndexing.cpp +++ b/internal/core/src/segcore/FieldIndexing.cpp @@ -37,9 +37,7 @@ VectorFieldIndexing::BuildIndexRange(int64_t ack_beg, for (int chunk_id = ack_beg; chunk_id < ack_end; chunk_id++) { const auto& chunk = source->get_chunk(chunk_id); auto indexing = std::make_unique( - knowhere::IndexEnum::INDEX_FAISS_IVFFLAT, - knowhere::metric::L2, - IndexMode::MODE_CPU); + knowhere::IndexEnum::INDEX_FAISS_IVFFLAT, knowhere::metric::L2); auto dataset = knowhere::GenDataSet( source->get_size_per_chunk(), dim, chunk.data()); indexing->BuildWithDataset(dataset, conf); diff --git a/internal/core/src/segcore/load_index_c.cpp b/internal/core/src/segcore/load_index_c.cpp index d4495447f5..db2c13b936 100644 --- a/internal/core/src/segcore/load_index_c.cpp +++ b/internal/core/src/segcore/load_index_c.cpp @@ -132,13 +132,6 @@ appendVecIndex(CLoadIndexInfo c_load_index_info, CBinarySet c_binary_set) { "metric type is empty"); index_info.metric_type = index_params.at("metric_type"); - // set default index mode - index_info.index_mode = milvus::IndexMode::MODE_CPU; - if (index_params.count("index_mode")) { - index_info.index_mode = - milvus::index::GetIndexMode(index_params["index_mode"]); - } - // init file manager milvus::storage::FieldDataMeta field_meta{ load_index_info->collection_id, @@ -191,12 +184,6 @@ appendScalarIndex(CLoadIndexInfo c_load_index_info, CBinarySet c_binary_set) { milvus::index::CreateIndexInfo index_info; index_info.field_type = milvus::DataType(field_type); index_info.index_type = index_params["index_type"]; - // set default index mode - index_info.index_mode = milvus::IndexMode::MODE_CPU; - if (index_params.count("index_mode")) { - index_info.index_mode = - milvus::index::GetIndexMode(index_params["index_mode"]); - } load_index_info->index = milvus::index::IndexFactory::GetInstance().CreateIndex(index_info, diff --git a/internal/core/unittest/bench/bench_search.cpp b/internal/core/unittest/bench/bench_search.cpp index 6260eecc66..cea4690650 100644 --- a/internal/core/unittest/bench/bench_search.cpp +++ b/internal/core/unittest/bench/bench_search.cpp @@ -118,7 +118,6 @@ Search_Sealed(benchmark::State& state) { info.index = std::move(indexing); info.field_id = (*schema)[FieldName("fakevec")].get_id().get(); info.index_params["index_type"] = "IVF"; - info.index_params["index_mode"] = "CPU"; info.index_params["metric_type"] = knowhere::metric::L2; segment->DropFieldData(milvus::FieldId(100)); segment->LoadIndex(info); diff --git a/internal/core/unittest/test_c_api.cpp b/internal/core/unittest/test_c_api.cpp index 95cd699ba2..05fd7cf186 100644 --- a/internal/core/unittest/test_c_api.cpp +++ b/internal/core/unittest/test_c_api.cpp @@ -184,8 +184,7 @@ generate_collection_schema(std::string metric_type, int dim, bool is_binary) { // VecIndexPtr // generate_index( // void* raw_data, knowhere::Config conf, int64_t dim, int64_t topK, int64_t N, knowhere::IndexType index_type) { -// auto indexing = knowhere::VecIndexFactory::GetInstance().CreateVecIndex(index_type, -// knowhere::IndexMode::MODE_CPU); +// auto indexing = knowhere::VecIndexFactory::GetInstance().CreateVecIndex(index_type); // // auto database = knowhere::GenDataset(N, dim, raw_data); // indexing->Train(database, conf); @@ -1681,16 +1680,11 @@ TEST(CApiTest, LoadIndexInfo) { std::string index_param_value1 = "IVF_PQ"; status = AppendIndexParam( c_load_index_info, index_param_key1.data(), index_param_value1.data()); - std::string index_param_key2 = "index_mode"; - std::string index_param_value2 = "CPU"; + std::string index_param_key2 = knowhere::meta::METRIC_TYPE; + std::string index_param_value2 = knowhere::metric::L2; status = AppendIndexParam( c_load_index_info, index_param_key2.data(), index_param_value2.data()); ASSERT_EQ(status.error_code, Success); - std::string index_param_key3 = knowhere::meta::METRIC_TYPE; - std::string index_param_value3 = knowhere::metric::L2; - status = AppendIndexParam( - c_load_index_info, index_param_key3.data(), index_param_value3.data()); - ASSERT_EQ(status.error_code, Success); std::string field_name = "field0"; status = AppendFieldInfo(c_load_index_info, 0, 0, 0, 0, CDataType::FloatVector); @@ -1733,10 +1727,7 @@ TEST(CApiTest, LoadIndex_Search) { milvus::segcore::LoadIndexInfo load_index_info; auto& index_params = load_index_info.index_params; index_params["index_type"] = "IVF_PQ"; - index_params["index_mode"] = "CPU"; - auto mode = knowhere::IndexMode::MODE_CPU; - load_index_info.index = std::make_unique( - index_params["index_type"], knowhere::metric::L2, mode); + load_index_info.index = std::make_unique(index_params["index_type"], knowhere::metric::L2); load_index_info.index->Load(binary_set); // search @@ -1859,15 +1850,11 @@ TEST(CApiTest, Indexing_Without_Predicate) { ASSERT_EQ(status.error_code, Success); std::string index_type_key = "index_type"; std::string index_type_value = "IVF_PQ"; - std::string index_mode_key = "index_mode"; - std::string index_mode_value = "CPU"; std::string metric_type_key = "metric_type"; std::string metric_type_value = "L2"; AppendIndexParam( c_load_index_info, index_type_key.c_str(), index_type_value.c_str()); - AppendIndexParam( - c_load_index_info, index_mode_key.c_str(), index_mode_value.c_str()); AppendIndexParam( c_load_index_info, metric_type_key.c_str(), metric_type_value.c_str()); AppendFieldInfo(c_load_index_info, 0, 0, 0, 100, CDataType::FloatVector); @@ -2009,15 +1996,11 @@ TEST(CApiTest, Indexing_Expr_Without_Predicate) { ASSERT_EQ(status.error_code, Success); std::string index_type_key = "index_type"; std::string index_type_value = "IVF_PQ"; - std::string index_mode_key = "index_mode"; - std::string index_mode_value = "CPU"; std::string metric_type_key = "metric_type"; std::string metric_type_value = "L2"; AppendIndexParam( c_load_index_info, index_type_key.c_str(), index_type_value.c_str()); - AppendIndexParam( - c_load_index_info, index_mode_key.c_str(), index_mode_value.c_str()); AppendIndexParam( c_load_index_info, metric_type_key.c_str(), metric_type_value.c_str()); AppendFieldInfo(c_load_index_info, 0, 0, 0, 100, CDataType::FloatVector); @@ -2175,15 +2158,11 @@ TEST(CApiTest, Indexing_With_float_Predicate_Range) { ASSERT_EQ(status.error_code, Success); std::string index_type_key = "index_type"; std::string index_type_value = "IVF_PQ"; - std::string index_mode_key = "index_mode"; - std::string index_mode_value = "CPU"; std::string metric_type_key = "metric_type"; std::string metric_type_value = "L2"; AppendIndexParam( c_load_index_info, index_type_key.c_str(), index_type_value.c_str()); - AppendIndexParam( - c_load_index_info, index_mode_key.c_str(), index_mode_value.c_str()); AppendIndexParam( c_load_index_info, metric_type_key.c_str(), metric_type_value.c_str()); AppendFieldInfo(c_load_index_info, 0, 0, 0, 100, CDataType::FloatVector); @@ -2354,15 +2333,11 @@ TEST(CApiTest, Indexing_Expr_With_float_Predicate_Range) { ASSERT_EQ(status.error_code, Success); std::string index_type_key = "index_type"; std::string index_type_value = "IVF_PQ"; - std::string index_mode_key = "index_mode"; - std::string index_mode_value = "CPU"; std::string metric_type_key = "metric_type"; std::string metric_type_value = "L2"; AppendIndexParam( c_load_index_info, index_type_key.c_str(), index_type_value.c_str()); - AppendIndexParam( - c_load_index_info, index_mode_key.c_str(), index_mode_value.c_str()); AppendIndexParam( c_load_index_info, metric_type_key.c_str(), metric_type_value.c_str()); AppendFieldInfo(c_load_index_info, 0, 0, 0, 100, CDataType::FloatVector); @@ -2516,15 +2491,11 @@ TEST(CApiTest, Indexing_With_float_Predicate_Term) { ASSERT_EQ(status.error_code, Success); std::string index_type_key = "index_type"; std::string index_type_value = "IVF_PQ"; - std::string index_mode_key = "index_mode"; - std::string index_mode_value = "CPU"; std::string metric_type_key = "metric_type"; std::string metric_type_value = "L2"; AppendIndexParam( c_load_index_info, index_type_key.c_str(), index_type_value.c_str()); - AppendIndexParam( - c_load_index_info, index_mode_key.c_str(), index_mode_value.c_str()); AppendIndexParam( c_load_index_info, metric_type_key.c_str(), metric_type_value.c_str()); AppendFieldInfo(c_load_index_info, 0, 0, 0, 100, CDataType::FloatVector); @@ -2688,15 +2659,11 @@ TEST(CApiTest, Indexing_Expr_With_float_Predicate_Term) { ASSERT_EQ(status.error_code, Success); std::string index_type_key = "index_type"; std::string index_type_value = "IVF_PQ"; - std::string index_mode_key = "index_mode"; - std::string index_mode_value = "CPU"; std::string metric_type_key = "metric_type"; std::string metric_type_value = "L2"; AppendIndexParam( c_load_index_info, index_type_key.c_str(), index_type_value.c_str()); - AppendIndexParam( - c_load_index_info, index_mode_key.c_str(), index_mode_value.c_str()); AppendIndexParam( c_load_index_info, metric_type_key.c_str(), metric_type_value.c_str()); AppendFieldInfo(c_load_index_info, 0, 0, 0, 100, CDataType::FloatVector); @@ -2853,15 +2820,11 @@ TEST(CApiTest, Indexing_With_binary_Predicate_Range) { ASSERT_EQ(status.error_code, Success); std::string index_type_key = "index_type"; std::string index_type_value = "BIN_IVF_FLAT"; - std::string index_mode_key = "index_mode"; - std::string index_mode_value = "CPU"; std::string metric_type_key = "metric_type"; std::string metric_type_value = "JACCARD"; AppendIndexParam( c_load_index_info, index_type_key.c_str(), index_type_value.c_str()); - AppendIndexParam( - c_load_index_info, index_mode_key.c_str(), index_mode_value.c_str()); AppendIndexParam( c_load_index_info, metric_type_key.c_str(), metric_type_value.c_str()); AppendFieldInfo(c_load_index_info, 0, 0, 0, 100, CDataType::BinaryVector); @@ -3032,15 +2995,11 @@ TEST(CApiTest, Indexing_Expr_With_binary_Predicate_Range) { ASSERT_EQ(status.error_code, Success); std::string index_type_key = "index_type"; std::string index_type_value = "BIN_IVF_FLAT"; - std::string index_mode_key = "index_mode"; - std::string index_mode_value = "CPU"; std::string metric_type_key = "metric_type"; std::string metric_type_value = "JACCARD"; AppendIndexParam( c_load_index_info, index_type_key.c_str(), index_type_value.c_str()); - AppendIndexParam( - c_load_index_info, index_mode_key.c_str(), index_mode_value.c_str()); AppendIndexParam( c_load_index_info, metric_type_key.c_str(), metric_type_value.c_str()); AppendFieldInfo(c_load_index_info, 0, 0, 0, 100, CDataType::BinaryVector); @@ -3196,15 +3155,11 @@ TEST(CApiTest, Indexing_With_binary_Predicate_Term) { ASSERT_EQ(status.error_code, Success); std::string index_type_key = "index_type"; std::string index_type_value = "BIN_IVF_FLAT"; - std::string index_mode_key = "index_mode"; - std::string index_mode_value = "CPU"; std::string metric_type_key = "metric_type"; std::string metric_type_value = "JACCARD"; AppendIndexParam( c_load_index_info, index_type_key.c_str(), index_type_value.c_str()); - AppendIndexParam( - c_load_index_info, index_mode_key.c_str(), index_mode_value.c_str()); AppendIndexParam( c_load_index_info, metric_type_key.c_str(), metric_type_value.c_str()); AppendFieldInfo(c_load_index_info, 0, 0, 0, 100, CDataType::BinaryVector); @@ -3391,15 +3346,11 @@ TEST(CApiTest, Indexing_Expr_With_binary_Predicate_Term) { ASSERT_EQ(status.error_code, Success); std::string index_type_key = "index_type"; std::string index_type_value = "BIN_IVF_FLAT"; - std::string index_mode_key = "index_mode"; - std::string index_mode_value = "CPU"; std::string metric_type_key = "metric_type"; std::string metric_type_value = "JACCARD"; AppendIndexParam( c_load_index_info, index_type_key.c_str(), index_type_value.c_str()); - AppendIndexParam( - c_load_index_info, index_mode_key.c_str(), index_mode_value.c_str()); AppendIndexParam( c_load_index_info, metric_type_key.c_str(), metric_type_value.c_str()); AppendFieldInfo(c_load_index_info, 0, 0, 0, 100, CDataType::BinaryVector); @@ -3578,15 +3529,11 @@ TEST(CApiTest, SealedSegment_search_float_Predicate_Range) { ASSERT_EQ(status.error_code, Success); std::string index_type_key = "index_type"; std::string index_type_value = "IVF_PQ"; - std::string index_mode_key = "index_mode"; - std::string index_mode_value = "CPU"; std::string metric_type_key = "metric_type"; std::string metric_type_value = "L2"; AppendIndexParam( c_load_index_info, index_type_key.c_str(), index_type_value.c_str()); - AppendIndexParam( - c_load_index_info, index_mode_key.c_str(), index_mode_value.c_str()); AppendIndexParam( c_load_index_info, metric_type_key.c_str(), metric_type_value.c_str()); AppendFieldInfo(c_load_index_info, 0, 0, 0, 100, CDataType::FloatVector); @@ -3888,15 +3835,11 @@ TEST(CApiTest, SealedSegment_search_float_With_Expr_Predicate_Range) { ASSERT_EQ(status.error_code, Success); std::string index_type_key = "index_type"; std::string index_type_value = "IVF_PQ"; - std::string index_mode_key = "index_mode"; - std::string index_mode_value = "CPU"; std::string metric_type_key = "metric_type"; std::string metric_type_value = "L2"; AppendIndexParam( c_load_index_info, index_type_key.c_str(), index_type_value.c_str()); - AppendIndexParam( - c_load_index_info, index_mode_key.c_str(), index_mode_value.c_str()); AppendIndexParam( c_load_index_info, metric_type_key.c_str(), metric_type_value.c_str()); AppendFieldInfo(c_load_index_info, 0, 0, 0, 100, CDataType::FloatVector); diff --git a/internal/core/unittest/test_utils/DataGen.h b/internal/core/unittest/test_utils/DataGen.h index e1d88879c0..f4f8dbb62f 100644 --- a/internal/core/unittest/test_utils/DataGen.h +++ b/internal/core/unittest/test_utils/DataGen.h @@ -518,8 +518,7 @@ GenVecIndexing(int64_t N, int64_t dim, const float* vec) { auto database = knowhere::GenDataSet(N, dim, vec); auto indexing = std::make_unique( knowhere::IndexEnum::INDEX_FAISS_IVFFLAT, - knowhere::metric::L2, - IndexMode::MODE_CPU); + knowhere::metric::L2); indexing->BuildWithDataset(database, conf); return indexing; }