Loading CHANGELOG.md +1 −0 Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ Please mark all change in change log and use the ticket from JIRA. - \#90 - The server start error messages could be improved to enhance user experience - \#104 - test_scheduler core dump - \#115 - Using new structure for tasktable - \#139 - New config opion use_gpu_threshold ## Improvement - \#64 - Improvement dump function in scheduler Loading core/conf/server_config.template +1 −0 Original line number Diff line number Diff line Loading @@ -36,6 +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 resource_config: search_resources: # define the GPUs used for search computation, must be in format: gpux Loading core/src/scheduler/optimizer/LargeSQ8HPass.cpp +11 −1 Original line number Diff line number Diff line Loading @@ -21,11 +21,20 @@ #include "scheduler/Utils.h" #include "scheduler/task/SearchTask.h" #include "scheduler/tasklabel/SpecResLabel.h" #include "server/Config.h" #include "utils/Log.h" namespace milvus { namespace scheduler { LargeSQ8HPass::LargeSQ8HPass() { server::Config& config = server::Config::GetInstance(); Status s = config.GetEngineConfigUseGpuThreshold(threshold_); if (!s.ok()) { threshold_ = std::numeric_limits<int32_t>::max(); } } bool LargeSQ8HPass::Run(const TaskPtr& task) { if (task->Type() != TaskType::SearchTask) { Loading @@ -40,7 +49,8 @@ LargeSQ8HPass::Run(const TaskPtr& task) { auto search_job = std::static_pointer_cast<SearchJob>(search_task->job_.lock()); // TODO: future, Index::IVFSQ8H, if nq < threshold set cpu, else set gpu if (search_job->nq() < 100) { if (search_job->nq() < threshold_) { return false; } Loading core/src/scheduler/optimizer/LargeSQ8HPass.h +4 −1 Original line number Diff line number Diff line Loading @@ -34,11 +34,14 @@ namespace scheduler { class LargeSQ8HPass : public Pass { public: LargeSQ8HPass() = default; LargeSQ8HPass(); public: bool Run(const TaskPtr& task) override; private: int32_t threshold_ = std::numeric_limits<int32_t>::max(); }; using LargeSQ8HPassPtr = std::shared_ptr<LargeSQ8HPass>; Loading core/src/server/Config.cpp +45 −0 Original line number Diff line number Diff line Loading @@ -193,6 +193,12 @@ Config::ValidateConfig() { return s; } int32_t engine_use_gpu_threshold; s = GetEngineConfigUseGpuThreshold(engine_use_gpu_threshold); if (!s.ok()) { return s; } /* resource config */ std::string resource_mode; s = GetResourceConfigMode(resource_mode); Loading Loading @@ -324,6 +330,11 @@ Config::ResetDefaultConfig() { return s; } s = SetEngineConfigUseGpuThreshold(CONFIG_ENGINE_USE_GPU_THRESHOLD_DEFAULT); if (!s.ok()) { return s; } /* resource config */ s = SetResourceConfigMode(CONFIG_RESOURCE_MODE_DEFAULT); if (!s.ok()) { Loading Loading @@ -656,6 +667,16 @@ Config::CheckEngineConfigOmpThreadNum(const std::string& value) { return Status::OK(); } Status Config::CheckEngineConfigUseGpuThreshold(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."; return Status(SERVER_INVALID_ARGUMENT, msg); } return Status::OK(); } Status Config::CheckResourceConfigMode(const std::string& value) { if (value != "simple") { Loading Loading @@ -951,6 +972,19 @@ Config::GetEngineConfigOmpThreadNum(int32_t& value) { return Status::OK(); } Status Config::GetEngineConfigUseGpuThreshold(int32_t& value) { std::string str = GetConfigStr(CONFIG_ENGINE, CONFIG_ENGINE_USE_GPU_THRESHOLD, CONFIG_ENGINE_USE_GPU_THRESHOLD_DEFAULT); Status s = CheckEngineConfigUseGpuThreshold(str); if (!s.ok()) { return s; } value = std::stoi(str); return Status::OK(); } Status Config::GetResourceConfigMode(std::string& value) { value = GetConfigStr(CONFIG_RESOURCE, CONFIG_RESOURCE_MODE, CONFIG_RESOURCE_MODE_DEFAULT); Loading Loading @@ -1203,6 +1237,17 @@ Config::SetEngineConfigOmpThreadNum(const std::string& value) { return Status::OK(); } Status Config::SetEngineConfigUseGpuThreshold(const std::string& value) { Status s = CheckEngineConfigUseGpuThreshold(value); if (!s.ok()) { return s; } SetConfigValueInMem(CONFIG_DB, CONFIG_ENGINE_USE_GPU_THRESHOLD, value); return Status::OK(); } /* resource config */ Status Config::SetResourceConfigMode(const std::string& value) { Loading Loading
CHANGELOG.md +1 −0 Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ Please mark all change in change log and use the ticket from JIRA. - \#90 - The server start error messages could be improved to enhance user experience - \#104 - test_scheduler core dump - \#115 - Using new structure for tasktable - \#139 - New config opion use_gpu_threshold ## Improvement - \#64 - Improvement dump function in scheduler Loading
core/conf/server_config.template +1 −0 Original line number Diff line number Diff line Loading @@ -36,6 +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 resource_config: search_resources: # define the GPUs used for search computation, must be in format: gpux Loading
core/src/scheduler/optimizer/LargeSQ8HPass.cpp +11 −1 Original line number Diff line number Diff line Loading @@ -21,11 +21,20 @@ #include "scheduler/Utils.h" #include "scheduler/task/SearchTask.h" #include "scheduler/tasklabel/SpecResLabel.h" #include "server/Config.h" #include "utils/Log.h" namespace milvus { namespace scheduler { LargeSQ8HPass::LargeSQ8HPass() { server::Config& config = server::Config::GetInstance(); Status s = config.GetEngineConfigUseGpuThreshold(threshold_); if (!s.ok()) { threshold_ = std::numeric_limits<int32_t>::max(); } } bool LargeSQ8HPass::Run(const TaskPtr& task) { if (task->Type() != TaskType::SearchTask) { Loading @@ -40,7 +49,8 @@ LargeSQ8HPass::Run(const TaskPtr& task) { auto search_job = std::static_pointer_cast<SearchJob>(search_task->job_.lock()); // TODO: future, Index::IVFSQ8H, if nq < threshold set cpu, else set gpu if (search_job->nq() < 100) { if (search_job->nq() < threshold_) { return false; } Loading
core/src/scheduler/optimizer/LargeSQ8HPass.h +4 −1 Original line number Diff line number Diff line Loading @@ -34,11 +34,14 @@ namespace scheduler { class LargeSQ8HPass : public Pass { public: LargeSQ8HPass() = default; LargeSQ8HPass(); public: bool Run(const TaskPtr& task) override; private: int32_t threshold_ = std::numeric_limits<int32_t>::max(); }; using LargeSQ8HPassPtr = std::shared_ptr<LargeSQ8HPass>; Loading
core/src/server/Config.cpp +45 −0 Original line number Diff line number Diff line Loading @@ -193,6 +193,12 @@ Config::ValidateConfig() { return s; } int32_t engine_use_gpu_threshold; s = GetEngineConfigUseGpuThreshold(engine_use_gpu_threshold); if (!s.ok()) { return s; } /* resource config */ std::string resource_mode; s = GetResourceConfigMode(resource_mode); Loading Loading @@ -324,6 +330,11 @@ Config::ResetDefaultConfig() { return s; } s = SetEngineConfigUseGpuThreshold(CONFIG_ENGINE_USE_GPU_THRESHOLD_DEFAULT); if (!s.ok()) { return s; } /* resource config */ s = SetResourceConfigMode(CONFIG_RESOURCE_MODE_DEFAULT); if (!s.ok()) { Loading Loading @@ -656,6 +667,16 @@ Config::CheckEngineConfigOmpThreadNum(const std::string& value) { return Status::OK(); } Status Config::CheckEngineConfigUseGpuThreshold(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."; return Status(SERVER_INVALID_ARGUMENT, msg); } return Status::OK(); } Status Config::CheckResourceConfigMode(const std::string& value) { if (value != "simple") { Loading Loading @@ -951,6 +972,19 @@ Config::GetEngineConfigOmpThreadNum(int32_t& value) { return Status::OK(); } Status Config::GetEngineConfigUseGpuThreshold(int32_t& value) { std::string str = GetConfigStr(CONFIG_ENGINE, CONFIG_ENGINE_USE_GPU_THRESHOLD, CONFIG_ENGINE_USE_GPU_THRESHOLD_DEFAULT); Status s = CheckEngineConfigUseGpuThreshold(str); if (!s.ok()) { return s; } value = std::stoi(str); return Status::OK(); } Status Config::GetResourceConfigMode(std::string& value) { value = GetConfigStr(CONFIG_RESOURCE, CONFIG_RESOURCE_MODE, CONFIG_RESOURCE_MODE_DEFAULT); Loading Loading @@ -1203,6 +1237,17 @@ Config::SetEngineConfigOmpThreadNum(const std::string& value) { return Status::OK(); } Status Config::SetEngineConfigUseGpuThreshold(const std::string& value) { Status s = CheckEngineConfigUseGpuThreshold(value); if (!s.ok()) { return s; } SetConfigValueInMem(CONFIG_DB, CONFIG_ENGINE_USE_GPU_THRESHOLD, value); return Status::OK(); } /* resource config */ Status Config::SetResourceConfigMode(const std::string& value) { Loading