未验证 提交 91b165d3 编写于 作者: J Jin Hai 提交者: GitHub

Merge pull request #624 from cydrain/caiyd_fix_gpu_index

fix gpu index build hang when gpu resources disabled
......@@ -37,6 +37,7 @@ Please mark all change in change log and use the ticket from JIRA.
- \#547 - NSG build failed using GPU-edition if set gpu_enable false
- \#552 - Server down during building index_type: IVF_PQ using GPU-edition
- \#561 - Milvus server should report exception/error message or terminate on mysql metadata backend error
- \#579 - Build index hang in GPU version when gpu_resources disabled
- \#599 - Build index log is incorrect
- \#602 - Optimizer specify wrong gpu_id
- \#606 - No log generated during building index with CPU
......
......@@ -1033,11 +1033,7 @@ DBImpl::BuildTableIndexRecursively(const std::string& table_id, const TableIndex
if (!failed_files.empty()) {
std::string msg = "Failed to build index for " + std::to_string(failed_files.size()) +
((failed_files.size() == 1) ? " file" : " files");
#ifdef MILVUS_GPU_VERSION
msg += ", file size is too large or gpu memory is not enough.";
#else
msg += ", please double check index parameters.";
#endif
return Status(DB_ERROR, msg);
}
......
......@@ -86,6 +86,11 @@ ExecutionEngineImpl::ExecutionEngineImpl(VecIndexPtr index, const std::string& l
VecIndexPtr
ExecutionEngineImpl::CreatetVecIndex(EngineType type) {
#ifdef MILVUS_GPU_VERSION
server::Config& config = server::Config::GetInstance();
bool gpu_resource_enable = true;
config.GetGpuResourceConfigEnable(gpu_resource_enable);
#endif
std::shared_ptr<VecIndex> index;
switch (type) {
case EngineType::FAISS_IDMAP: {
......@@ -94,18 +99,20 @@ ExecutionEngineImpl::CreatetVecIndex(EngineType type) {
}
case EngineType::FAISS_IVFFLAT: {
#ifdef MILVUS_GPU_VERSION
index = GetVecIndexFactory(IndexType::FAISS_IVFFLAT_MIX);
#else
index = GetVecIndexFactory(IndexType::FAISS_IVFFLAT_CPU);
if (gpu_resource_enable)
index = GetVecIndexFactory(IndexType::FAISS_IVFFLAT_MIX);
else
#endif
index = GetVecIndexFactory(IndexType::FAISS_IVFFLAT_CPU);
break;
}
case EngineType::FAISS_IVFSQ8: {
#ifdef MILVUS_GPU_VERSION
index = GetVecIndexFactory(IndexType::FAISS_IVFSQ8_MIX);
#else
index = GetVecIndexFactory(IndexType::FAISS_IVFSQ8_CPU);
if (gpu_resource_enable)
index = GetVecIndexFactory(IndexType::FAISS_IVFSQ8_MIX);
else
#endif
index = GetVecIndexFactory(IndexType::FAISS_IVFSQ8_CPU);
break;
}
case EngineType::NSG_MIX: {
......@@ -120,10 +127,11 @@ ExecutionEngineImpl::CreatetVecIndex(EngineType type) {
#endif
case EngineType::FAISS_PQ: {
#ifdef MILVUS_GPU_VERSION
index = GetVecIndexFactory(IndexType::FAISS_IVFPQ_MIX);
#else
index = GetVecIndexFactory(IndexType::FAISS_IVFPQ_CPU);
if (gpu_resource_enable)
index = GetVecIndexFactory(IndexType::FAISS_IVFPQ_MIX);
else
#endif
index = GetVecIndexFactory(IndexType::FAISS_IVFPQ_CPU);
break;
}
case EngineType::SPTAG_KDT: {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册