提交 3e6905ca 编写于 作者: H Heisenberg

MS-453 GPU search error when nprobe set more than 1024


Former-commit-id: e20a8c1f47ccb05df1c20ffd99986ffaac28b3fb
上级 04f7fe63
...@@ -74,7 +74,7 @@ server::KnowhereError VecIndexImpl::Search(const long &nq, const float *xq, floa ...@@ -74,7 +74,7 @@ server::KnowhereError VecIndexImpl::Search(const long &nq, const float *xq, floa
Config search_cfg = cfg; Config search_cfg = cfg;
AutoTurnParams(type, search_cfg); ParameterValidation(type, search_cfg);
auto res = index_->Search(dataset, search_cfg); auto res = index_->Search(dataset, search_cfg);
auto ids_array = res->array()[0]; auto ids_array = res->array()[0];
......
...@@ -241,7 +241,7 @@ void AutoGenParams(const IndexType &type, const long &size, zilliz::knowhere::Co ...@@ -241,7 +241,7 @@ void AutoGenParams(const IndexType &type, const long &size, zilliz::knowhere::Co
#define GPU_MAX_NRPOBE 1024 #define GPU_MAX_NRPOBE 1024
#endif #endif
void AutoTurnParams(const IndexType &type, Config &cfg) { void ParameterValidation(const IndexType &type, Config &cfg) {
switch (type) { switch (type) {
case IndexType::FAISS_IVFSQ8_GPU: case IndexType::FAISS_IVFSQ8_GPU:
case IndexType::FAISS_IVFFLAT_GPU: case IndexType::FAISS_IVFFLAT_GPU:
...@@ -249,7 +249,7 @@ void AutoTurnParams(const IndexType &type, Config &cfg) { ...@@ -249,7 +249,7 @@ void AutoTurnParams(const IndexType &type, Config &cfg) {
if (cfg.get_with_default("nprobe", 0) != 0) { if (cfg.get_with_default("nprobe", 0) != 0) {
auto nprobe = cfg["nprobe"].as<int>(); auto nprobe = cfg["nprobe"].as<int>();
if (nprobe > GPU_MAX_NRPOBE) { 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"; << ". Search with " << GPU_MAX_NRPOBE << " instead";
cfg.insert_or_assign("nprobe", GPU_MAX_NRPOBE); cfg.insert_or_assign("nprobe", GPU_MAX_NRPOBE);
} }
......
...@@ -92,7 +92,7 @@ extern VecIndexPtr LoadVecIndex(const IndexType &index_type, const zilliz::knowh ...@@ -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 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 ConvertToCpuIndexType(const IndexType& type);
extern IndexType ConvertToGpuIndexType(const IndexType& type); extern IndexType ConvertToGpuIndexType(const IndexType& type);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册