Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
nni
Commits
3e0ef005
Commit
3e0ef005
authored
Nov 08, 2019
by
chicm-ms
Committed by
SparkSnail
Nov 08, 2019
Browse files
round-robin policy (#1702)
parent
db19946d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
1 deletion
+22
-1
src/nni_manager/training_service/remote_machine/gpuScheduler.ts
...i_manager/training_service/remote_machine/gpuScheduler.ts
+22
-1
No files found.
src/nni_manager/training_service/remote_machine/gpuScheduler.ts
View file @
3e0ef005
...
...
@@ -28,6 +28,8 @@ import {
parseGpuIndices
,
RemoteMachineMeta
,
RemoteMachineScheduleResult
,
RemoteMachineTrialJobDetail
,
ScheduleResultType
,
SSHClientManager
}
from
'
./remoteMachineData
'
;
type
SCHEDULE_POLICY_NAME
=
'
random
'
|
'
round-robin
'
;
/**
* A simple GPU scheduler implementation
*/
...
...
@@ -35,13 +37,18 @@ export class GPUScheduler {
private
readonly
machineSSHClientMap
:
Map
<
RemoteMachineMeta
,
SSHClientManager
>
;
private
readonly
log
:
Logger
=
getLogger
();
private
readonly
policyName
:
SCHEDULE_POLICY_NAME
=
'
round-robin
'
;
private
roundRobinIndex
:
number
=
0
;
private
configuredRMs
:
RemoteMachineMeta
[]
=
[];
/**
* Constructor
* @param machineSSHClientMap map from remote machine to sshClient
*/
constructor
(
machineSSHClientMap
:
Map
<
RemoteMachineMeta
,
SSHClientManager
>
)
{
assert
(
machineSSHClientMap
.
size
>
0
);
this
.
machineSSHClientMap
=
machineSSHClientMap
;
this
.
configuredRMs
=
Array
.
from
(
machineSSHClientMap
.
keys
());
}
/**
...
...
@@ -189,7 +196,21 @@ export class GPUScheduler {
private
selectMachine
(
rmMetas
:
RemoteMachineMeta
[]):
RemoteMachineMeta
{
assert
(
rmMetas
!==
undefined
&&
rmMetas
.
length
>
0
);
return
randomSelect
(
rmMetas
);
if
(
this
.
policyName
===
'
random
'
)
{
return
randomSelect
(
rmMetas
);
}
else
if
(
this
.
policyName
===
'
round-robin
'
)
{
return
this
.
roundRobinSelect
(
rmMetas
);
}
else
{
throw
new
Error
(
`Unsupported schedule policy:
${
this
.
policyName
}
`
);
}
}
private
roundRobinSelect
(
rmMetas
:
RemoteMachineMeta
[]):
RemoteMachineMeta
{
while
(
!
rmMetas
.
includes
(
this
.
configuredRMs
[
this
.
roundRobinIndex
%
this
.
configuredRMs
.
length
]))
{
this
.
roundRobinIndex
++
;
}
return
this
.
configuredRMs
[
this
.
roundRobinIndex
++
%
this
.
configuredRMs
.
length
];
}
private
selectGPUsForTrial
(
gpuInfos
:
GPUInfo
[],
requiredGPUNum
:
number
):
GPUInfo
[]
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment