Unverified Commit 220ecf5f authored by groot's avatar groot Committed by GitHub
Browse files

Server crashed when searching vectors using GPU(#1429) (#1458)



Signed-off-by: default avatargroot <yihua.mo@zilliz.com>
parent d380c8d6
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ Please mark all change in change log and use the issue from GitHub
- \#1240 - Update license declaration
- \#1298 - Unittest failed when on CPU2GPU case
- \#1359 - Negative distance value returned when searching with HNSW index type
- \#1429 - Server crashed when searching vectors using GPU

## Feature
- \#216 - Add CLI to get server info
+15 −6
Original line number Diff line number Diff line
@@ -32,27 +32,36 @@ CopyGpuToCpu(const VectorIndexPtr& index, const Config& config) {

VectorIndexPtr
CopyCpuToGpu(const VectorIndexPtr& index, const int64_t& device_id, const Config& config) {
    VectorIndexPtr result;
    auto uids = index->GetUids();
#ifdef CUSTOMIZATION
    if (auto device_index = std::dynamic_pointer_cast<IVFSQHybrid>(index)) {
        return device_index->CopyCpuToGpu(device_id, config);
        result = device_index->CopyCpuToGpu(device_id, config);
        result->SetUids(uids);
        return result;
    }
#endif

    if (auto device_index = std::dynamic_pointer_cast<GPUIndex>(index)) {
        return device_index->CopyGpuToGpu(device_id, config);
        result = device_index->CopyGpuToGpu(device_id, config);
        result->SetUids(uids);
        return result;
    }

    if (auto cpu_index = std::dynamic_pointer_cast<IVFSQ>(index)) {
        return cpu_index->CopyCpuToGpu(device_id, config);
        result = cpu_index->CopyCpuToGpu(device_id, config);
    } else if (auto cpu_index = std::dynamic_pointer_cast<IVFPQ>(index)) {
        return cpu_index->CopyCpuToGpu(device_id, config);
        result = cpu_index->CopyCpuToGpu(device_id, config);
    } else if (auto cpu_index = std::dynamic_pointer_cast<IVF>(index)) {
        return cpu_index->CopyCpuToGpu(device_id, config);
        result = cpu_index->CopyCpuToGpu(device_id, config);
    } else if (auto cpu_index = std::dynamic_pointer_cast<IDMAP>(index)) {
        return cpu_index->CopyCpuToGpu(device_id, config);
        result = cpu_index->CopyCpuToGpu(device_id, config);
    } else {
        KNOWHERE_THROW_MSG("this index type not support tranfer to gpu");
    }

    result->SetUids(uids);
    return result;
}

}  // namespace cloner