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
34be0190
Commit
34be0190
authored
Nov 09, 2018
by
Ahmad Siavashi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GpuHost revised
parent
79ffca08
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
9 deletions
+21
-9
GpuHost.java
...dsim/src/main/java/org/cloudbus/cloudsim/gpu/GpuHost.java
+21
-9
No files found.
modules/cloudsim/src/main/java/org/cloudbus/cloudsim/gpu/GpuHost.java
View file @
34be0190
...
@@ -81,7 +81,7 @@ public class GpuHost extends Host {
...
@@ -81,7 +81,7 @@ public class GpuHost extends Host {
return
true
;
return
true
;
}
}
// if the VM has a vGPU and the host has no local video card -> return false.
// if the VM has a vGPU and the host has no local video card -> return false.
else
if
(
getVideoCardAllocationPolicy
()
==
null
)
{
else
if
(
getVideoCardAllocationPolicy
()
==
null
)
{
return
false
;
return
false
;
}
}
// if the VM has a vGPU and the host has video card(s) -> check compatibility.
// if the VM has a vGPU and the host has video card(s) -> check compatibility.
...
@@ -122,15 +122,27 @@ public class GpuHost extends Host {
...
@@ -122,15 +122,27 @@ public class GpuHost extends Host {
// Device (GPU) allocation
// Device (GPU) allocation
Vgpu
vgpu
=
((
GpuVm
)
vm
).
getVgpu
();
Vgpu
vgpu
=
((
GpuVm
)
vm
).
getVgpu
();
if
(
vgpu
!=
null
)
{
boolean
isGpuAllocated
=
getVideoCardAllocationPolicy
().
allocate
(
vgpu
,
vgpu
.
getPCIeBw
());
// if the VM has no vGPU -> success.
if
(!
isGpuAllocated
)
{
if
(
vgpu
==
null
)
{
Log
.
printConcatLine
(
"[VmScheduler.vmCreate] Allocation of GPU accelerated VM #"
,
vm
.
getId
(),
getVmList
().
add
(
vm
);
" to Host #"
,
getId
(),
" failed due to vgpu allocation failure."
);
vm
.
setHost
(
this
);
rollbackHostResourceAllocation
(
vm
);
return
true
;
return
false
;
}
}
}
// if the VM has a vGPU but the host has no local video card -> fail.
else
if
(
getVideoCardAllocationPolicy
()
==
null
)
{
rollbackHostResourceAllocation
(
vm
);
return
false
;
}
// if the VM has a vGPU and the host has local video card(s) -> check
boolean
isVgpuAllocated
=
getVideoCardAllocationPolicy
().
allocate
(
vgpu
,
vgpu
.
getPCIeBw
());
// if vGPU allocation failed -> fail.
if
(!
isVgpuAllocated
)
{
Log
.
printConcatLine
(
"[VmScheduler.vmCreate] Allocation of GPU accelerated VM #"
,
vm
.
getId
(),
" to Host #"
,
getId
(),
" failed due to vgpu allocation failure."
);
rollbackHostResourceAllocation
(
vm
);
return
false
;
}
// else -> success
getVmList
().
add
(
vm
);
getVmList
().
add
(
vm
);
vm
.
setHost
(
this
);
vm
.
setHost
(
this
);
return
true
;
return
true
;
...
...
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