Loading core/src/index/knowhere/knowhere/index/vector_index/IndexGPUIVF.cpp +3 −8 Original line number Diff line number Diff line Loading @@ -132,13 +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); try { ResScope rs(res_, gpu_id_); device_index->search(n, (float*)data, k, distances, labels); } catch (faiss::FaissException& e) { KNOWHERE_THROW_MSG(e.what()); } } else { KNOWHERE_THROW_MSG("Not a GpuIndexIVF type."); } Loading core/src/index/knowhere/knowhere/index/vector_index/IndexIVF.cpp +43 −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,12 @@ 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 Loading
core/src/index/knowhere/knowhere/index/vector_index/IndexGPUIVF.cpp +3 −8 Original line number Diff line number Diff line Loading @@ -132,13 +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); try { ResScope rs(res_, gpu_id_); device_index->search(n, (float*)data, k, distances, labels); } catch (faiss::FaissException& e) { KNOWHERE_THROW_MSG(e.what()); } } else { KNOWHERE_THROW_MSG("Not a GpuIndexIVF type."); } Loading
core/src/index/knowhere/knowhere/index/vector_index/IndexIVF.cpp +43 −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,12 @@ 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