diff --git a/cpp/CHANGELOG.md b/cpp/CHANGELOG.md index 32ea1522f5..09b86893f0 100644 --- a/cpp/CHANGELOG.md +++ b/cpp/CHANGELOG.md @@ -56,6 +56,7 @@ Please mark all change in change log and use the ticket from JIRA. - MS-305 - Add CPU core percent metric - MS-310 - Add milvus CPU utilization ratio and CPU/GPU temperature metrics - MS-324 - Show error when there is not enough gpu memory to build index +- MS-328 - Check metric type on server start ## New Feature - MS-180 - Add new mem manager diff --git a/cpp/src/server/DBWrapper.cpp b/cpp/src/server/DBWrapper.cpp index 4487a37e19..a84e9a2dd8 100644 --- a/cpp/src/server/DBWrapper.cpp +++ b/cpp/src/server/DBWrapper.cpp @@ -66,6 +66,18 @@ DBWrapper::DBWrapper() { if(omp_thread > 0) { omp_set_num_threads(omp_thread); SERVER_LOG_DEBUG << "Specify openmp thread number: " << omp_thread; + } else { + uint32_t sys_thread_cnt = 8; + if(CommonUtil::GetSystemAvailableThreads(sys_thread_cnt)) { + omp_thread = (int32_t)ceil(sys_thread_cnt*0.5); + omp_set_num_threads(omp_thread); + } + } + + std::string metric_type = engine_config.GetValue(CONFIG_METRICTYPE, "L2"); + if(metric_type != "L2" && metric_type != "IP") { + std::cout << "ERROR! Illegal metric type: " << metric_type << ", available options: L2 or IP" << std::endl; + kill(0, SIGUSR1); } //set archive config @@ -95,6 +107,7 @@ DBWrapper::DBWrapper() { } } + //create db instance std::string msg = opt.meta.path; try { zilliz::milvus::engine::DB::Open(opt, &db_);