IP search metric_type shouldn't be supported by IVF_PQ index on GPU version

This commit is contained in:
Yukikaze-CZR 2019-12-02 21:47:11 +08:00
parent 4ff8e871ae
commit fcc98ca183
3 changed files with 13 additions and 5 deletions

View File

@ -32,10 +32,6 @@ namespace knowhere {
IndexModelPtr
GPUIVFPQ::Train(const DatasetPtr& dataset, const Config& config) {
auto build_cfg = std::dynamic_pointer_cast<IVFPQCfg>(config);
if (build_cfg->metric_type == knowhere::METRICTYPE::IP) {
KNOWHERE_LOG_ERROR << "PQ not support IP in GPU version!";
throw KnowhereException("PQ not support IP in GPU version!");
}
if (build_cfg != nullptr) {
build_cfg->CheckValid(); // throw exception
}

View File

@ -18,6 +18,7 @@
#include "wrapper/ConfAdapter.h"
#include "WrapperException.h"
#include "knowhere/index/vector_index/helpers/IndexParameter.h"
#include "server/Config.h"
#include "utils/Log.h"
#include <cmath>
@ -130,6 +131,17 @@ IVFPQConfAdapter::Match(const TempMetaConf& metaconf) {
conf->nbits = 8;
MatchBase(conf);
#ifdef MILVUS_GPU_VERSION
Status s;
bool enable_gpu = false;
server::Config& config = server::Config::GetInstance();
s = config.GetGpuResourceConfigEnable(enable_gpu);
if (s.ok() && conf->metric_type == knowhere::METRICTYPE::IP) {
WRAPPER_LOG_ERROR << "PQ not support IP in GPU version!";
throw WrapperException("PQ not support IP in GPU version!");
}
#endif
/*
* Faiss 1.6
* Only 1, 2, 3, 4, 6, 8, 10, 12, 16, 20, 24, 28, 32 dims per sub-quantizer are currently supported with

View File

@ -59,7 +59,7 @@ IVFMixIndex::BuildAll(const int64_t& nb, const float* xb, const int64_t* ids, co
}
} catch (knowhere::KnowhereException& e) {
WRAPPER_LOG_ERROR << e.what();
throw WrapperException(e.what());
return Status(KNOWHERE_UNEXPECTED_ERROR, e.what());
} catch (std::exception& e) {
WRAPPER_LOG_ERROR << e.what();
return Status(KNOWHERE_ERROR, e.what());