未验证 提交 220ecf5f 编写于 作者: G groot 提交者: GitHub

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

Signed-off-by: Ngroot <yihua.mo@zilliz.com>
上级 d380c8d6
......@@ -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
......
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册