Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
milvus
提交
7c0c9fb1
milvus
项目概览
BaiXuePrincess
/
milvus
与 Fork 源项目一致
从无法访问的项目Fork
通知
7
Star
4
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
milvus
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7c0c9fb1
编写于
10月 16, 2019
作者:
Y
Yu Kun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix clang-format issue
Former-commit-id: d28fe86401eaf710f4ac921a29b28b6cab98cea9
上级
e7dd603d
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
99 addition
and
102 deletion
+99
-102
core/src/scheduler/optimizer/LargeSQ8HPass.cpp
core/src/scheduler/optimizer/LargeSQ8HPass.cpp
+56
-56
core/src/scheduler/optimizer/LargeSQ8HPass.h
core/src/scheduler/optimizer/LargeSQ8HPass.h
+31
-31
core/src/scheduler/optimizer/Optimizer.cpp
core/src/scheduler/optimizer/Optimizer.cpp
+6
-6
core/src/scheduler/optimizer/Optimizer.h
core/src/scheduler/optimizer/Optimizer.h
+2
-2
core/src/scheduler/optimizer/Pass.h
core/src/scheduler/optimizer/Pass.h
+3
-3
core/src/scheduler/task/TestTask.cpp
core/src/scheduler/task/TestTask.cpp
+1
-3
core/unittest/scheduler/task_test.cpp
core/unittest/scheduler/task_test.cpp
+0
-1
未找到文件。
core/src/scheduler/optimizer/LargeSQ8HPass.cpp
浏览文件 @
7c0c9fb1
...
...
@@ -15,59 +15,59 @@
// specific language governing permissions and limitations
// under the License.
//
#include "scheduler/optimizer/LargeSQ8HPass.h"
//
#include "cache/GpuCacheMgr.h"
//
#include "scheduler/SchedInst.h"
//
#include "scheduler/Utils.h"
//
#include "scheduler/task/SearchTask.h"
//
#include "scheduler/tasklabel/SpecResLabel.h"
//
#include "utils/Log.h"
//
//
namespace milvus {
//
namespace scheduler {
//
//
bool
//
LargeSQ8HPass::Run(const TaskPtr& task) {
// if (task->Type() != TaskType::SearchTask) {
// return false;
// }
//
// auto search_task = std::static_pointer_cast<XSearchTask>(task);
// if (search_task->file_->engine_type_ != (int)engine::EngineType::FAISS_IVFSQ8H) {
// return false;
// }
//
// 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) {
// return false;
// }
//
// std::vector<uint64_t> gpus = scheduler::get_gpu_pool();
// std::vector<int64_t> all_free_mem;
// for (auto& gpu : gpus) {
// auto cache = cache::GpuCacheMgr::GetInstance(gpu);
// auto free_mem = cache->CacheCapacity() - cache->CacheUsage();
// all_free_mem.push_back(free_mem);
// }
//
// auto max_e = std::max_element(all_free_mem.begin(), all_free_mem.end());
// auto best_index = std::distance(all_free_mem.begin(), max_e);
// auto best_device_id = gpus[best_index];
//
// ResourcePtr res_ptr = ResMgrInst::GetInstance()->GetResource(ResourceType::GPU, best_device_id);
// if (not res_ptr) {
// SERVER_LOG_ERROR << "GpuResource " << best_device_id << " invalid.";
// // TODO: throw critical error and exit
// return false;
// }
//
// auto label = std::make_shared<SpecResLabel>(std::weak_ptr<Resource>(res_ptr));
// task->label() = label;
//
// return true;
//
}
//
//
} // namespace scheduler
//
} // namespace milvus
#include "scheduler/optimizer/LargeSQ8HPass.h"
#include "cache/GpuCacheMgr.h"
#include "scheduler/SchedInst.h"
#include "scheduler/Utils.h"
#include "scheduler/task/SearchTask.h"
#include "scheduler/tasklabel/SpecResLabel.h"
#include "utils/Log.h"
namespace
milvus
{
namespace
scheduler
{
bool
LargeSQ8HPass
::
Run
(
const
TaskPtr
&
task
)
{
// if (task->Type() != TaskType::SearchTask) {
// return false;
// }
//
// auto search_task = std::static_pointer_cast<XSearchTask>(task);
// if (search_task->file_->engine_type_ != (int)engine::EngineType::FAISS_IVFSQ8H) {
// return false;
// }
//
// 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) {
// return false;
// }
//
// std::vector<uint64_t> gpus = scheduler::get_gpu_pool();
// std::vector<int64_t> all_free_mem;
// for (auto& gpu : gpus) {
// auto cache = cache::GpuCacheMgr::GetInstance(gpu);
// auto free_mem = cache->CacheCapacity() - cache->CacheUsage();
// all_free_mem.push_back(free_mem);
// }
//
// auto max_e = std::max_element(all_free_mem.begin(), all_free_mem.end());
// auto best_index = std::distance(all_free_mem.begin(), max_e);
// auto best_device_id = gpus[best_index];
//
// ResourcePtr res_ptr = ResMgrInst::GetInstance()->GetResource(ResourceType::GPU, best_device_id);
// if (not res_ptr) {
// SERVER_LOG_ERROR << "GpuResource " << best_device_id << " invalid.";
// // TODO: throw critical error and exit
// return false;
// }
//
// auto label = std::make_shared<SpecResLabel>(std::weak_ptr<Resource>(res_ptr));
// task->label() = label;
//
// return true;
}
}
// namespace scheduler
}
// namespace milvus
core/src/scheduler/optimizer/LargeSQ8HPass.h
浏览文件 @
7c0c9fb1
...
...
@@ -14,34 +14,34 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
//
#pragma once
//
//
#include <condition_variable>
//
#include <deque>
//
#include <list>
//
#include <memory>
//
#include <mutex>
//
#include <queue>
//
#include <string>
//
#include <thread>
//
#include <unordered_map>
//
#include <vector>
//
//
#include "Pass.h"
//
//
namespace milvus {
//
namespace scheduler {
//
//
class LargeSQ8HPass : public Pass {
//
public:
//
LargeSQ8HPass() = default;
//
//
public:
//
bool
//
Run(const TaskPtr& task) override;
//
};
//
//
using LargeSQ8HPassPtr = std::shared_ptr<LargeSQ8HPass>;
//
//
} // namespace scheduler
//
} // namespace milvus
#pragma once
#include <condition_variable>
#include <deque>
#include <list>
#include <memory>
#include <mutex>
#include <queue>
#include <string>
#include <thread>
#include <unordered_map>
#include <vector>
#include "Pass.h"
namespace
milvus
{
namespace
scheduler
{
class
LargeSQ8HPass
:
public
Pass
{
public:
LargeSQ8HPass
()
=
default
;
public:
bool
Run
(
const
TaskPtr
&
task
)
override
;
};
using
LargeSQ8HPassPtr
=
std
::
shared_ptr
<
LargeSQ8HPass
>
;
}
// namespace scheduler
}
// namespace milvus
core/src/scheduler/optimizer/Optimizer.cpp
浏览文件 @
7c0c9fb1
...
...
@@ -20,12 +20,12 @@
namespace
milvus
{
namespace
scheduler
{
//
void
//
Optimizer::Init() {
// for (auto& pass : pass_list_) {
// pass->Init();
// }
//
}
void
Optimizer
::
Init
()
{
// for (auto& pass : pass_list_) {
// pass->Init();
// }
}
bool
Optimizer
::
Run
(
const
TaskPtr
&
task
)
{
...
...
core/src/scheduler/optimizer/Optimizer.h
浏览文件 @
7c0c9fb1
...
...
@@ -38,8 +38,8 @@ class Optimizer {
explicit
Optimizer
(
std
::
vector
<
PassPtr
>
pass_list
)
:
pass_list_
(
std
::
move
(
pass_list
))
{
}
//
void
//
Init();
void
Init
();
bool
Run
(
const
TaskPtr
&
task
);
...
...
core/src/scheduler/optimizer/Pass.h
浏览文件 @
7c0c9fb1
...
...
@@ -34,9 +34,9 @@ namespace scheduler {
class
Pass
{
public:
//
virtual void
//
Init() {
//
}
virtual
void
Init
()
{
}
virtual
bool
Run
(
const
TaskPtr
&
task
)
=
0
;
...
...
core/src/scheduler/task/TestTask.cpp
浏览文件 @
7c0c9fb1
...
...
@@ -44,9 +44,7 @@ TestTask::Execute() {
void
TestTask
::
Wait
()
{
std
::
unique_lock
<
std
::
mutex
>
lock
(
mutex_
);
cv_
.
wait
(
lock
,
[
&
]
{
return
done_
;
});
cv_
.
wait
(
lock
,
[
&
]
{
return
done_
;
});
}
}
// namespace scheduler
...
...
core/unittest/scheduler/task_test.cpp
浏览文件 @
7c0c9fb1
...
...
@@ -32,7 +32,6 @@ TEST(TaskTest, INVALID_INDEX) {
build_task
->
Load
(
LoadType
::
TEST
,
10
);
build_task
->
Execute
();
}
}
// namespace scheduler
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录