提交 b7776c03 编写于 作者: S starlord

MS-413 - MS-413 - Create index failed and server exited


Former-commit-id: 93495381c91d83638049519a8a95211631e22cd5
上级 69448022
......@@ -9,6 +9,7 @@ Please mark all change in change log and use the ticket from JIRA.
- MS-412 - Fix gpu cache logical error
- MS-416 - ExecutionEngineImpl::GpuCache has not return value cause crash
- MS-417 - YAML sequence load disable cause scheduler startup failed
- MS-413 - Create index failed and server exited
## Improvement
- MS-327 - Clean code for milvus
......
......@@ -19,6 +19,8 @@ namespace zilliz {
namespace milvus {
namespace engine {
static constexpr float TYPICAL_COUNT = 1000000.0;
struct FileIOWriter {
std::fstream fs;
std::string name;
......@@ -192,7 +194,13 @@ 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) {
auto nlist = cfg.get_with_default("nlist", 0);
if (int(size/1000000.0) * nlist == 0) { cfg["nlist"] = int(size / 1000000.0 * 16384); }
if (size <= TYPICAL_COUNT/16384 + 1) {
//handle less row count, avoid nlist set to 0
cfg["nlist"] = 1;
} else if (int(size/TYPICAL_COUNT) * nlist == 0) {
//calculate a proper nlist if nlist not specified or size less than TYPICAL_COUNT
cfg["nlist"] = int(size / TYPICAL_COUNT * 16384);
}
if (!cfg.contains("gpu_id")) { cfg["gpu_id"] = int(0); }
if (!cfg.contains("metric_type")) { cfg["metric_type"] = "L2"; }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册