Loading CHANGELOG.md +1 −0 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ Please mark all change in change log and use the ticket from JIRA. - \#248 - Reside src/external in thirdparty - \#316 - Some files not merged after vectors added - \#327 - Search does not use GPU when index type is FLAT - \#331 - Add exception handle when search fail - \#340 - Test cases run failed on 0.6.0 - \#353 - Rename config.h.in to version.h.in - \#374 - sdk_simple return empty result Loading core/src/index/knowhere/knowhere/index/vector_index/IndexGPUIVF.cpp +3 −6 Original line number Diff line number Diff line Loading @@ -132,11 +132,8 @@ GPUIVF::search_impl(int64_t n, const float* data, int64_t k, float* distances, i auto search_cfg = std::dynamic_pointer_cast<IVFCfg>(cfg); device_index->nprobe = search_cfg->nprobe; // assert(device_index->getNumProbes() == search_cfg->nprobe); { ResScope rs(res_, gpu_id_); device_index->search(n, (float*)data, k, distances, labels); } } else { KNOWHERE_THROW_MSG("Not a GpuIndexIVF type."); } Loading core/src/index/knowhere/knowhere/index/vector_index/IndexIVF.cpp +42 −36 Original line number Diff line number Diff line Loading @@ -119,6 +119,7 @@ IVF::Search(const DatasetPtr& dataset, const Config& config) { GETTENSOR(dataset) try { auto elems = rows * search_cfg->k; auto res_ids = (int64_t*)malloc(sizeof(int64_t) * elems); auto res_dis = (float*)malloc(sizeof(float) * elems); Loading Loading @@ -155,6 +156,11 @@ IVF::Search(const DatasetPtr& dataset, const Config& config) { // std::vector<ArrayPtr> array{ids, dists}; return std::make_shared<Dataset>((void*)res_ids, (void*)res_dis); } catch (faiss::FaissException& e) { KNOWHERE_THROW_MSG(e.what()); } catch (std::exception& e) { KNOWHERE_THROW_MSG(e.what()); } } void Loading core/src/scheduler/task/SearchTask.cpp +7 −1 Original line number Diff line number Diff line Loading @@ -212,7 +212,13 @@ XSearchTask::Execute() { ResMgrInst::GetInstance()->GetResource(path().Last())->type() == ResourceType::CPU) { hybrid = true; } Status s = index_engine_->Search(nq, vectors, topk, nprobe, output_distance.data(), output_ids.data(), hybrid); if (!s.ok()) { search_job->GetStatus() = s; search_job->SearchDone(index_id_); return; } double span = rc.RecordSection(hdr + ", do search"); // search_job->AccumSearchCost(span); Loading Loading
CHANGELOG.md +1 −0 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ Please mark all change in change log and use the ticket from JIRA. - \#248 - Reside src/external in thirdparty - \#316 - Some files not merged after vectors added - \#327 - Search does not use GPU when index type is FLAT - \#331 - Add exception handle when search fail - \#340 - Test cases run failed on 0.6.0 - \#353 - Rename config.h.in to version.h.in - \#374 - sdk_simple return empty result Loading
core/src/index/knowhere/knowhere/index/vector_index/IndexGPUIVF.cpp +3 −6 Original line number Diff line number Diff line Loading @@ -132,11 +132,8 @@ GPUIVF::search_impl(int64_t n, const float* data, int64_t k, float* distances, i auto search_cfg = std::dynamic_pointer_cast<IVFCfg>(cfg); device_index->nprobe = search_cfg->nprobe; // assert(device_index->getNumProbes() == search_cfg->nprobe); { ResScope rs(res_, gpu_id_); device_index->search(n, (float*)data, k, distances, labels); } } else { KNOWHERE_THROW_MSG("Not a GpuIndexIVF type."); } Loading
core/src/index/knowhere/knowhere/index/vector_index/IndexIVF.cpp +42 −36 Original line number Diff line number Diff line Loading @@ -119,6 +119,7 @@ IVF::Search(const DatasetPtr& dataset, const Config& config) { GETTENSOR(dataset) try { auto elems = rows * search_cfg->k; auto res_ids = (int64_t*)malloc(sizeof(int64_t) * elems); auto res_dis = (float*)malloc(sizeof(float) * elems); Loading Loading @@ -155,6 +156,11 @@ IVF::Search(const DatasetPtr& dataset, const Config& config) { // std::vector<ArrayPtr> array{ids, dists}; return std::make_shared<Dataset>((void*)res_ids, (void*)res_dis); } catch (faiss::FaissException& e) { KNOWHERE_THROW_MSG(e.what()); } catch (std::exception& e) { KNOWHERE_THROW_MSG(e.what()); } } void Loading
core/src/scheduler/task/SearchTask.cpp +7 −1 Original line number Diff line number Diff line Loading @@ -212,7 +212,13 @@ XSearchTask::Execute() { ResMgrInst::GetInstance()->GetResource(path().Last())->type() == ResourceType::CPU) { hybrid = true; } Status s = index_engine_->Search(nq, vectors, topk, nprobe, output_distance.data(), output_ids.data(), hybrid); if (!s.ok()) { search_job->GetStatus() = s; search_job->SearchDone(index_id_); return; } double span = rc.RecordSection(hdr + ", do search"); // search_job->AccumSearchCost(span); Loading