From 8a2d5c8296b0c56e670c96a4dad5ed7c553962db Mon Sep 17 00:00:00 2001 From: "xiaojun.lin" Date: Mon, 14 Oct 2019 19:20:08 +0800 Subject: [PATCH 1/2] fix copy_cpu_to_gpu Former-commit-id: 8703a392ac93bd9450492a6841a169bb2287c6ea --- .../index/vector_index/IndexIVFSQHybrid.cpp | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/core/src/index/knowhere/knowhere/index/vector_index/IndexIVFSQHybrid.cpp b/core/src/index/knowhere/knowhere/index/vector_index/IndexIVFSQHybrid.cpp index e44d049a1a..9b6bebd79a 100644 --- a/core/src/index/knowhere/knowhere/index/vector_index/IndexIVFSQHybrid.cpp +++ b/core/src/index/knowhere/knowhere/index/vector_index/IndexIVFSQHybrid.cpp @@ -79,8 +79,24 @@ IVFSQHybrid::CopyGpuToCpu(const Config& config) { VectorIndexPtr IVFSQHybrid::CopyCpuToGpu(const int64_t& device_id, const Config& config) { - auto p = CopyCpuToGpuWithQuantizer(device_id, config); - return p.first; + if (auto res = FaissGpuResourceMgr::GetInstance().GetRes(device_id)) { + ResScope rs(res, device_id, false); + faiss::gpu::GpuClonerOptions option; + option.allInGpu = true; + + faiss::IndexComposition index_composition; + index_composition.index = index_.get(); + index_composition.quantizer = nullptr; + index_composition.mode = 0; // copy all + + auto gpu_index = faiss::gpu::index_cpu_to_gpu(res->faiss_res.get(), device_id, &index_composition, &option); + + std::shared_ptr device_index = std::shared_ptr(gpu_index);; + auto new_idx = std::make_shared(device_index, device_id, res); + return new_idx; + } else { + KNOWHERE_THROW_MSG("CopyCpuToGpu Error, can't get gpu_resource"); + } } void From 80339fae7b488a8eff931c9cd7f89e9c67854bdf Mon Sep 17 00:00:00 2001 From: "xiaojun.lin" Date: Mon, 14 Oct 2019 19:24:29 +0800 Subject: [PATCH 2/2] update Former-commit-id: 34c175b32ce8eaab4505759e80c61128e34262f8 --- core/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core/CHANGELOG.md b/core/CHANGELOG.md index 6c561c0e5a..8b6b125b8e 100644 --- a/core/CHANGELOG.md +++ b/core/CHANGELOG.md @@ -17,6 +17,7 @@ Please mark all change in change log and use the ticket from JIRA. - MS-640 - Cache object size calculate incorrect - MS-641 - Segment fault(signal 11) in PickToLoad - MS-639 - SQ8H index created failed and server hang +- MS-652 - IVFSQH quantization double free ## Improvement - MS-552 - Add and change the easylogging library