提交 fd304cf4 编写于 作者: F fishpenguin

remove #if

上级 1b6d90a5
......@@ -116,23 +116,29 @@ NSG::Train(const DatasetPtr& dataset, const Config& config) {
}
// TODO(linxj): dev IndexFactory, support more IndexType
bool use_gpu = false;
#ifdef MILVUS_GPU_VERSION
use_gpu = true;
auto temp_resource = FaissGpuResourceMgr::GetInstance().GetRes(build_cfg->gpu_id);
#if temp_resource == nullptr
auto preprocess_index = std::make_shared<IVF>();
#else
auto preprocess_index = std::make_shared<GPUIVF>(build_cfg->gpu_id);
if (temp_resource == nullptr)
use_gpu = false;
#endif
#else
auto preprocess_index = std::make_shared<IVF>();
#endif
auto model = preprocess_index->Train(dataset, config);
preprocess_index->set_index_model(model);
preprocess_index->AddWithoutIds(dataset, config);
Graph knng;
preprocess_index->GenGraph(build_cfg->knng, knng, dataset, config);
if (use_gpu) {
auto preprocess_index = std::make_shared<GPUIVF>(build_cfg->gpu_id);
auto model = preprocess_index->Train(dataset, config);
preprocess_index->set_index_model(model);
preprocess_index->AddWithoutIds(dataset, config);
preprocess_index->GenGraph(build_cfg->knng, knng, dataset, config);
} else {
auto preprocess_index = std::make_shared<IVF>();
auto model = preprocess_index->Train(dataset, config);
preprocess_index->set_index_model(model);
preprocess_index->AddWithoutIds(dataset, config);
preprocess_index->GenGraph(build_cfg->knng, knng, dataset, config);
}
algo::BuildParams b_params;
b_params.candidate_pool_size = build_cfg->candidate_pool_size;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册