From 3e6905cab354c86d1fb7a7b572aa6e9e9766bc41 Mon Sep 17 00:00:00 2001 From: Heisenberg Date: Fri, 6 Sep 2019 16:38:44 +0800 Subject: [PATCH] MS-453 GPU search error when nprobe set more than 1024 Former-commit-id: e20a8c1f47ccb05df1c20ffd99986ffaac28b3fb --- cpp/src/wrapper/knowhere/vec_impl.cpp | 2 +- cpp/src/wrapper/knowhere/vec_index.cpp | 4 ++-- cpp/src/wrapper/knowhere/vec_index.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cpp/src/wrapper/knowhere/vec_impl.cpp b/cpp/src/wrapper/knowhere/vec_impl.cpp index edb20cf8..cecf9dc8 100644 --- a/cpp/src/wrapper/knowhere/vec_impl.cpp +++ b/cpp/src/wrapper/knowhere/vec_impl.cpp @@ -74,7 +74,7 @@ server::KnowhereError VecIndexImpl::Search(const long &nq, const float *xq, floa Config search_cfg = cfg; - AutoTurnParams(type, search_cfg); + ParameterValidation(type, search_cfg); auto res = index_->Search(dataset, search_cfg); auto ids_array = res->array()[0]; diff --git a/cpp/src/wrapper/knowhere/vec_index.cpp b/cpp/src/wrapper/knowhere/vec_index.cpp index 2e4be3f2..95ca7edb 100644 --- a/cpp/src/wrapper/knowhere/vec_index.cpp +++ b/cpp/src/wrapper/knowhere/vec_index.cpp @@ -241,7 +241,7 @@ void AutoGenParams(const IndexType &type, const long &size, zilliz::knowhere::Co #define GPU_MAX_NRPOBE 1024 #endif -void AutoTurnParams(const IndexType &type, Config &cfg) { +void ParameterValidation(const IndexType &type, Config &cfg) { switch (type) { case IndexType::FAISS_IVFSQ8_GPU: case IndexType::FAISS_IVFFLAT_GPU: @@ -249,7 +249,7 @@ void AutoTurnParams(const IndexType &type, Config &cfg) { if (cfg.get_with_default("nprobe", 0) != 0) { auto nprobe = cfg["nprobe"].as(); if (nprobe > GPU_MAX_NRPOBE) { - WRAPPER_LOG_ERROR << "When search with GPU, nprobe shoud be no more than " << GPU_MAX_NRPOBE << ", but you passed " << nprobe + WRAPPER_LOG_WARNING << "When search with GPU, nprobe shoud be no more than " << GPU_MAX_NRPOBE << ", but you passed " << nprobe << ". Search with " << GPU_MAX_NRPOBE << " instead"; cfg.insert_or_assign("nprobe", GPU_MAX_NRPOBE); } diff --git a/cpp/src/wrapper/knowhere/vec_index.h b/cpp/src/wrapper/knowhere/vec_index.h index b5170acb..c2b7d9e8 100644 --- a/cpp/src/wrapper/knowhere/vec_index.h +++ b/cpp/src/wrapper/knowhere/vec_index.h @@ -92,7 +92,7 @@ extern VecIndexPtr LoadVecIndex(const IndexType &index_type, const zilliz::knowh extern void AutoGenParams(const IndexType& type, const long& size, Config& cfg); -extern void AutoTurnParams(const IndexType& type, Config& cfg); +extern void ParameterValidation(const IndexType& type, Config& cfg); extern IndexType ConvertToCpuIndexType(const IndexType& type); extern IndexType ConvertToGpuIndexType(const IndexType& type); -- GitLab