提交 5e41d5c0 编写于 作者: J jinhai

Merge branch 'change_top_k_limitation' into 'branch-0.4.0'

MS-496 Change the top_k limitation from 1024 to 2048

See merge request megasearch/milvus!501

Former-commit-id: b696a02067acc43971f319ae914dc1c0360af404
...@@ -92,6 +92,7 @@ Please mark all change in change log and use the ticket from JIRA. ...@@ -92,6 +92,7 @@ Please mark all change in change log and use the ticket from JIRA.
- MS-487 - Define metric type in CreateTable - MS-487 - Define metric type in CreateTable
- MS-488 - Improve code format in scheduler - MS-488 - Improve code format in scheduler
- MS-495 - cmake: integrated knowhere - MS-495 - cmake: integrated knowhere
- MS-496 - Change the top_k limitation from 1024 to 2048
- MS-505 - Install core unit test and add to coverage - MS-505 - Install core unit test and add to coverage
## New Feature ## New Feature
......
...@@ -94,7 +94,7 @@ ValidationUtil::ValidateTableIndexMetricType(int32_t metric_type) { ...@@ -94,7 +94,7 @@ ValidationUtil::ValidateTableIndexMetricType(int32_t metric_type) {
ErrorCode ErrorCode
ValidationUtil::ValidateSearchTopk(int64_t top_k, const engine::meta::TableSchema& table_schema) { ValidationUtil::ValidateSearchTopk(int64_t top_k, const engine::meta::TableSchema& table_schema) {
if (top_k <= 0 || top_k > 1024) { if (top_k <= 0 || top_k > 2048) {
return SERVER_INVALID_TOPK; return SERVER_INVALID_TOPK;
} }
......
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
#include "vec_impl.h" #include "vec_impl.h"
#include "wrapper_log.h" #include "wrapper_log.h"
#include <cuda.h>
namespace zilliz { namespace zilliz {
namespace milvus { namespace milvus {
...@@ -246,11 +248,13 @@ void ParameterValidation(const IndexType &type, Config &cfg) { ...@@ -246,11 +248,13 @@ void ParameterValidation(const IndexType &type, Config &cfg) {
case IndexType::FAISS_IVFSQ8_GPU: case IndexType::FAISS_IVFSQ8_GPU:
case IndexType::FAISS_IVFFLAT_GPU: case IndexType::FAISS_IVFFLAT_GPU:
case IndexType::FAISS_IVFPQ_GPU: { case IndexType::FAISS_IVFPQ_GPU: {
//search on GPU
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_WARNING << "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
<< ". Search with " << GPU_MAX_NRPOBE << " instead"; << ", but you passed " << nprobe
<< ". Search with " << GPU_MAX_NRPOBE << " instead";
cfg.insert_or_assign("nprobe", GPU_MAX_NRPOBE); cfg.insert_or_assign("nprobe", GPU_MAX_NRPOBE);
} }
} }
......
...@@ -14,8 +14,6 @@ ...@@ -14,8 +14,6 @@
#include "knowhere/common/config.h" #include "knowhere/common/config.h"
#include "knowhere/common/binary_set.h" #include "knowhere/common/binary_set.h"
#include "cuda.h"
namespace zilliz { namespace zilliz {
namespace milvus { namespace milvus {
...@@ -62,7 +60,7 @@ class VecIndex { ...@@ -62,7 +60,7 @@ class VecIndex {
long *ids, long *ids,
const Config &cfg = Config()) = 0; const Config &cfg = Config()) = 0;
virtual VecIndexPtr CopyToGpu(const int64_t& device_id, virtual VecIndexPtr CopyToGpu(const int64_t &device_id,
const Config &cfg = Config()) = 0; const Config &cfg = Config()) = 0;
virtual VecIndexPtr CopyToCpu(const Config &cfg = Config()) = 0; virtual VecIndexPtr CopyToCpu(const Config &cfg = Config()) = 0;
...@@ -86,16 +84,16 @@ extern ErrorCode write_index(VecIndexPtr index, const std::string &location); ...@@ -86,16 +84,16 @@ extern ErrorCode write_index(VecIndexPtr index, const std::string &location);
extern VecIndexPtr read_index(const std::string &location); extern VecIndexPtr read_index(const std::string &location);
extern VecIndexPtr GetVecIndexFactory(const IndexType &type, const Config& cfg = Config()); extern VecIndexPtr GetVecIndexFactory(const IndexType &type, const Config &cfg = Config());
extern VecIndexPtr LoadVecIndex(const IndexType &index_type, const zilliz::knowhere::BinarySet &index_binary); extern VecIndexPtr LoadVecIndex(const IndexType &index_type, const zilliz::knowhere::BinarySet &index_binary);
extern void AutoGenParams(const IndexType& type, const long& size, Config& cfg); extern void AutoGenParams(const IndexType &type, const long &size, Config &cfg);
extern void ParameterValidation(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.
先完成此消息的编辑!
想要评论请 注册