Commit 888e188f authored by Jin Hai's avatar Jin Hai Committed by GitHub
Browse files

Merge pull request #163 from cydrain/0.5.1

change configuration name from "use_gpu_threshold" to "gpu_search_threshold"

Former-commit-id: d339a53ab7e4414f3d9aa80dc6ba214ffa698856
parents 3841ed18 6ad1ed74
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ Please mark all change in change log and use the ticket from JIRA.
- \#130 - Set task state MOVED after resource copy it completed
- \#149 - Improve large query optimizer pass
- \#156 - Not return error when search_resources and index_build_device set cpu
- \#159 - Change the configuration name from 'use_gpu_threshold' to 'gpu_search_threshold'

## Task

+1 −1
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ cache_config:
engine_config:
  use_blas_threshold: 20            # if nq <  use_blas_threshold, use SSE, faster with fluctuated response times
                                    # if nq >= use_blas_threshold, use OpenBlas, slower with stable response times
  use_gpu_threshold: 1000
  gpu_search_threshold: 1000        # threshold beyond which the search computation is executed on GPUs only

resource_config:
  search_resources:                 # define the GPUs used for search computation, must be in format: gpux
+1 −1
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ namespace scheduler {

LargeSQ8HPass::LargeSQ8HPass() {
    server::Config& config = server::Config::GetInstance();
    Status s = config.GetEngineConfigUseGpuThreshold(threshold_);
    Status s = config.GetEngineConfigGpuSearchThreshold(threshold_);
    if (!s.ok()) {
        threshold_ = std::numeric_limits<int32_t>::max();
    }
+17 −17
Original line number Diff line number Diff line
@@ -193,8 +193,8 @@ Config::ValidateConfig() {
        return s;
    }

    int32_t engine_use_gpu_threshold;
    s = GetEngineConfigUseGpuThreshold(engine_use_gpu_threshold);
    int32_t engine_gpu_search_threshold;
    s = GetEngineConfigGpuSearchThreshold(engine_gpu_search_threshold);
    if (!s.ok()) {
        return s;
    }
@@ -330,7 +330,7 @@ Config::ResetDefaultConfig() {
        return s;
    }

    s = SetEngineConfigUseGpuThreshold(CONFIG_ENGINE_USE_GPU_THRESHOLD_DEFAULT);
    s = SetEngineConfigGpuSearchThreshold(CONFIG_ENGINE_GPU_SEARCH_THRESHOLD_DEFAULT);
    if (!s.ok()) {
        return s;
    }
@@ -463,7 +463,7 @@ Status
Config::CheckDBConfigArchiveDaysThreshold(const std::string& value) {
    if (!ValidationUtil::ValidateStringIsNumber(value).ok()) {
        std::string msg = "Invalid archive days threshold: " + value +
                          ". Possible reason: db_config.archive_disk_threshold is invalid.";
                          ". Possible reason: db_config.archive_days_threshold is invalid.";
        return Status(SERVER_INVALID_ARGUMENT, msg);
    }
    return Status::OK();
@@ -631,7 +631,7 @@ Config::CheckCacheConfigGpuCacheThreshold(const std::string& value) {
Status
Config::CheckCacheConfigCacheInsertData(const std::string& value) {
    if (!ValidationUtil::ValidateStringIsBool(value).ok()) {
        std::string msg = "Invalid cache insert option: " + value +
        std::string msg = "Invalid cache insert data option: " + value +
                          ". Possible reason: cache_config.cache_insert_data is not a boolean.";
        return Status(SERVER_INVALID_ARGUMENT, msg);
    }
@@ -641,7 +641,7 @@ Config::CheckCacheConfigCacheInsertData(const std::string& value) {
Status
Config::CheckEngineConfigUseBlasThreshold(const std::string& value) {
    if (!ValidationUtil::ValidateStringIsNumber(value).ok()) {
        std::string msg = "Invalid blas threshold: " + value +
        std::string msg = "Invalid use blas threshold: " + value +
                          ". Possible reason: engine_config.use_blas_threshold is not a positive integer.";
        return Status(SERVER_INVALID_ARGUMENT, msg);
    }
@@ -651,7 +651,7 @@ Config::CheckEngineConfigUseBlasThreshold(const std::string& value) {
Status
Config::CheckEngineConfigOmpThreadNum(const std::string& value) {
    if (!ValidationUtil::ValidateStringIsNumber(value).ok()) {
        std::string msg = "Invalid omp thread number: " + value +
        std::string msg = "Invalid omp thread num: " + value +
                          ". Possible reason: engine_config.omp_thread_num is not a positive integer.";
        return Status(SERVER_INVALID_ARGUMENT, msg);
    }
@@ -660,7 +660,7 @@ Config::CheckEngineConfigOmpThreadNum(const std::string& value) {
    uint32_t sys_thread_cnt = 8;
    CommonUtil::GetSystemAvailableThreads(sys_thread_cnt);
    if (omp_thread > static_cast<int32_t>(sys_thread_cnt)) {
        std::string msg = "Invalid omp thread number: " + value +
        std::string msg = "Invalid omp thread num: " + value +
                          ". Possible reason: engine_config.omp_thread_num exceeds system cpu cores.";
        return Status(SERVER_INVALID_ARGUMENT, msg);
    }
@@ -668,10 +668,10 @@ Config::CheckEngineConfigOmpThreadNum(const std::string& value) {
}

Status
Config::CheckEngineConfigUseGpuThreshold(const std::string& value) {
Config::CheckEngineConfigGpuSearchThreshold(const std::string& value) {
    if (!ValidationUtil::ValidateStringIsNumber(value).ok()) {
        std::string msg = "Invalid gpu threshold: " + value +
                          ". Possible reason: engine_config.use_gpu_threshold is not a positive integer.";
        std::string msg = "Invalid gpu search threshold: " + value +
                          ". Possible reason: engine_config.gpu_search_threshold is not a positive integer.";
        return Status(SERVER_INVALID_ARGUMENT, msg);
    }
    return Status::OK();
@@ -979,10 +979,10 @@ Config::GetEngineConfigOmpThreadNum(int32_t& value) {
}

Status
Config::GetEngineConfigUseGpuThreshold(int32_t& value) {
Config::GetEngineConfigGpuSearchThreshold(int32_t& value) {
    std::string str =
        GetConfigStr(CONFIG_ENGINE, CONFIG_ENGINE_USE_GPU_THRESHOLD, CONFIG_ENGINE_USE_GPU_THRESHOLD_DEFAULT);
    Status s = CheckEngineConfigUseGpuThreshold(str);
        GetConfigStr(CONFIG_ENGINE, CONFIG_ENGINE_GPU_SEARCH_THRESHOLD, CONFIG_ENGINE_GPU_SEARCH_THRESHOLD_DEFAULT);
    Status s = CheckEngineConfigGpuSearchThreshold(str);
    if (!s.ok()) {
        return s;
    }
@@ -1244,13 +1244,13 @@ Config::SetEngineConfigOmpThreadNum(const std::string& value) {
}

Status
Config::SetEngineConfigUseGpuThreshold(const std::string& value) {
    Status s = CheckEngineConfigUseGpuThreshold(value);
Config::SetEngineConfigGpuSearchThreshold(const std::string& value) {
    Status s = CheckEngineConfigGpuSearchThreshold(value);
    if (!s.ok()) {
        return s;
    }

    SetConfigValueInMem(CONFIG_DB, CONFIG_ENGINE_USE_GPU_THRESHOLD, value);
    SetConfigValueInMem(CONFIG_DB, CONFIG_ENGINE_GPU_SEARCH_THRESHOLD, value);
    return Status::OK();
}

+5 −5
Original line number Diff line number Diff line
@@ -84,8 +84,8 @@ static const char* CONFIG_ENGINE_USE_BLAS_THRESHOLD = "use_blas_threshold";
static const char* CONFIG_ENGINE_USE_BLAS_THRESHOLD_DEFAULT = "20";
static const char* CONFIG_ENGINE_OMP_THREAD_NUM = "omp_thread_num";
static const char* CONFIG_ENGINE_OMP_THREAD_NUM_DEFAULT = "0";
static const char* CONFIG_ENGINE_USE_GPU_THRESHOLD = "use_gpu_threshold";
static const char* CONFIG_ENGINE_USE_GPU_THRESHOLD_DEFAULT = "1000";
static const char* CONFIG_ENGINE_GPU_SEARCH_THRESHOLD = "gpu_search_threshold";
static const char* CONFIG_ENGINE_GPU_SEARCH_THRESHOLD_DEFAULT = "1000";

/* resource config */
static const char* CONFIG_RESOURCE = "resource_config";
@@ -169,7 +169,7 @@ class Config {
    Status
    CheckEngineConfigOmpThreadNum(const std::string& value);
    Status
    CheckEngineConfigUseGpuThreshold(const std::string& value);
    CheckEngineConfigGpuSearchThreshold(const std::string& value);

    /* resource config */
    Status
@@ -235,7 +235,7 @@ class Config {
    Status
    GetEngineConfigOmpThreadNum(int32_t& value);
    Status
    GetEngineConfigUseGpuThreshold(int32_t& value);
    GetEngineConfigGpuSearchThreshold(int32_t& value);

    /* resource config */
    Status
@@ -296,7 +296,7 @@ class Config {
    Status
    SetEngineConfigOmpThreadNum(const std::string& value);
    Status
    SetEngineConfigUseGpuThreshold(const std::string& value);
    SetEngineConfigGpuSearchThreshold(const std::string& value);

    /* resource config */
    Status