Loading cpp/CHANGELOG.md +1 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ Please mark all change in change log and use the ticket from JIRA. - MS-608 - Update TODO names - MS-609 - Update task construct function - MS-611 - Add resources validity check in ResourceMgr - MS-619 - Add optimizer class in scheduler ## New Feature Loading cpp/src/CMakeLists.txt +2 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ aux_source_directory(${MILVUS_ENGINE_SRC}/scheduler scheduler_main_files) aux_source_directory(${MILVUS_ENGINE_SRC}/scheduler/action scheduler_action_files) aux_source_directory(${MILVUS_ENGINE_SRC}/scheduler/event scheduler_event_files) aux_source_directory(${MILVUS_ENGINE_SRC}/scheduler/job scheduler_job_files) aux_source_directory(${MILVUS_ENGINE_SRC}/scheduler/optimizer scheduler_optimizer_files) aux_source_directory(${MILVUS_ENGINE_SRC}/scheduler/resource scheduler_resource_files) aux_source_directory(${MILVUS_ENGINE_SRC}/scheduler/task scheduler_task_files) set(scheduler_files Loading @@ -57,6 +58,7 @@ set(scheduler_files ${scheduler_action_files} ${scheduler_event_files} ${scheduler_job_files} ${scheduler_optimizer_files} ${scheduler_resource_files} ${scheduler_task_files} ) Loading cpp/src/scheduler/optimizer/HybridPass.cpp 0 → 100644 +35 −0 Original line number Diff line number Diff line // Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, // software distributed under the License is distributed on an // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. #include "HybridPass.h" #include "scheduler/task/SearchTask.h" namespace milvus { namespace scheduler { bool HybridPass::Run(const TaskPtr& task) { // TODO: Index::IVFSQ8Hybrid, if nq < threshold set cpu, else set gpu if (task->Type() != TaskType::SearchTask) return false; auto search_task = std::static_pointer_cast<XSearchTask>(task); // if (search_task->file_->engine_type_ == engine::EngineType::FAISS_IVFSQ8Hybrid) return false; } } } cpp/src/scheduler/optimizer/HybridPass.h 0 → 100644 +48 −0 Original line number Diff line number Diff line // Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, // software distributed under the License is distributed on an // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. #pragma once #include <string> #include <vector> #include <list> #include <queue> #include <deque> #include <unordered_map> #include <thread> #include <mutex> #include <condition_variable> #include <memory> #include "Pass.h" namespace milvus { namespace scheduler { class HybridPass : public Pass { public: HybridPass() = default; public: bool Run(const TaskPtr& task) override; }; using HybridPassPtr = std::shared_ptr<HybridPass>; } } cpp/src/scheduler/optimizer/Optimizer.cpp 0 → 100644 +43 −0 Original line number Diff line number Diff line // Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, // software distributed under the License is distributed on an // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. #include "Optimizer.h" namespace milvus { namespace scheduler { void Optimizer::Init() { for (auto& pass : pass_list_) { pass->Init(); } } bool Optimizer::Run(const TaskPtr& task) { for (auto& pass : pass_list_) { if (pass->Run(task)) { return true; } } return false; } } } Loading
cpp/CHANGELOG.md +1 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ Please mark all change in change log and use the ticket from JIRA. - MS-608 - Update TODO names - MS-609 - Update task construct function - MS-611 - Add resources validity check in ResourceMgr - MS-619 - Add optimizer class in scheduler ## New Feature Loading
cpp/src/CMakeLists.txt +2 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ aux_source_directory(${MILVUS_ENGINE_SRC}/scheduler scheduler_main_files) aux_source_directory(${MILVUS_ENGINE_SRC}/scheduler/action scheduler_action_files) aux_source_directory(${MILVUS_ENGINE_SRC}/scheduler/event scheduler_event_files) aux_source_directory(${MILVUS_ENGINE_SRC}/scheduler/job scheduler_job_files) aux_source_directory(${MILVUS_ENGINE_SRC}/scheduler/optimizer scheduler_optimizer_files) aux_source_directory(${MILVUS_ENGINE_SRC}/scheduler/resource scheduler_resource_files) aux_source_directory(${MILVUS_ENGINE_SRC}/scheduler/task scheduler_task_files) set(scheduler_files Loading @@ -57,6 +58,7 @@ set(scheduler_files ${scheduler_action_files} ${scheduler_event_files} ${scheduler_job_files} ${scheduler_optimizer_files} ${scheduler_resource_files} ${scheduler_task_files} ) Loading
cpp/src/scheduler/optimizer/HybridPass.cpp 0 → 100644 +35 −0 Original line number Diff line number Diff line // Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, // software distributed under the License is distributed on an // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. #include "HybridPass.h" #include "scheduler/task/SearchTask.h" namespace milvus { namespace scheduler { bool HybridPass::Run(const TaskPtr& task) { // TODO: Index::IVFSQ8Hybrid, if nq < threshold set cpu, else set gpu if (task->Type() != TaskType::SearchTask) return false; auto search_task = std::static_pointer_cast<XSearchTask>(task); // if (search_task->file_->engine_type_ == engine::EngineType::FAISS_IVFSQ8Hybrid) return false; } } }
cpp/src/scheduler/optimizer/HybridPass.h 0 → 100644 +48 −0 Original line number Diff line number Diff line // Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, // software distributed under the License is distributed on an // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. #pragma once #include <string> #include <vector> #include <list> #include <queue> #include <deque> #include <unordered_map> #include <thread> #include <mutex> #include <condition_variable> #include <memory> #include "Pass.h" namespace milvus { namespace scheduler { class HybridPass : public Pass { public: HybridPass() = default; public: bool Run(const TaskPtr& task) override; }; using HybridPassPtr = std::shared_ptr<HybridPass>; } }
cpp/src/scheduler/optimizer/Optimizer.cpp 0 → 100644 +43 −0 Original line number Diff line number Diff line // Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, // software distributed under the License is distributed on an // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. #include "Optimizer.h" namespace milvus { namespace scheduler { void Optimizer::Init() { for (auto& pass : pass_list_) { pass->Init(); } } bool Optimizer::Run(const TaskPtr& task) { for (auto& pass : pass_list_) { if (pass->Run(task)) { return true; } } return false; } } }