Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
milvus
提交
d1d22056
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,发现更多精彩内容 >>
提交
d1d22056
编写于
9月 02, 2019
作者:
Y
Yu Kun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
MS-460 Put transport speed as weight when choosing neighbour to execute task
Former-commit-id: d82b330df300d269a3a11544fc5625ea317f9118
上级
600387fb
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
49 addition
and
8 deletion
+49
-8
cpp/CHANGELOG.md
cpp/CHANGELOG.md
+1
-0
cpp/src/scheduler/SchedInst.cpp
cpp/src/scheduler/SchedInst.cpp
+12
-5
cpp/src/scheduler/action/PushTaskToNeighbour.cpp
cpp/src/scheduler/action/PushTaskToNeighbour.cpp
+34
-3
cpp/src/server/ServerConfig.h
cpp/src/server/ServerConfig.h
+2
-0
未找到文件。
cpp/CHANGELOG.md
浏览文件 @
d1d22056
...
...
@@ -75,6 +75,7 @@ Please mark all change in change log and use the ticket from JIRA.
-
MS-445 - Rename CopyCompleted to LoadCompleted
-
MS-451 - Update server_config.template file, set GPU compute default
-
MS-455 - Distribute tasks by minimal cost in scheduler
-
MS-460 - Put transport speed as weight when choosing neighbour to execute task
## New Feature
-
MS-343 - Implement ResourceMgr
...
...
cpp/src/scheduler/SchedInst.cpp
浏览文件 @
d1d22056
...
...
@@ -43,14 +43,21 @@ StartSchedulerService() {
knowhere
::
FaissGpuResourceMgr
::
GetInstance
().
InitResource
();
auto
default_connection
=
Connection
(
"default_connection"
,
500.0
);
auto
connections
=
config
.
Get
Sequence
(
server
::
CONFIG_RESOURCE_CONNECTIONS
);
//
auto default_connection = Connection("default_connection", 500.0);
auto
connections
=
config
.
Get
Child
(
server
::
CONFIG_RESOURCE_CONNECTIONS
).
GetChildren
(
);
for
(
auto
&
conn
:
connections
)
{
auto
&
connect_name
=
conn
.
first
;
auto
&
connect_conf
=
conn
.
second
;
auto
connect_speed
=
connect_conf
.
GetInt64Value
(
server
::
CONFIG_SPEED_CONNECTIONS
);
auto
connect_endpoint
=
connect_conf
.
GetValue
(
server
::
CONFIG_ENDPOINT_CONNECTIONS
);
std
::
string
delimiter
=
"==="
;
std
::
string
left
=
conn
.
substr
(
0
,
conn
.
find
(
delimiter
));
std
::
string
right
=
conn
.
substr
(
conn
.
find
(
delimiter
)
+
3
,
conn
.
length
());
std
::
string
left
=
connect_endpoint
.
substr
(
0
,
connect_endpoint
.
find
(
delimiter
));
std
::
string
right
=
connect_endpoint
.
substr
(
connect_endpoint
.
find
(
delimiter
)
+
3
,
connect_endpoint
.
length
());
ResMgrInst
::
GetInstance
()
->
Connect
(
left
,
right
,
default_connection
);
auto
connection
=
Connection
(
connect_name
,
connect_speed
);
ResMgrInst
::
GetInstance
()
->
Connect
(
left
,
right
,
connection
);
}
ResMgrInst
::
GetInstance
()
->
Start
();
...
...
cpp/src/scheduler/action/PushTaskToNeighbour.cpp
浏览文件 @
d1d22056
...
...
@@ -28,17 +28,48 @@ get_neighbours(const ResourcePtr &self) {
return
neighbours
;
}
std
::
vector
<
std
::
pair
<
ResourcePtr
,
Connection
>>
get_neighbours_with_connetion
(
const
ResourcePtr
&
self
)
{
std
::
vector
<
std
::
pair
<
ResourcePtr
,
Connection
>>
neighbours
;
for
(
auto
&
neighbour_node
:
self
->
GetNeighbours
())
{
auto
node
=
neighbour_node
.
neighbour_node
.
lock
();
if
(
not
node
)
continue
;
auto
resource
=
std
::
static_pointer_cast
<
Resource
>
(
node
);
// if (not resource->HasExecutor()) continue;
Connection
conn
=
neighbour_node
.
connection
;
neighbours
.
emplace_back
(
std
::
make_pair
(
resource
,
conn
));
}
return
neighbours
;
}
void
Action
::
PushTaskToNeighbourRandomly
(
const
TaskPtr
&
task
,
const
ResourcePtr
&
self
)
{
auto
neighbours
=
get_neighbours
(
self
);
auto
neighbours
=
get_neighbours
_with_connetion
(
self
);
if
(
not
neighbours
.
empty
())
{
std
::
vector
<
uint64_t
>
speeds
;
uint64_t
total_speed
=
0
;
for
(
auto
&
neighbour
:
neighbours
)
{
uint64_t
speed
=
neighbour
.
second
.
speed
();
speeds
.
emplace_back
(
speed
);
total_speed
+=
speed
;
}
std
::
random_device
rd
;
std
::
mt19937
mt
(
rd
());
std
::
uniform_int_distribution
<
uint64_t
>
dist
(
0
,
neighbours
.
size
()
-
1
);
std
::
uniform_int_distribution
<
int
>
dist
(
0
,
total_speed
);
uint64_t
index
=
0
;
int64_t
rd_speed
=
dist
(
mt
);
for
(
uint64_t
i
=
0
;
i
<
speeds
.
size
();
++
i
)
{
rd_speed
-=
speeds
[
i
];
if
(
rd_speed
<=
0
)
{
neighbours
[
i
].
first
->
task_table
().
Put
(
task
);
return
;
}
}
neighbours
[
dist
(
mt
)]
->
task_table
().
Put
(
task
);
}
else
{
//TODO: process
}
...
...
cpp/src/server/ServerConfig.h
浏览文件 @
d1d22056
...
...
@@ -57,6 +57,8 @@ static const char* CONFIG_RESOURCE_DEVICE_ID = "device_id";
static
const
char
*
CONFIG_RESOURCE_ENABLE_LOADER
=
"enable_loader"
;
static
const
char
*
CONFIG_RESOURCE_ENABLE_EXECUTOR
=
"enable_executor"
;
static
const
char
*
CONFIG_RESOURCE_CONNECTIONS
=
"connections"
;
static
const
char
*
CONFIG_SPEED_CONNECTIONS
=
"speed"
;
static
const
char
*
CONFIG_ENDPOINT_CONNECTIONS
=
"connections"
;
class
ServerConfig
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录