MS-307 enable-nsg

Former-commit-id: 5ed714d17e5ad58b610fd01d1041eb11203b15bf
This commit is contained in:
xj.lin 2019-08-03 19:38:35 +08:00
parent 3db2702ae8
commit adc77015b3
4 changed files with 10 additions and 8 deletions

View File

@ -20,7 +20,7 @@ enum class EngineType {
FAISS_IVFFLAT,
FAISS_IVFSQ8,
NSG_MIX,
MAX_VALUE = FAISS_IVFSQ8,
MAX_VALUE = NSG_MIX,
};
class ExecutionEngine {

View File

@ -203,11 +203,13 @@ void AutoGenParams(const IndexType &type, const long &size, zilliz::knowhere::Co
case IndexType::NSG_MIX: {
auto scale_factor = round(cfg["dim"].as<int>() / 128.0);
scale_factor = scale_factor >= 4 ? 4 : scale_factor;
if (!cfg.contains("nprobe")) { cfg["nprobe"] = 16 + 10 * scale_factor; }
cfg["nlist"] = int(size / 1000000.0 * 8192);
if (!cfg.contains("nprobe")) { cfg["nprobe"] = 6 + 10 * scale_factor; }
if (!cfg.contains("knng")) { cfg["knng"] = 100 + 100 * scale_factor; }
if (!cfg.contains("search_length")) { cfg["search_length"] = 30 + 10 * scale_factor; }
if (!cfg.contains("out_degree")) { cfg["out_degree"] = 40 + 5 * scale_factor; }
if (!cfg.contains("search_length")) { cfg["search_length"] = 40 + 5 * scale_factor; }
if (!cfg.contains("out_degree")) { cfg["out_degree"] = 50 + 5 * scale_factor; }
if (!cfg.contains("candidate_pool_size")) { cfg["candidate_pool_size"] = 200 + 100 * scale_factor; }
WRAPPER_LOG_DEBUG << pretty_print(cfg);
break;
}
}

@ -1 +1 @@
Subproject commit 5032e91e3d8bee1760c3f86f7eb4c857e59546ad
Subproject commit 6a4f242ec40c539f1e6d9a7305282f7ff03c19d2

View File

@ -110,9 +110,9 @@ INSTANTIATE_TEST_CASE_P(WrapperParam, KnowhereWrapperTest,
Config::object{{"dim", 64}, {"k", 10}, {"nprobe", 5}}
),
std::make_tuple(IndexType::NSG_MIX, "Default",
128, 100000, 10, 10,
Config::object{{"dim", 128}, {"nlist", 1638}, {"nprobe", 10}, {"metric_type", "L2"},
{"knng", 50}, {"search_length", 40}, {"out_degree", 30}, {"candidate_pool_size", 200}},
128, 250000, 10, 10,
Config::object{{"dim", 128}, {"nlist", 8192}, {"nprobe", 16}, {"metric_type", "L2"},
{"knng", 200}, {"search_length", 40}, {"out_degree", 60}, {"candidate_pool_size", 200}},
Config::object{{"k", 10}, {"search_length", 20}}
)
//std::make_tuple(IndexType::SPTAG_KDT_RNT_CPU, "Default",