From eb3f9aa6a539d012a684220ef65dea36edd133bf Mon Sep 17 00:00:00 2001 From: "xj.lin" Date: Tue, 13 Aug 2019 18:49:46 +0800 Subject: [PATCH] fix Former-commit-id: 7bb0559f007ef32b8331be8d4947ebe7595714b3 --- cpp/src/wrapper/knowhere/vec_index.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cpp/src/wrapper/knowhere/vec_index.cpp b/cpp/src/wrapper/knowhere/vec_index.cpp index 1473afbc..0337f0ab 100644 --- a/cpp/src/wrapper/knowhere/vec_index.cpp +++ b/cpp/src/wrapper/knowhere/vec_index.cpp @@ -191,7 +191,9 @@ server::KnowhereError write_index(VecIndexPtr index, const std::string &location // TODO(linxj): redo here. void AutoGenParams(const IndexType &type, const long &size, zilliz::knowhere::Config &cfg) { - if (!cfg.contains("nlist")) { cfg["nlist"] = int(size / 1000000.0 * 16384); } + auto nlist = cfg.get_with_default("nlist", 0); + if (int(size/1000000.0) * nlist == 0) { cfg["nlist"] = int(size / 1000000.0 * 16384); } + if (!cfg.contains("gpu_id")) { cfg["gpu_id"] = int(0); } if (!cfg.contains("metric_type")) { cfg["metric_type"] = "L2"; } -- GitLab