Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
G
gpucloudsim
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LPDS
gpucloudsim
Commits
c60cb4d2
Commit
c60cb4d2
authored
Aug 22, 2022
by
Ahmad Siavashi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix GpuTaskSchedulerLeftover
parent
5ed1fc12
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
1 deletion
+27
-1
GpuTaskSchedulerLeftover.java
...a/org/cloudbus/cloudsim/gpu/GpuTaskSchedulerLeftover.java
+27
-1
No files found.
modules/cloudsim/src/main/java/org/cloudbus/cloudsim/gpu/GpuTaskSchedulerLeftover.java
View file @
c60cb4d2
...
@@ -30,6 +30,25 @@ public class GpuTaskSchedulerLeftover extends GpuTaskScheduler {
...
@@ -30,6 +30,25 @@ public class GpuTaskSchedulerLeftover extends GpuTaskScheduler {
setUsedPes
(
new
ArrayList
<
Integer
>());
setUsedPes
(
new
ArrayList
<
Integer
>());
}
}
protected
boolean
redistributeGpuTaskMips
(
ResGpuTask
rgt
)
{
int
numberOfCurrentAvailablePEs
=
getCurrentMipsShare
().
size
()
-
getUsedPes
().
size
();
int
numberOfAllocatedPes
=
rgt
.
getPeIdList
().
size
();
if
(
numberOfAllocatedPes
<
rgt
.
getGpuTask
().
getPesLimit
()
&&
numberOfCurrentAvailablePEs
>
numberOfAllocatedPes
)
{
for
(
int
i
=
0
;
i
<
getCurrentMipsShare
().
size
();
i
++)
{
if
(!
getUsedPes
().
contains
(
i
))
{
rgt
.
setPeId
(
i
);
getUsedPes
().
add
(
i
);
numberOfAllocatedPes
++;
if
(
numberOfAllocatedPes
==
rgt
.
getGpuTask
().
getPesLimit
())
{
break
;
}
}
}
return
true
;
}
return
false
;
}
@Override
@Override
public
double
updateGpuTaskProcessing
(
double
currentTime
,
List
<
Double
>
mipsShare
)
{
public
double
updateGpuTaskProcessing
(
double
currentTime
,
List
<
Double
>
mipsShare
)
{
setCurrentMipsShare
(
mipsShare
);
setCurrentMipsShare
(
mipsShare
);
...
@@ -58,6 +77,13 @@ public class GpuTaskSchedulerLeftover extends GpuTaskScheduler {
...
@@ -58,6 +77,13 @@ public class GpuTaskSchedulerLeftover extends GpuTaskScheduler {
}
}
getTaskExecList
().
removeAll
(
toRemove
);
getTaskExecList
().
removeAll
(
toRemove
);
// Redistribute freed resources
if
(!
toRemove
.
isEmpty
())
{
for
(
ResGpuTask
rcl
:
getTaskExecList
())
{
redistributeGpuTaskMips
(
rcl
);
}
}
// for each finished task, add a new one from the waiting list
// for each finished task, add a new one from the waiting list
if
(!
getTaskWaitingList
().
isEmpty
())
{
if
(!
getTaskWaitingList
().
isEmpty
())
{
for
(
int
i
=
0
;
i
<
finished
;
i
++)
{
for
(
int
i
=
0
;
i
<
finished
;
i
++)
{
...
@@ -203,7 +229,7 @@ public class GpuTaskSchedulerLeftover extends GpuTaskScheduler {
...
@@ -203,7 +229,7 @@ public class GpuTaskSchedulerLeftover extends GpuTaskScheduler {
rcl
.
setTaskStatus
(
GpuTask
.
SUCCESS
);
rcl
.
setTaskStatus
(
GpuTask
.
SUCCESS
);
rcl
.
finalizeTask
();
rcl
.
finalizeTask
();
List
<
Integer
>
pesToRemove
=
new
ArrayList
<>();
List
<
Integer
>
pesToRemove
=
new
ArrayList
<>();
for
(
Integer
peId
:
getUsedPes
())
{
for
(
Integer
peId
:
rcl
.
getPeIdList
())
{
pesToRemove
.
add
(
peId
);
pesToRemove
.
add
(
peId
);
}
}
getUsedPes
().
removeAll
(
pesToRemove
);
getUsedPes
().
removeAll
(
pesToRemove
);
...
...
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