Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
milvus
提交
598f9f30
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,发现更多精彩内容 >>
提交
598f9f30
编写于
8月 21, 2019
作者:
W
wxyu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
MS-394 Update scheduler unittest
Former-commit-id: b4f0fe18d00b17c47a39e2a06cdd1119ae00d7fc
上级
8b7273da
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
43 addition
and
11 deletion
+43
-11
cpp/CHANGELOG.md
cpp/CHANGELOG.md
+1
-0
cpp/src/scheduler/action/PushTaskToNeighbour.cpp
cpp/src/scheduler/action/PushTaskToNeighbour.cpp
+1
-1
cpp/src/scheduler/task/TestTask.cpp
cpp/src/scheduler/task/TestTask.cpp
+17
-0
cpp/src/scheduler/task/TestTask.h
cpp/src/scheduler/task/TestTask.h
+12
-2
cpp/src/wrapper/knowhere/vec_impl.cpp
cpp/src/wrapper/knowhere/vec_impl.cpp
+3
-1
cpp/unittest/scheduler/normal_test.cpp
cpp/unittest/scheduler/normal_test.cpp
+9
-7
未找到文件。
cpp/CHANGELOG.md
浏览文件 @
598f9f30
...
...
@@ -37,6 +37,7 @@ Please mark all change in change log and use the ticket from JIRA.
-
MS-389 - Add clone interface in Task
-
MS-390 - Update resource construct function
-
MS-391 - Add PushTaskToNeighbourHasExecutor action
-
MS-394 - Update scheduler unittest
## New Feature
-
MS-343 - Implement ResourceMgr
...
...
cpp/src/scheduler/action/PushTaskToNeighbour.cpp
浏览文件 @
598f9f30
...
...
@@ -13,7 +13,7 @@ namespace milvus {
namespace
engine
{
void
next
(
std
::
list
<
ResourcePtr
>
neighbours
,
std
::
list
<
ResourcePtr
>::
iterator
&
it
)
{
next
(
std
::
list
<
ResourcePtr
>
&
neighbours
,
std
::
list
<
ResourcePtr
>::
iterator
&
it
)
{
it
++
;
if
(
neighbours
.
end
()
==
it
)
{
it
=
neighbours
.
begin
();
...
...
cpp/src/scheduler/task/TestTask.cpp
浏览文件 @
598f9f30
...
...
@@ -6,6 +6,7 @@
#include "TestTask.h"
namespace
zilliz
{
namespace
milvus
{
namespace
engine
{
...
...
@@ -17,7 +18,23 @@ TestTask::Load(LoadType type, uint8_t device_id) {
void
TestTask
::
Execute
()
{
std
::
lock_guard
<
std
::
mutex
>
lock
(
mutex_
);
exec_count_
++
;
done_
=
true
;
}
TaskPtr
TestTask
::
Clone
()
{
auto
ret
=
std
::
make_shared
<
TestTask
>
();
ret
->
load_count_
=
load_count_
;
ret
->
exec_count_
=
exec_count_
;
return
ret
;
}
void
TestTask
::
Wait
()
{
std
::
unique_lock
<
std
::
mutex
>
lock
(
mutex_
);
cv_
.
wait
(
lock
,
[
&
]
{
return
done_
;
});
}
}
...
...
cpp/src/scheduler/task/TestTask.h
浏览文件 @
598f9f30
...
...
@@ -23,9 +23,19 @@ public:
void
Execute
()
override
;
TaskPtr
Clone
()
override
;
void
Wait
();
public:
uint64_t
load_count_
;
uint64_t
exec_count_
;
uint64_t
load_count_
=
0
;
uint64_t
exec_count_
=
0
;
bool
done_
=
false
;
std
::
mutex
mutex_
;
std
::
condition_variable
cv_
;
};
...
...
cpp/src/wrapper/knowhere/vec_impl.cpp
浏览文件 @
598f9f30
...
...
@@ -144,7 +144,9 @@ VecIndexPtr VecIndexImpl::CopyToGpu(const int64_t &device_id, const Config &cfg)
// TODO(linxj): update type
auto
gpu_index
=
zilliz
::
knowhere
::
CopyCpuToGpu
(
index_
,
device_id
,
cfg
);
return
std
::
make_shared
<
VecIndexImpl
>
(
gpu_index
,
type
);
auto
new_index
=
std
::
make_shared
<
VecIndexImpl
>
(
gpu_index
,
type
);
new_index
->
dim
=
dim
;
return
new_index
;
}
// TODO(linxj): rename copytocpu => copygputocpu
...
...
cpp/unittest/scheduler/normal_test.cpp
浏览文件 @
598f9f30
...
...
@@ -13,10 +13,10 @@ TEST(normal_test, test1) {
// ResourceMgr only compose resources, provide unified event
// auto res_mgr = std::make_shared<ResourceMgr>();
auto
res_mgr
=
ResMgrInst
::
GetInstance
();
auto
disk
=
res_mgr
->
Add
(
ResourceFactory
::
Create
(
"disk"
,
"ssd"
));
auto
disk
=
res_mgr
->
Add
(
ResourceFactory
::
Create
(
"disk"
,
"ssd"
,
true
,
false
));
auto
cpu
=
res_mgr
->
Add
(
ResourceFactory
::
Create
(
"cpu"
));
auto
gpu1
=
res_mgr
->
Add
(
ResourceFactory
::
Create
(
"gpu"
));
auto
gpu2
=
res_mgr
->
Add
(
ResourceFactory
::
Create
(
"gpu"
));
auto
gpu1
=
res_mgr
->
Add
(
ResourceFactory
::
Create
(
"gpu"
,
"gpu0"
,
false
,
false
));
auto
gpu2
=
res_mgr
->
Add
(
ResourceFactory
::
Create
(
"gpu"
,
"gpu2"
,
false
,
false
));
auto
IO
=
Connection
(
"IO"
,
500.0
);
auto
PCIE
=
Connection
(
"IO"
,
11000.0
);
...
...
@@ -30,7 +30,7 @@ TEST(normal_test, test1) {
auto
scheduler
=
SchedInst
::
GetInstance
();
scheduler
->
Start
();
const
uint64_t
NUM_TASK
=
100
;
const
uint64_t
NUM_TASK
=
100
0
;
std
::
vector
<
std
::
shared_ptr
<
TestTask
>>
tasks
;
for
(
uint64_t
i
=
0
;
i
<
NUM_TASK
;
++
i
)
{
if
(
auto
observe
=
disk
.
lock
())
{
...
...
@@ -45,8 +45,10 @@ TEST(normal_test, test1) {
scheduler
->
Stop
();
res_mgr
->
Stop
();
for
(
uint64_t
i
=
0
;
i
<
NUM_TASK
;
++
i
)
{
ASSERT_EQ
(
tasks
[
i
]
->
load_count_
,
1
);
ASSERT_EQ
(
tasks
[
i
]
->
exec_count_
,
1
);
auto
pcpu
=
cpu
.
lock
();
for
(
uint64_t
i
=
0
;
i
<
NUM_TASK
;
++
i
)
{
auto
task
=
std
::
static_pointer_cast
<
TestTask
>
(
pcpu
->
task_table
()[
i
]
->
task
);
ASSERT_EQ
(
task
->
load_count_
,
1
);
ASSERT_EQ
(
task
->
exec_count_
,
1
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录