提交 2c755641 编写于 作者: P peng.xu

Merge branch 'branch-0.4.0' into 'branch-0.4.0'

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

See merge request megasearch/milvus!441

Former-commit-id: aebea3c146c338c427c0a6e9f2cfa4e3c0017d3c
...@@ -9,6 +9,7 @@ Please mark all change in change log and use the ticket from JIRA. ...@@ -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-412 - Fix gpu cache logical error
- MS-416 - ExecutionEngineImpl::GpuCache has not return value cause crash - MS-416 - ExecutionEngineImpl::GpuCache has not return value cause crash
- MS-417 - YAML sequence load disable cause scheduler startup failed - MS-417 - YAML sequence load disable cause scheduler startup failed
- MS-413 - Create index failed and server exited
## Improvement ## Improvement
- MS-327 - Clean code for milvus - MS-327 - Clean code for milvus
......
...@@ -19,6 +19,8 @@ namespace zilliz { ...@@ -19,6 +19,8 @@ namespace zilliz {
namespace milvus { namespace milvus {
namespace engine { namespace engine {
static constexpr float TYPICAL_COUNT = 1000000.0;
struct FileIOWriter { struct FileIOWriter {
std::fstream fs; std::fstream fs;
std::string name; std::string name;
...@@ -192,7 +194,13 @@ server::KnowhereError write_index(VecIndexPtr index, const std::string &location ...@@ -192,7 +194,13 @@ server::KnowhereError write_index(VecIndexPtr index, const std::string &location
// TODO(linxj): redo here. // TODO(linxj): redo here.
void AutoGenParams(const IndexType &type, const long &size, zilliz::knowhere::Config &cfg) { void AutoGenParams(const IndexType &type, const long &size, zilliz::knowhere::Config &cfg) {
auto nlist = cfg.get_with_default("nlist", 0); 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("gpu_id")) { cfg["gpu_id"] = int(0); }
if (!cfg.contains("metric_type")) { cfg["metric_type"] = "L2"; } 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.
先完成此消息的编辑!
想要评论请 注册