From cdb2b98a3e69df7d92b8a1c81282ffc987fa9259 Mon Sep 17 00:00:00 2001 From: "shengjun.li" Date: Wed, 14 Oct 2020 17:50:23 +0800 Subject: [PATCH] add conf stat_optimizer_enable (#3986) * add conf stat_optimizer_enable Signed-off-by: shengjun.li * modify the blas threshold Signed-off-by: shengjun.li --- core/src/config/ConfigInit.cpp | 5 ++++- core/src/config/ServerConfig.h | 1 + core/src/db/DBImpl.cpp | 3 --- core/src/index/archive/KnowhereResource.cpp | 5 +++++ core/src/server/web_impl/dto/ConfigDto.hpp | 2 +- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/core/src/config/ConfigInit.cpp b/core/src/config/ConfigInit.cpp index f63627dd9c..6527a08250 100644 --- a/core/src/config/ConfigInit.cpp +++ b/core/src/config/ConfigInit.cpp @@ -170,12 +170,15 @@ InitConfig() { &config.engine.search_combine_nq.value, 64)}, {"engine.use_blas_threshold", CreateIntegerConfig("engine.use_blas_threshold", 0, std::numeric_limits::max(), - &config.engine.use_blas_threshold.value, 1100)}, + &config.engine.use_blas_threshold.value, 16385)}, {"engine.omp_thread_num", CreateIntegerConfig("engine.omp_thread_num", 0, std::numeric_limits::max(), &config.engine.omp_thread_num.value, 0)}, {"engine.simd_type", CreateEnumConfig("engine.simd_type", &SimdMap, &config.engine.simd_type.value, SimdType::AUTO)}, + {"engine.stat_optimizer_enable", + CreateBoolConfig("engine.stat_optimizer_enable", &config.engine.stat_optimizer_enable.value, true)}, + {"system.lock.enable", CreateBoolConfig("system.lock.enable", &config.system.lock.enable.value, true)}, {"transcript.enable", CreateBoolConfig("transcript.enable", &config.transcript.enable.value, false)}, diff --git a/core/src/config/ServerConfig.h b/core/src/config/ServerConfig.h index 2f70bb5454..ab8cd4c5dc 100644 --- a/core/src/config/ServerConfig.h +++ b/core/src/config/ServerConfig.h @@ -119,6 +119,7 @@ struct ServerConfig { Integer use_blas_threshold{0}; Integer omp_thread_num{0}; Integer simd_type{0}; + Bool stat_optimizer_enable{true}; } engine; struct GPU { diff --git a/core/src/db/DBImpl.cpp b/core/src/db/DBImpl.cpp index fc330f92d5..d92b11fcf2 100644 --- a/core/src/db/DBImpl.cpp +++ b/core/src/db/DBImpl.cpp @@ -26,7 +26,6 @@ #include "db/snapshot/Snapshots.h" #include "insert/MemManagerFactory.h" #include "knowhere/index/vector_index/helpers/BuilderSuspend.h" -#include "knowhere/index/vector_index/helpers/FaissIO.h" #include "metrics/Metrics.h" #include "metrics/SystemInfo.h" #include "scheduler/Definition.h" @@ -99,8 +98,6 @@ DBImpl::Start() { return Status::OK(); } - knowhere::enable_faiss_logging(); - // LOG_ENGINE_TRACE_ << "DB service start"; SetAvailable(true); diff --git a/core/src/index/archive/KnowhereResource.cpp b/core/src/index/archive/KnowhereResource.cpp index 28646de805..495d316b6c 100644 --- a/core/src/index/archive/KnowhereResource.cpp +++ b/core/src/index/archive/KnowhereResource.cpp @@ -16,6 +16,7 @@ #include "config/ServerConfig.h" #include "faiss/FaissHook.h" +#include "knowhere/index/vector_index/helpers/FaissIO.h" #include "scheduler/Utils.h" #include "utils/Error.h" #include "utils/Log.h" @@ -97,6 +98,10 @@ KnowhereResource::Initialize() { } #endif + if (config.engine.stat_optimizer_enable()) { + knowhere::enable_faiss_logging(); + } + return Status::OK(); } diff --git a/core/src/server/web_impl/dto/ConfigDto.hpp b/core/src/server/web_impl/dto/ConfigDto.hpp index e1d403b42f..ce28b5ce10 100644 --- a/core/src/server/web_impl/dto/ConfigDto.hpp +++ b/core/src/server/web_impl/dto/ConfigDto.hpp @@ -23,7 +23,7 @@ class AdvancedConfigDto : public ODTO { DTO_FIELD(Int64, cpu_cache_capacity) = VALUE_CONFIG_CPU_CACHE_CAPACITY_DEFAULT; DTO_FIELD(Boolean, cache_insert_data) = VALUE_CONFIG_CACHE_INSERT_DATA_DEFAULT; - DTO_FIELD(Int64, use_blas_threshold) = 1100; + DTO_FIELD(Int64, use_blas_threshold) = 16385; #ifdef MILVUS_GPU_VERSION DTO_FIELD(Int64, gpu_search_threshold) = 1000;