Merge branch 'branch-0.3.1' into 'branch-0.3.1'

MS-312 Set openmp thread number by config

See merge request megasearch/milvus!310

Former-commit-id: a601768942233040212e826a30ab6e50a2e98d0e
pull/191/head
jinhai 2019-08-06 17:43:18 +08:00
commit 806dc6023b
4 changed files with 16 additions and 1 deletions

View File

@ -40,6 +40,7 @@ Please mark all change in change log and use the ticket from JIRA.
- MS-266 - Improve topk reduce time by using multi-threads
- MS-275 - Avoid sqlite logic error excetion
- MS-278 - add IndexStatsHelper
- MS-312 - Set openmp thread number by config
- MS-305 - add CPU core percent metric
- MS-310 - add milvus CPU utilization ratio and CPU/GPU temperature metrics

View File

@ -43,4 +43,5 @@ engine_config:
nprobe: 10
nlist: 16384
use_blas_threshold: 20
metric_type: L2 # compare vectors by euclidean distance(L2) or inner product(IP), optional: L2 or IP
metric_type: L2 # compare vectors by euclidean distance(L2) or inner product(IP), optional: L2 or IP
omp_thread_num: 0 # how many compute threads be used by engine, 0 means use all cpu core to compute

View File

@ -10,11 +10,14 @@
#include "utils/Log.h"
#include "utils/StringHelpFunctions.h"
#include <omp.h>
namespace zilliz {
namespace milvus {
namespace server {
DBWrapper::DBWrapper() {
//db config
zilliz::milvus::engine::Options opt;
ConfigNode& db_config = ServerConfig::GetInstance().GetConfig(CONFIG_DB);
opt.meta.backend_uri = db_config.GetValue(CONFIG_DB_URL);
@ -37,6 +40,7 @@ DBWrapper::DBWrapper() {
kill(0, SIGUSR1);
}
// cache config
ConfigNode& cache_config = ServerConfig::GetInstance().GetConfig(CONFIG_CACHE);
opt.insert_cache_immediately_ = cache_config.GetBoolValue(CONFIG_INSERT_CACHE_IMMEDIATELY, false);
@ -56,6 +60,14 @@ DBWrapper::DBWrapper() {
kill(0, SIGUSR1);
}
// engine config
ConfigNode& engine_config = ServerConfig::GetInstance().GetConfig(CONFIG_ENGINE);
int32_t omp_thread = engine_config.GetInt32Value(CONFIG_OMP_THREAD_NUM, 0);
if(omp_thread > 0) {
omp_set_num_threads(omp_thread);
SERVER_LOG_DEBUG << "Specify openmp thread number: " << omp_thread;
}
//set archive config
engine::ArchiveConf::CriteriaT criterial;
int64_t disk = db_config.GetInt64Value(CONFIG_DB_ARCHIVE_DISK, 0);

View File

@ -53,6 +53,7 @@ static const std::string CONFIG_NPROBE = "nprobe";
static const std::string CONFIG_NLIST = "nlist";
static const std::string CONFIG_DCBT = "use_blas_threshold";
static const std::string CONFIG_METRICTYPE = "metric_type";
static const std::string CONFIG_OMP_THREAD_NUM = "omp_thread_num";
class ServerConfig {
public: