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
5ed1fc12
Commit
5ed1fc12
authored
Aug 05, 2022
by
Ahmad Siavashi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add GridVgpuSchedulerSpaceShared class
Refactor grid package
parent
b42f823c
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
192 additions
and
366 deletions
+192
-366
CloudSimGpuExample1.java
...g/cloudbus/cloudsim/examples/gpu/CloudSimGpuExample1.java
+10
-9
CloudSimGpuExample2.java
...g/cloudbus/cloudsim/examples/gpu/CloudSimGpuExample2.java
+9
-9
CloudSimGpuExample3.java
...g/cloudbus/cloudsim/examples/gpu/CloudSimGpuExample3.java
+9
-9
CloudSimGpuExample4.java
...g/cloudbus/cloudsim/examples/gpu/CloudSimGpuExample4.java
+9
-8
CloudSimGpuExample5.java
...g/cloudbus/cloudsim/examples/gpu/CloudSimGpuExample5.java
+11
-10
GridGpuVmAllocationPolicyBreadthFirst.java
..._assisted/grid/GridGpuVmAllocationPolicyBreadthFirst.java
+0
-138
GridGpuVmAllocationPolicyDepthFirst.java
...re_assisted/grid/GridGpuVmAllocationPolicyDepthFirst.java
+0
-44
GridPerformanceVgpuSchedulerFairShare.java
..._assisted/grid/GridPerformanceVgpuSchedulerFairShare.java
+0
-44
GridVgpuSchedulerFairShareEx.java
.../hardware_assisted/grid/GridVgpuSchedulerFairShareEx.java
+70
-0
GridVgpuSchedulerSpaceShared.java
.../hardware_assisted/grid/GridVgpuSchedulerSpaceShared.java
+60
-0
GridVgpuTags.java
...bus/cloudsim/gpu/hardware_assisted/grid/GridVgpuTags.java
+8
-94
GridVideoCardTags.java
...loudsim/gpu/hardware_assisted/grid/GridVideoCardTags.java
+6
-1
No files found.
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/gpu/CloudSimGpuExample1.java
View file @
5ed1fc12
...
@@ -27,22 +27,23 @@ import org.cloudbus.cloudsim.gpu.GpuHostTags;
...
@@ -27,22 +27,23 @@ import org.cloudbus.cloudsim.gpu.GpuHostTags;
import
org.cloudbus.cloudsim.gpu.GpuTask
;
import
org.cloudbus.cloudsim.gpu.GpuTask
;
import
org.cloudbus.cloudsim.gpu.GpuTaskSchedulerLeftover
;
import
org.cloudbus.cloudsim.gpu.GpuTaskSchedulerLeftover
;
import
org.cloudbus.cloudsim.gpu.GpuVm
;
import
org.cloudbus.cloudsim.gpu.GpuVm
;
import
org.cloudbus.cloudsim.gpu.GpuVmAllocationPolicySimple
;
import
org.cloudbus.cloudsim.gpu.Pgpu
;
import
org.cloudbus.cloudsim.gpu.Pgpu
;
import
org.cloudbus.cloudsim.gpu.Vgpu
;
import
org.cloudbus.cloudsim.gpu.Vgpu
;
import
org.cloudbus.cloudsim.gpu.VgpuScheduler
;
import
org.cloudbus.cloudsim.gpu.VgpuScheduler
;
import
org.cloudbus.cloudsim.gpu.VideoCard
;
import
org.cloudbus.cloudsim.gpu.VideoCard
;
import
org.cloudbus.cloudsim.gpu.allocation.VideoCardAllocationPolicy
;
import
org.cloudbus.cloudsim.gpu.allocation.VideoCardAllocationPolicy
;
import
org.cloudbus.cloudsim.gpu.allocation.VideoCardAllocationPolicyNull
;
import
org.cloudbus.cloudsim.gpu.allocation.VideoCardAllocationPolicyDepthFirst
;
import
org.cloudbus.cloudsim.gpu.hardware_assisted.grid.GridGpuVmAllocationPolicyDepthFirst
;
import
org.cloudbus.cloudsim.gpu.hardware_assisted.grid.GridVgpuSchedulerFairShareEx
;
import
org.cloudbus.cloudsim.gpu.hardware_assisted.grid.GridVgpuSchedulerFairShare
;
import
org.cloudbus.cloudsim.gpu.hardware_assisted.grid.GridVgpuTags
;
import
org.cloudbus.cloudsim.gpu.hardware_assisted.grid.GridVgpuTags
;
import
org.cloudbus.cloudsim.gpu.hardware_assisted.grid.GridVideoCardTags
;
import
org.cloudbus.cloudsim.gpu.hardware_assisted.grid.GridVideoCardTags
;
import
org.cloudbus.cloudsim.gpu.performance.models.PerformanceModelGpuNull
;
import
org.cloudbus.cloudsim.gpu.provisioners.GpuBwProvisionerShared
;
import
org.cloudbus.cloudsim.gpu.provisioners.GpuBwProvisionerShared
;
import
org.cloudbus.cloudsim.gpu.provisioners.GpuGddramProvisionerSimple
;
import
org.cloudbus.cloudsim.gpu.provisioners.GpuGddramProvisionerSimple
;
import
org.cloudbus.cloudsim.gpu.provisioners.VideoCardBwProvisioner
;
import
org.cloudbus.cloudsim.gpu.provisioners.VideoCardBwProvisioner
;
import
org.cloudbus.cloudsim.gpu.provisioners.VideoCardBwProvisionerShared
;
import
org.cloudbus.cloudsim.gpu.provisioners.VideoCardBwProvisionerShared
;
import
org.cloudbus.cloudsim.gpu.selection.PgpuSelectionPolicy
;
import
org.cloudbus.cloudsim.gpu.selection.PgpuSelectionPolicy
;
import
org.cloudbus.cloudsim.gpu.selection.PgpuSelectionPolicy
Null
;
import
org.cloudbus.cloudsim.gpu.selection.PgpuSelectionPolicy
DepthFirst
;
import
org.cloudbus.cloudsim.lists.VmList
;
import
org.cloudbus.cloudsim.lists.VmList
;
import
org.cloudbus.cloudsim.provisioners.BwProvisionerSimple
;
import
org.cloudbus.cloudsim.provisioners.BwProvisionerSimple
;
import
org.cloudbus.cloudsim.provisioners.PeProvisionerSimple
;
import
org.cloudbus.cloudsim.provisioners.PeProvisionerSimple
;
...
@@ -255,10 +256,10 @@ public class CloudSimGpuExample1 {
...
@@ -255,10 +256,10 @@ public class CloudSimGpuExample1 {
new
GpuGddramProvisionerSimple
(
gddram
),
new
GpuBwProvisionerShared
(
bw
)));
new
GpuGddramProvisionerSimple
(
gddram
),
new
GpuBwProvisionerShared
(
bw
)));
}
}
// Pgpu selection policy
// Pgpu selection policy
PgpuSelectionPolicy
pgpuSelectionPolicy
=
new
PgpuSelectionPolicy
Null
();
PgpuSelectionPolicy
pgpuSelectionPolicy
=
new
PgpuSelectionPolicy
DepthFirst
();
// Vgpu Scheduler
// Vgpu Scheduler
VgpuScheduler
vgpuScheduler
=
new
GridVgpuSchedulerFairShare
(
GridVideoCardTags
.
NVIDIA_K1_CARD
,
pgpus
,
VgpuScheduler
vgpuScheduler
=
new
GridVgpuSchedulerFairShare
Ex
(
GridVideoCardTags
.
NVIDIA_K1_CARD
,
pgpus
,
pgpuSelectionPolicy
);
pgpuSelectionPolicy
,
new
PerformanceModelGpuNull
(),
GridVideoCardTags
.
K1_VGPUS
);
// PCI Express Bus Bw Provisioner
// PCI Express Bus Bw Provisioner
VideoCardBwProvisioner
videoCardBwProvisioner
=
new
VideoCardBwProvisionerShared
(
BusTags
.
PCI_E_3_X16_BW
);
VideoCardBwProvisioner
videoCardBwProvisioner
=
new
VideoCardBwProvisionerShared
(
BusTags
.
PCI_E_3_X16_BW
);
// Create a video card
// Create a video card
...
@@ -291,7 +292,7 @@ public class CloudSimGpuExample1 {
...
@@ -291,7 +292,7 @@ public class CloudSimGpuExample1 {
// Set VM Scheduler
// Set VM Scheduler
VmScheduler
vmScheduler
=
new
VmSchedulerTimeShared
(
peList
);
VmScheduler
vmScheduler
=
new
VmSchedulerTimeShared
(
peList
);
// Video Card Selection Policy
// Video Card Selection Policy
VideoCardAllocationPolicy
videoCardAllocationPolicy
=
new
VideoCardAllocationPolicy
Null
(
videoCards
);
VideoCardAllocationPolicy
videoCardAllocationPolicy
=
new
VideoCardAllocationPolicy
DepthFirst
(
videoCards
);
GpuHost
newHost
=
new
GpuHost
(
hostId
,
GpuHostTags
.
DUAL_INTEL_XEON_E5_2620_V3
,
new
RamProvisionerSimple
(
ram
),
GpuHost
newHost
=
new
GpuHost
(
hostId
,
GpuHostTags
.
DUAL_INTEL_XEON_E5_2620_V3
,
new
RamProvisionerSimple
(
ram
),
new
BwProvisionerSimple
(
bw
),
storage
,
peList
,
vmScheduler
,
videoCardAllocationPolicy
);
new
BwProvisionerSimple
(
bw
),
storage
,
peList
,
vmScheduler
,
videoCardAllocationPolicy
);
hostList
.
add
(
newHost
);
hostList
.
add
(
newHost
);
...
@@ -325,7 +326,7 @@ public class CloudSimGpuExample1 {
...
@@ -325,7 +326,7 @@ public class CloudSimGpuExample1 {
// We need to create a Datacenter object.
// We need to create a Datacenter object.
GpuDatacenter
datacenter
=
null
;
GpuDatacenter
datacenter
=
null
;
try
{
try
{
datacenter
=
new
GpuDatacenter
(
name
,
characteristics
,
new
G
ridGpuVmAllocationPolicyDepthFirst
(
hostList
),
datacenter
=
new
GpuDatacenter
(
name
,
characteristics
,
new
G
puVmAllocationPolicySimple
(
hostList
),
storageList
,
schedulingInterval
);
storageList
,
schedulingInterval
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
...
...
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/gpu/CloudSimGpuExample2.java
View file @
5ed1fc12
...
@@ -27,26 +27,27 @@ import org.cloudbus.cloudsim.gpu.GpuHostTags;
...
@@ -27,26 +27,27 @@ import org.cloudbus.cloudsim.gpu.GpuHostTags;
import
org.cloudbus.cloudsim.gpu.GpuTask
;
import
org.cloudbus.cloudsim.gpu.GpuTask
;
import
org.cloudbus.cloudsim.gpu.GpuTaskSchedulerLeftover
;
import
org.cloudbus.cloudsim.gpu.GpuTaskSchedulerLeftover
;
import
org.cloudbus.cloudsim.gpu.GpuVm
;
import
org.cloudbus.cloudsim.gpu.GpuVm
;
import
org.cloudbus.cloudsim.gpu.GpuVmAllocationPolicySimple
;
import
org.cloudbus.cloudsim.gpu.Pgpu
;
import
org.cloudbus.cloudsim.gpu.Pgpu
;
import
org.cloudbus.cloudsim.gpu.ResGpuTask
;
import
org.cloudbus.cloudsim.gpu.ResGpuTask
;
import
org.cloudbus.cloudsim.gpu.Vgpu
;
import
org.cloudbus.cloudsim.gpu.Vgpu
;
import
org.cloudbus.cloudsim.gpu.VgpuScheduler
;
import
org.cloudbus.cloudsim.gpu.VgpuScheduler
;
import
org.cloudbus.cloudsim.gpu.VideoCard
;
import
org.cloudbus.cloudsim.gpu.VideoCard
;
import
org.cloudbus.cloudsim.gpu.allocation.VideoCardAllocationPolicy
;
import
org.cloudbus.cloudsim.gpu.allocation.VideoCardAllocationPolicy
;
import
org.cloudbus.cloudsim.gpu.allocation.VideoCardAllocationPolicyNull
;
import
org.cloudbus.cloudsim.gpu.allocation.VideoCardAllocationPolicyBreadthFirst
;
import
org.cloudbus.cloudsim.gpu.hardware_assisted.grid.GridGpuVmAllocationPolicyBreadthFirst
;
import
org.cloudbus.cloudsim.gpu.hardware_assisted.grid.GridVgpuSchedulerFairShareEx
;
import
org.cloudbus.cloudsim.gpu.hardware_assisted.grid.GridVgpuSchedulerFairShare
;
import
org.cloudbus.cloudsim.gpu.hardware_assisted.grid.GridVgpuTags
;
import
org.cloudbus.cloudsim.gpu.hardware_assisted.grid.GridVgpuTags
;
import
org.cloudbus.cloudsim.gpu.hardware_assisted.grid.GridVideoCardTags
;
import
org.cloudbus.cloudsim.gpu.hardware_assisted.grid.GridVideoCardTags
;
import
org.cloudbus.cloudsim.gpu.interference.InterferenceGpuTaskSchedulerLeftover
;
import
org.cloudbus.cloudsim.gpu.interference.InterferenceGpuTaskSchedulerLeftover
;
import
org.cloudbus.cloudsim.gpu.interference.models.InterferenceModel
;
import
org.cloudbus.cloudsim.gpu.interference.models.InterferenceModel
;
import
org.cloudbus.cloudsim.gpu.interference.models.InterferenceModelGpuMemory
;
import
org.cloudbus.cloudsim.gpu.interference.models.InterferenceModelGpuMemory
;
import
org.cloudbus.cloudsim.gpu.performance.models.PerformanceModelGpuNull
;
import
org.cloudbus.cloudsim.gpu.provisioners.GpuBwProvisionerShared
;
import
org.cloudbus.cloudsim.gpu.provisioners.GpuBwProvisionerShared
;
import
org.cloudbus.cloudsim.gpu.provisioners.GpuGddramProvisionerSimple
;
import
org.cloudbus.cloudsim.gpu.provisioners.GpuGddramProvisionerSimple
;
import
org.cloudbus.cloudsim.gpu.provisioners.VideoCardBwProvisioner
;
import
org.cloudbus.cloudsim.gpu.provisioners.VideoCardBwProvisioner
;
import
org.cloudbus.cloudsim.gpu.provisioners.VideoCardBwProvisionerShared
;
import
org.cloudbus.cloudsim.gpu.provisioners.VideoCardBwProvisionerShared
;
import
org.cloudbus.cloudsim.gpu.selection.PgpuSelectionPolicy
;
import
org.cloudbus.cloudsim.gpu.selection.PgpuSelectionPolicy
;
import
org.cloudbus.cloudsim.gpu.selection.PgpuSelectionPolicy
Null
;
import
org.cloudbus.cloudsim.gpu.selection.PgpuSelectionPolicy
BreadthFirst
;
import
org.cloudbus.cloudsim.lists.VmList
;
import
org.cloudbus.cloudsim.lists.VmList
;
import
org.cloudbus.cloudsim.provisioners.BwProvisionerSimple
;
import
org.cloudbus.cloudsim.provisioners.BwProvisionerSimple
;
import
org.cloudbus.cloudsim.provisioners.PeProvisionerSimple
;
import
org.cloudbus.cloudsim.provisioners.PeProvisionerSimple
;
...
@@ -261,10 +262,9 @@ public class CloudSimGpuExample2 {
...
@@ -261,10 +262,9 @@ public class CloudSimGpuExample2 {
new
GpuGddramProvisionerSimple
(
gddram
),
new
GpuBwProvisionerShared
(
bw
)));
new
GpuGddramProvisionerSimple
(
gddram
),
new
GpuBwProvisionerShared
(
bw
)));
}
}
// Pgpu selection policy
// Pgpu selection policy
PgpuSelectionPolicy
pgpuSelectionPolicy
=
new
PgpuSelectionPolicy
Null
();
PgpuSelectionPolicy
pgpuSelectionPolicy
=
new
PgpuSelectionPolicy
BreadthFirst
();
// Scheduler
// Scheduler
VgpuScheduler
vgpuScheduler
=
new
GridVgpuSchedulerFairShare
(
GridVideoCardTags
.
NVIDIA_K2_CARD
,
pgpus
,
VgpuScheduler
vgpuScheduler
=
new
GridVgpuSchedulerFairShareEx
(
GridVideoCardTags
.
NVIDIA_K2_CARD
,
pgpus
,
pgpuSelectionPolicy
,
new
PerformanceModelGpuNull
(),
GridVideoCardTags
.
K2_VGPUS
);
pgpuSelectionPolicy
);
// PCI Express Bus Bw Provisioner
// PCI Express Bus Bw Provisioner
VideoCardBwProvisioner
videoCardBwProvisioner
=
new
VideoCardBwProvisionerShared
(
BusTags
.
PCI_E_3_X16_BW
);
VideoCardBwProvisioner
videoCardBwProvisioner
=
new
VideoCardBwProvisionerShared
(
BusTags
.
PCI_E_3_X16_BW
);
// Create a video card
// Create a video card
...
@@ -297,7 +297,7 @@ public class CloudSimGpuExample2 {
...
@@ -297,7 +297,7 @@ public class CloudSimGpuExample2 {
// Set VM Scheduler
// Set VM Scheduler
VmScheduler
vmScheduler
=
new
VmSchedulerTimeShared
(
peList
);
VmScheduler
vmScheduler
=
new
VmSchedulerTimeShared
(
peList
);
// Video Card Selection Policy
// Video Card Selection Policy
VideoCardAllocationPolicy
videoCardAllocationPolicy
=
new
VideoCardAllocationPolicy
Null
(
videoCards
);
VideoCardAllocationPolicy
videoCardAllocationPolicy
=
new
VideoCardAllocationPolicy
BreadthFirst
(
videoCards
);
GpuHost
newHost
=
new
GpuHost
(
hostId
,
GpuHostTags
.
DUAL_INTEL_XEON_E5_2620_V3
,
new
RamProvisionerSimple
(
ram
),
GpuHost
newHost
=
new
GpuHost
(
hostId
,
GpuHostTags
.
DUAL_INTEL_XEON_E5_2620_V3
,
new
RamProvisionerSimple
(
ram
),
new
BwProvisionerSimple
(
bw
),
storage
,
peList
,
vmScheduler
,
videoCardAllocationPolicy
);
new
BwProvisionerSimple
(
bw
),
storage
,
peList
,
vmScheduler
,
videoCardAllocationPolicy
);
hostList
.
add
(
newHost
);
hostList
.
add
(
newHost
);
...
@@ -331,7 +331,7 @@ public class CloudSimGpuExample2 {
...
@@ -331,7 +331,7 @@ public class CloudSimGpuExample2 {
// We need to create a Datacenter object.
// We need to create a Datacenter object.
GpuDatacenter
datacenter
=
null
;
GpuDatacenter
datacenter
=
null
;
try
{
try
{
datacenter
=
new
GpuDatacenter
(
name
,
characteristics
,
new
G
ridGpuVmAllocationPolicyBreadthFirst
(
hostList
),
datacenter
=
new
GpuDatacenter
(
name
,
characteristics
,
new
G
puVmAllocationPolicySimple
(
hostList
),
storageList
,
schedulingInterval
);
storageList
,
schedulingInterval
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
...
...
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/gpu/CloudSimGpuExample3.java
View file @
5ed1fc12
...
@@ -27,15 +27,15 @@ import org.cloudbus.cloudsim.gpu.GpuHostTags;
...
@@ -27,15 +27,15 @@ import org.cloudbus.cloudsim.gpu.GpuHostTags;
import
org.cloudbus.cloudsim.gpu.GpuTask
;
import
org.cloudbus.cloudsim.gpu.GpuTask
;
import
org.cloudbus.cloudsim.gpu.GpuTaskSchedulerLeftover
;
import
org.cloudbus.cloudsim.gpu.GpuTaskSchedulerLeftover
;
import
org.cloudbus.cloudsim.gpu.GpuVm
;
import
org.cloudbus.cloudsim.gpu.GpuVm
;
import
org.cloudbus.cloudsim.gpu.GpuVmAllocationPolicySimple
;
import
org.cloudbus.cloudsim.gpu.Pgpu
;
import
org.cloudbus.cloudsim.gpu.Pgpu
;
import
org.cloudbus.cloudsim.gpu.ResGpuTask
;
import
org.cloudbus.cloudsim.gpu.ResGpuTask
;
import
org.cloudbus.cloudsim.gpu.Vgpu
;
import
org.cloudbus.cloudsim.gpu.Vgpu
;
import
org.cloudbus.cloudsim.gpu.VgpuScheduler
;
import
org.cloudbus.cloudsim.gpu.VgpuScheduler
;
import
org.cloudbus.cloudsim.gpu.VideoCard
;
import
org.cloudbus.cloudsim.gpu.VideoCard
;
import
org.cloudbus.cloudsim.gpu.allocation.VideoCardAllocationPolicy
;
import
org.cloudbus.cloudsim.gpu.allocation.VideoCardAllocationPolicy
;
import
org.cloudbus.cloudsim.gpu.allocation.VideoCardAllocationPolicyNull
;
import
org.cloudbus.cloudsim.gpu.allocation.VideoCardAllocationPolicyBreadthFirst
;
import
org.cloudbus.cloudsim.gpu.hardware_assisted.grid.GridGpuVmAllocationPolicyBreadthFirst
;
import
org.cloudbus.cloudsim.gpu.hardware_assisted.grid.GridVgpuSchedulerFairShareEx
;
import
org.cloudbus.cloudsim.gpu.hardware_assisted.grid.GridPerformanceVgpuSchedulerFairShare
;
import
org.cloudbus.cloudsim.gpu.hardware_assisted.grid.GridVgpuTags
;
import
org.cloudbus.cloudsim.gpu.hardware_assisted.grid.GridVgpuTags
;
import
org.cloudbus.cloudsim.gpu.hardware_assisted.grid.GridVideoCardTags
;
import
org.cloudbus.cloudsim.gpu.hardware_assisted.grid.GridVideoCardTags
;
import
org.cloudbus.cloudsim.gpu.interference.InterferenceGpuTaskSchedulerLeftover
;
import
org.cloudbus.cloudsim.gpu.interference.InterferenceGpuTaskSchedulerLeftover
;
...
@@ -49,7 +49,7 @@ import org.cloudbus.cloudsim.gpu.provisioners.GpuGddramProvisionerSimple;
...
@@ -49,7 +49,7 @@ import org.cloudbus.cloudsim.gpu.provisioners.GpuGddramProvisionerSimple;
import
org.cloudbus.cloudsim.gpu.provisioners.VideoCardBwProvisioner
;
import
org.cloudbus.cloudsim.gpu.provisioners.VideoCardBwProvisioner
;
import
org.cloudbus.cloudsim.gpu.provisioners.VideoCardBwProvisionerShared
;
import
org.cloudbus.cloudsim.gpu.provisioners.VideoCardBwProvisionerShared
;
import
org.cloudbus.cloudsim.gpu.selection.PgpuSelectionPolicy
;
import
org.cloudbus.cloudsim.gpu.selection.PgpuSelectionPolicy
;
import
org.cloudbus.cloudsim.gpu.selection.PgpuSelectionPolicy
Null
;
import
org.cloudbus.cloudsim.gpu.selection.PgpuSelectionPolicy
BreadthFirst
;
import
org.cloudbus.cloudsim.lists.VmList
;
import
org.cloudbus.cloudsim.lists.VmList
;
import
org.cloudbus.cloudsim.provisioners.BwProvisionerSimple
;
import
org.cloudbus.cloudsim.provisioners.BwProvisionerSimple
;
import
org.cloudbus.cloudsim.provisioners.PeProvisionerSimple
;
import
org.cloudbus.cloudsim.provisioners.PeProvisionerSimple
;
...
@@ -238,12 +238,12 @@ public class CloudSimGpuExample3 {
...
@@ -238,12 +238,12 @@ public class CloudSimGpuExample3 {
new
GpuGddramProvisionerSimple
(
gddram
),
new
GpuBwProvisionerShared
(
bw
)));
new
GpuGddramProvisionerSimple
(
gddram
),
new
GpuBwProvisionerShared
(
bw
)));
}
}
// Pgpu selection policy
// Pgpu selection policy
PgpuSelectionPolicy
pgpuSelectionPolicy
=
new
PgpuSelectionPolicy
Null
();
PgpuSelectionPolicy
pgpuSelectionPolicy
=
new
PgpuSelectionPolicy
BreadthFirst
();
// Performance Model
// Performance Model
PerformanceModel
<
VgpuScheduler
,
Vgpu
>
performanceModel
=
new
PerformanceModelGpuConstant
(
0.1
);
PerformanceModel
<
VgpuScheduler
,
Vgpu
>
performanceModel
=
new
PerformanceModelGpuConstant
(
0.1
);
// Scheduler
// Scheduler
VgpuScheduler
vgpuScheduler
=
new
Grid
PerformanceVgpuSchedulerFairShare
(
GridVideoCardTags
.
NVIDIA_K2_CARD
,
VgpuScheduler
vgpuScheduler
=
new
Grid
VgpuSchedulerFairShareEx
(
GridVideoCardTags
.
NVIDIA_K2_CARD
,
pgpus
,
pgpuSelectionPolicy
,
performanceModel
);
pgpus
,
pgpuSelectionPolicy
,
performanceModel
,
GridVideoCardTags
.
K2_VGPUS
);
// PCI Express Bus Bw Provisioner
// PCI Express Bus Bw Provisioner
VideoCardBwProvisioner
videoCardBwProvisioner
=
new
VideoCardBwProvisionerShared
(
BusTags
.
PCI_E_3_X16_BW
);
VideoCardBwProvisioner
videoCardBwProvisioner
=
new
VideoCardBwProvisionerShared
(
BusTags
.
PCI_E_3_X16_BW
);
// Create a video card
// Create a video card
...
@@ -276,7 +276,7 @@ public class CloudSimGpuExample3 {
...
@@ -276,7 +276,7 @@ public class CloudSimGpuExample3 {
// Set VM Scheduler
// Set VM Scheduler
VmScheduler
vmScheduler
=
new
VmSchedulerTimeShared
(
peList
);
VmScheduler
vmScheduler
=
new
VmSchedulerTimeShared
(
peList
);
// Video Card Selection Policy
// Video Card Selection Policy
VideoCardAllocationPolicy
videoCardAllocationPolicy
=
new
VideoCardAllocationPolicy
Null
(
videoCards
);
VideoCardAllocationPolicy
videoCardAllocationPolicy
=
new
VideoCardAllocationPolicy
BreadthFirst
(
videoCards
);
PerformanceGpuHost
newHost
=
new
PerformanceGpuHost
(
hostId
,
GpuHostTags
.
DUAL_INTEL_XEON_E5_2620_V3
,
PerformanceGpuHost
newHost
=
new
PerformanceGpuHost
(
hostId
,
GpuHostTags
.
DUAL_INTEL_XEON_E5_2620_V3
,
new
RamProvisionerSimple
(
ram
),
new
BwProvisionerSimple
(
bw
),
storage
,
peList
,
vmScheduler
,
new
RamProvisionerSimple
(
ram
),
new
BwProvisionerSimple
(
bw
),
storage
,
peList
,
vmScheduler
,
videoCardAllocationPolicy
);
videoCardAllocationPolicy
);
...
@@ -311,7 +311,7 @@ public class CloudSimGpuExample3 {
...
@@ -311,7 +311,7 @@ public class CloudSimGpuExample3 {
// We need to create a Datacenter object.
// We need to create a Datacenter object.
GpuDatacenter
datacenter
=
null
;
GpuDatacenter
datacenter
=
null
;
try
{
try
{
datacenter
=
new
GpuDatacenter
(
name
,
characteristics
,
new
G
ridGpuVmAllocationPolicyBreadthFirst
(
hostList
),
datacenter
=
new
GpuDatacenter
(
name
,
characteristics
,
new
G
puVmAllocationPolicySimple
(
hostList
),
storageList
,
schedulingInterval
);
storageList
,
schedulingInterval
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
...
...
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/gpu/CloudSimGpuExample4.java
View file @
5ed1fc12
...
@@ -26,14 +26,14 @@ import org.cloudbus.cloudsim.gpu.GpuHostTags;
...
@@ -26,14 +26,14 @@ import org.cloudbus.cloudsim.gpu.GpuHostTags;
import
org.cloudbus.cloudsim.gpu.GpuTask
;
import
org.cloudbus.cloudsim.gpu.GpuTask
;
import
org.cloudbus.cloudsim.gpu.GpuTaskSchedulerLeftover
;
import
org.cloudbus.cloudsim.gpu.GpuTaskSchedulerLeftover
;
import
org.cloudbus.cloudsim.gpu.GpuVm
;
import
org.cloudbus.cloudsim.gpu.GpuVm
;
import
org.cloudbus.cloudsim.gpu.GpuVmAllocationPolicySimple
;
import
org.cloudbus.cloudsim.gpu.Pgpu
;
import
org.cloudbus.cloudsim.gpu.Pgpu
;
import
org.cloudbus.cloudsim.gpu.Vgpu
;
import
org.cloudbus.cloudsim.gpu.Vgpu
;
import
org.cloudbus.cloudsim.gpu.VgpuScheduler
;
import
org.cloudbus.cloudsim.gpu.VgpuScheduler
;
import
org.cloudbus.cloudsim.gpu.VideoCard
;
import
org.cloudbus.cloudsim.gpu.VideoCard
;
import
org.cloudbus.cloudsim.gpu.allocation.VideoCardAllocationPolicy
;
import
org.cloudbus.cloudsim.gpu.allocation.VideoCardAllocationPolicy
;
import
org.cloudbus.cloudsim.gpu.allocation.VideoCardAllocationPolicyNull
;
import
org.cloudbus.cloudsim.gpu.allocation.VideoCardAllocationPolicyBreadthFirst
;
import
org.cloudbus.cloudsim.gpu.hardware_assisted.grid.GridGpuVmAllocationPolicyBreadthFirst
;
import
org.cloudbus.cloudsim.gpu.hardware_assisted.grid.GridVgpuSchedulerFairShareEx
;
import
org.cloudbus.cloudsim.gpu.hardware_assisted.grid.GridPerformanceVgpuSchedulerFairShare
;
import
org.cloudbus.cloudsim.gpu.hardware_assisted.grid.GridVgpuTags
;
import
org.cloudbus.cloudsim.gpu.hardware_assisted.grid.GridVgpuTags
;
import
org.cloudbus.cloudsim.gpu.hardware_assisted.grid.GridVideoCardPowerModelK1
;
import
org.cloudbus.cloudsim.gpu.hardware_assisted.grid.GridVideoCardPowerModelK1
;
import
org.cloudbus.cloudsim.gpu.hardware_assisted.grid.GridVideoCardTags
;
import
org.cloudbus.cloudsim.gpu.hardware_assisted.grid.GridVideoCardTags
;
...
@@ -50,6 +50,7 @@ import org.cloudbus.cloudsim.gpu.provisioners.GpuGddramProvisionerSimple;
...
@@ -50,6 +50,7 @@ import org.cloudbus.cloudsim.gpu.provisioners.GpuGddramProvisionerSimple;
import
org.cloudbus.cloudsim.gpu.provisioners.VideoCardBwProvisioner
;
import
org.cloudbus.cloudsim.gpu.provisioners.VideoCardBwProvisioner
;
import
org.cloudbus.cloudsim.gpu.provisioners.VideoCardBwProvisionerShared
;
import
org.cloudbus.cloudsim.gpu.provisioners.VideoCardBwProvisionerShared
;
import
org.cloudbus.cloudsim.gpu.selection.PgpuSelectionPolicy
;
import
org.cloudbus.cloudsim.gpu.selection.PgpuSelectionPolicy
;
import
org.cloudbus.cloudsim.gpu.selection.PgpuSelectionPolicyBreadthFirst
;
import
org.cloudbus.cloudsim.gpu.selection.PgpuSelectionPolicyNull
;
import
org.cloudbus.cloudsim.gpu.selection.PgpuSelectionPolicyNull
;
import
org.cloudbus.cloudsim.lists.VmList
;
import
org.cloudbus.cloudsim.lists.VmList
;
import
org.cloudbus.cloudsim.power.models.PowerModel
;
import
org.cloudbus.cloudsim.power.models.PowerModel
;
...
@@ -259,13 +260,13 @@ public class CloudSimGpuExample4 {
...
@@ -259,13 +260,13 @@ public class CloudSimGpuExample4 {
new
GpuGddramProvisionerSimple
(
gddram
),
new
GpuBwProvisionerShared
(
bw
)));
new
GpuGddramProvisionerSimple
(
gddram
),
new
GpuBwProvisionerShared
(
bw
)));
}
}
// Pgpu selection policy
// Pgpu selection policy
PgpuSelectionPolicy
pgpuSelectionPolicy
=
new
PgpuSelectionPolicy
Null
();
PgpuSelectionPolicy
pgpuSelectionPolicy
=
new
PgpuSelectionPolicy
BreadthFirst
();
// Performance Model
// Performance Model
double
performanceLoss
=
0.1
;
double
performanceLoss
=
0.1
;
PerformanceModel
<
VgpuScheduler
,
Vgpu
>
performanceModel
=
new
PerformanceModelGpuConstant
(
performanceLoss
);
PerformanceModel
<
VgpuScheduler
,
Vgpu
>
performanceModel
=
new
PerformanceModelGpuConstant
(
performanceLoss
);
// Scheduler
// Scheduler
Grid
PerformanceVgpuSchedulerFairShare
vgpuScheduler
=
new
GridPerformanceVgpuSchedulerFairShare
(
Grid
VgpuSchedulerFairShareEx
vgpuScheduler
=
new
GridVgpuSchedulerFairShareEx
(
GridVideoCardTags
.
NVIDIA_K1_CARD
,
pgpus
,
pgpuSelectionPolicy
,
performanceModel
);
GridVideoCardTags
.
NVIDIA_K1_CARD
,
pgpus
,
pgpuSelectionPolicy
,
performanceModel
,
GridVideoCardTags
.
K1_VGPUS
);
// PCI Express Bus Bw Provisioner
// PCI Express Bus Bw Provisioner
VideoCardBwProvisioner
videoCardBwProvisioner
=
new
VideoCardBwProvisionerShared
(
BusTags
.
PCI_E_3_X16_BW
);
VideoCardBwProvisioner
videoCardBwProvisioner
=
new
VideoCardBwProvisionerShared
(
BusTags
.
PCI_E_3_X16_BW
);
// Video Card Power Model
// Video Card Power Model
...
@@ -304,7 +305,7 @@ public class CloudSimGpuExample4 {
...
@@ -304,7 +305,7 @@ public class CloudSimGpuExample4 {
double
hostStaticPowerPercent
=
0.70
;
double
hostStaticPowerPercent
=
0.70
;
PowerModel
powerModel
=
new
GpuHostPowerModelLinear
(
hostMaxPower
,
hostStaticPowerPercent
);
PowerModel
powerModel
=
new
GpuHostPowerModelLinear
(
hostMaxPower
,
hostStaticPowerPercent
);
// Video Card Selection Policy
// Video Card Selection Policy
VideoCardAllocationPolicy
videoCardAllocationPolicy
=
new
VideoCardAllocationPolicy
Null
(
videoCards
);
VideoCardAllocationPolicy
videoCardAllocationPolicy
=
new
VideoCardAllocationPolicy
BreadthFirst
(
videoCards
);
PowerGpuHost
newHost
=
new
PowerGpuHost
(
hostId
,
GpuHostTags
.
DUAL_INTEL_XEON_E5_2620_V3
,
PowerGpuHost
newHost
=
new
PowerGpuHost
(
hostId
,
GpuHostTags
.
DUAL_INTEL_XEON_E5_2620_V3
,
new
RamProvisionerSimple
(
ram
),
new
BwProvisionerSimple
(
bw
),
storage
,
peList
,
vmScheduler
,
new
RamProvisionerSimple
(
ram
),
new
BwProvisionerSimple
(
bw
),
storage
,
peList
,
vmScheduler
,
videoCardAllocationPolicy
,
powerModel
);
videoCardAllocationPolicy
,
powerModel
);
...
@@ -340,7 +341,7 @@ public class CloudSimGpuExample4 {
...
@@ -340,7 +341,7 @@ public class CloudSimGpuExample4 {
PowerGpuDatacenter
datacenter
=
null
;
PowerGpuDatacenter
datacenter
=
null
;
try
{
try
{
datacenter
=
new
PowerGpuDatacenter
(
name
,
characteristics
,
datacenter
=
new
PowerGpuDatacenter
(
name
,
characteristics
,
new
G
ridGpuVmAllocationPolicyBreadthFirst
(
hostList
),
storageList
,
schedulingInterval
);
new
G
puVmAllocationPolicySimple
(
hostList
),
storageList
,
schedulingInterval
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
...
...
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/gpu/CloudSimGpuExample5.java
View file @
5ed1fc12
...
@@ -26,14 +26,14 @@ import org.cloudbus.cloudsim.gpu.GpuHostTags;
...
@@ -26,14 +26,14 @@ import org.cloudbus.cloudsim.gpu.GpuHostTags;
import
org.cloudbus.cloudsim.gpu.GpuTask
;
import
org.cloudbus.cloudsim.gpu.GpuTask
;
import
org.cloudbus.cloudsim.gpu.GpuTaskSchedulerLeftover
;
import
org.cloudbus.cloudsim.gpu.GpuTaskSchedulerLeftover
;
import
org.cloudbus.cloudsim.gpu.GpuVm
;
import
org.cloudbus.cloudsim.gpu.GpuVm
;
import
org.cloudbus.cloudsim.gpu.GpuVmAllocationPolicySimple
;
import
org.cloudbus.cloudsim.gpu.Pgpu
;
import
org.cloudbus.cloudsim.gpu.Pgpu
;
import
org.cloudbus.cloudsim.gpu.Vgpu
;
import
org.cloudbus.cloudsim.gpu.Vgpu
;
import
org.cloudbus.cloudsim.gpu.VgpuScheduler
;
import
org.cloudbus.cloudsim.gpu.VgpuScheduler
;
import
org.cloudbus.cloudsim.gpu.VideoCard
;
import
org.cloudbus.cloudsim.gpu.VideoCard
;
import
org.cloudbus.cloudsim.gpu.allocation.VideoCardAllocationPolicy
;
import
org.cloudbus.cloudsim.gpu.allocation.VideoCardAllocationPolicy
;
import
org.cloudbus.cloudsim.gpu.allocation.VideoCardAllocationPolicyNull
;
import
org.cloudbus.cloudsim.gpu.allocation.VideoCardAllocationPolicyBreadthFirst
;
import
org.cloudbus.cloudsim.gpu.hardware_assisted.grid.GridGpuVmAllocationPolicyBreadthFirst
;
import
org.cloudbus.cloudsim.gpu.hardware_assisted.grid.GridVgpuSchedulerFairShareEx
;
import
org.cloudbus.cloudsim.gpu.hardware_assisted.grid.GridPerformanceVgpuSchedulerFairShare
;
import
org.cloudbus.cloudsim.gpu.hardware_assisted.grid.GridVgpuTags
;
import
org.cloudbus.cloudsim.gpu.hardware_assisted.grid.GridVgpuTags
;
import
org.cloudbus.cloudsim.gpu.hardware_assisted.grid.GridVideoCardPowerModelK1
;
import
org.cloudbus.cloudsim.gpu.hardware_assisted.grid.GridVideoCardPowerModelK1
;
import
org.cloudbus.cloudsim.gpu.hardware_assisted.grid.GridVideoCardTags
;
import
org.cloudbus.cloudsim.gpu.hardware_assisted.grid.GridVideoCardTags
;
...
@@ -50,7 +50,7 @@ import org.cloudbus.cloudsim.gpu.provisioners.GpuGddramProvisionerSimple;
...
@@ -50,7 +50,7 @@ import org.cloudbus.cloudsim.gpu.provisioners.GpuGddramProvisionerSimple;
import
org.cloudbus.cloudsim.gpu.provisioners.VideoCardBwProvisioner
;
import
org.cloudbus.cloudsim.gpu.provisioners.VideoCardBwProvisioner
;
import
org.cloudbus.cloudsim.gpu.provisioners.VideoCardBwProvisionerShared
;
import
org.cloudbus.cloudsim.gpu.provisioners.VideoCardBwProvisionerShared
;
import
org.cloudbus.cloudsim.gpu.selection.PgpuSelectionPolicy
;
import
org.cloudbus.cloudsim.gpu.selection.PgpuSelectionPolicy
;
import
org.cloudbus.cloudsim.gpu.selection.PgpuSelectionPolicy
Null
;
import
org.cloudbus.cloudsim.gpu.selection.PgpuSelectionPolicy
BreadthFirst
;
import
org.cloudbus.cloudsim.lists.VmList
;
import
org.cloudbus.cloudsim.lists.VmList
;
import
org.cloudbus.cloudsim.power.models.PowerModel
;
import
org.cloudbus.cloudsim.power.models.PowerModel
;
import
org.cloudbus.cloudsim.provisioners.BwProvisionerSimple
;
import
org.cloudbus.cloudsim.provisioners.BwProvisionerSimple
;
...
@@ -263,13 +263,14 @@ public class CloudSimGpuExample5 {
...
@@ -263,13 +263,14 @@ public class CloudSimGpuExample5 {
new
GpuGddramProvisionerSimple
(
gddram
),
new
GpuBwProvisionerShared
(
bw
)));
new
GpuGddramProvisionerSimple
(
gddram
),
new
GpuBwProvisionerShared
(
bw
)));
}
}
// Pgpu selection policy
// Pgpu selection policy
PgpuSelectionPolicy
pgpuSelectionPolicy
=
new
PgpuSelectionPolicy
Null
();
PgpuSelectionPolicy
pgpuSelectionPolicy
=
new
PgpuSelectionPolicy
BreadthFirst
();
// Performance Model
// Performance Model
double
performanceLoss
=
0.1
;
double
performanceLoss
=
0.1
;
PerformanceModel
<
VgpuScheduler
,
Vgpu
>
performanceModel
=
new
PerformanceModelGpuConstant
(
performanceLoss
);
PerformanceModel
<
VgpuScheduler
,
Vgpu
>
performanceModel
=
new
PerformanceModelGpuConstant
(
performanceLoss
);
// Scheduler
// Scheduler
GridPerformanceVgpuSchedulerFairShare
vgpuScheduler
=
new
GridPerformanceVgpuSchedulerFairShare
(
GridVgpuSchedulerFairShareEx
vgpuScheduler
=
new
GridVgpuSchedulerFairShareEx
(
GridVideoCardTags
.
NVIDIA_K1_CARD
,
pgpus
,
pgpuSelectionPolicy
,
performanceModel
);
GridVideoCardTags
.
NVIDIA_K1_CARD
,
pgpus
,
pgpuSelectionPolicy
,
performanceModel
,
GridVideoCardTags
.
K2_VGPUS
);
// PCI Express Bus Bw Provisioner
// PCI Express Bus Bw Provisioner
VideoCardBwProvisioner
videoCardBwProvisioner
=
new
VideoCardBwProvisionerShared
(
BusTags
.
PCI_E_3_X16_BW
);
VideoCardBwProvisioner
videoCardBwProvisioner
=
new
VideoCardBwProvisionerShared
(
BusTags
.
PCI_E_3_X16_BW
);
// Video Card Power Model
// Video Card Power Model
...
@@ -308,7 +309,7 @@ public class CloudSimGpuExample5 {
...
@@ -308,7 +309,7 @@ public class CloudSimGpuExample5 {
double
hostStaticPowerPercent
=
0.70
;
double
hostStaticPowerPercent
=
0.70
;
PowerModel
powerModel
=
new
GpuHostPowerModelLinear
(
hostMaxPower
,
hostStaticPowerPercent
);
PowerModel
powerModel
=
new
GpuHostPowerModelLinear
(
hostMaxPower
,
hostStaticPowerPercent
);
// Video Card Selection Policy
// Video Card Selection Policy
VideoCardAllocationPolicy
videoCardAllocationPolicy
=
new
VideoCardAllocationPolicy
Null
(
videoCards
);
VideoCardAllocationPolicy
videoCardAllocationPolicy
=
new
VideoCardAllocationPolicy
BreadthFirst
(
videoCards
);
PowerGpuHost
newHost
=
new
PowerGpuHost
(
hostId
,
GpuHostTags
.
DUAL_INTEL_XEON_E5_2620_V3
,
PowerGpuHost
newHost
=
new
PowerGpuHost
(
hostId
,
GpuHostTags
.
DUAL_INTEL_XEON_E5_2620_V3
,
new
RamProvisionerSimple
(
ram
),
new
BwProvisionerSimple
(
bw
),
storage
,
peList
,
vmScheduler
,
new
RamProvisionerSimple
(
ram
),
new
BwProvisionerSimple
(
bw
),
storage
,
peList
,
vmScheduler
,
...
@@ -363,8 +364,8 @@ public class CloudSimGpuExample5 {
...
@@ -363,8 +364,8 @@ public class CloudSimGpuExample5 {
// We need to create a Datacenter object.
// We need to create a Datacenter object.
PowerGpuDatacenter
datacenter
=
null
;
PowerGpuDatacenter
datacenter
=
null
;
try
{
try
{
datacenter
=
new
PowerGpuDatacenter
(
name
,
characteristics
,
datacenter
=
new
PowerGpuDatacenter
(
name
,
characteristics
,
new
GpuVmAllocationPolicySimple
(
hostList
),
new
GridGpuVmAllocationPolicyBreadthFirst
(
hostList
),
storageList
,
schedulingInterval
);
storageList
,
schedulingInterval
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
...
...
modules/cloudsim/src/main/java/org/cloudbus/cloudsim/gpu/hardware_assisted/grid/GridGpuVmAllocationPolicyBreadthFirst.java
deleted
100644 → 0
View file @
b42f823c
package
org
.
cloudbus
.
cloudsim
.
gpu
.
hardware_assisted
.
grid
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
org.apache.commons.lang3.NotImplementedException
;
import
org.apache.commons.lang3.tuple.Pair
;
import
org.cloudbus.cloudsim.Host
;
import
org.cloudbus.cloudsim.Vm
;
import
org.cloudbus.cloudsim.gpu.GpuHost
;
import
org.cloudbus.cloudsim.gpu.GpuVm
;
import
org.cloudbus.cloudsim.gpu.GpuVmAllocationPolicy
;
import
org.cloudbus.cloudsim.gpu.Pgpu
;
import
org.cloudbus.cloudsim.gpu.Vgpu
;
import
org.cloudbus.cloudsim.gpu.VideoCard
;
import
org.cloudbus.cloudsim.gpu.allocation.VideoCardAllocationPolicy
;
import
org.cloudbus.cloudsim.gpu.allocation.VideoCardAllocationPolicyNull
;
import
org.cloudbus.cloudsim.gpu.selection.PgpuSelectionPolicy
;
import
org.cloudbus.cloudsim.gpu.selection.PgpuSelectionPolicyNull
;
public
class
GridGpuVmAllocationPolicyBreadthFirst
extends
GpuVmAllocationPolicy
{
/**
* This class extends {@link GpuVmAllocationPolicy} to implement breadth-first
* policy and enforce homogeneous vGPU allocation restriction of NVIDIA GRID
* technology according to NVIDIA documents.
*
* <b>Note</b>: This class performs a global placement, so classes required for
* hierarchical placement that extend or implement
* {@link VideoCardAllocationPolicy} and {@link PgpuSelectionPolicy} can be set
* to {@link VideoCardAllocationPolicyNull} and {@link PgpuSelectionPolicyNull}
* respectively. Otherwise, they are ignored.
*
* @author Ahmad Siavashi
*
*/
private
Map
<
GpuHost
,
List
<
Pair
<
Pgpu
,
Integer
>>>
gpuHostPgpus
=
new
HashMap
<>();
private
Map
<
Pgpu
,
Integer
>
pgpuProfileMap
=
new
HashMap
<>();
protected
static
final
Integer
EMPTY
=
0
;
public
GridGpuVmAllocationPolicyBreadthFirst
(
List
<?
extends
Host
>
list
)
{
super
(
list
);
for
(
GpuHost
gpuHost
:
getGpuHostList
())
{
gpuHostPgpus
.
put
(
gpuHost
,
new
ArrayList
<>());
for
(
VideoCard
videoCard
:
gpuHost
.
getVideoCardAllocationPolicy
().
getVideoCards
())
{
for
(
Pgpu
pgpu
:
videoCard
.
getVgpuScheduler
().
getPgpuList
())
{
gpuHostPgpus
.
get
(
gpuHost
).
add
(
Pair
.
of
(
pgpu
,
EMPTY
));
}
}
}
}
@Override
protected
void
deallocateGpuForVgpu
(
Vgpu
vgpu
)
{
Host
host
=
vgpu
.
getVm
().
getHost
();
Pgpu
pgpu
=
vgpu
.
getVideoCard
().
getVgpuScheduler
().
getPgpuForVgpu
(
vgpu
);
super
.
deallocateGpuForVgpu
(
vgpu
);
List
<
Pair
<
Pgpu
,
Integer
>>
pgpuEntities
=
gpuHostPgpus
.
get
(
host
);
Pair
<
Pgpu
,
Integer
>
pgpuEntity
=
pgpuEntities
.
stream
().
filter
(
x
->
x
.
getKey
()
==
pgpu
).
findFirst
().
get
();
pgpuEntities
.
remove
(
pgpuEntity
);
pgpuEntities
.
add
(
Pair
.
of
(
pgpuEntity
.
getKey
(),
pgpuEntity
.
getValue
()
-
1
));
if
(
pgpuEntity
.
getKey
().
getGddramProvisioner
().
getAvailableGddram
()
==
pgpuEntity
.
getKey
()
.
getGddramProvisioner
().
getGddram
())
{
pgpuProfileMap
.
remove
(
pgpuEntity
.
getKey
());
}
}
@Override
public
Map
<
GpuVm
,
Boolean
>
allocateHostForVms
(
List
<
GpuVm
>
vms
)
{
Map
<
GpuVm
,
Boolean
>
results
=
new
HashMap
<
GpuVm
,
Boolean
>();
for
(
GpuVm
vm
:
vms
)
{
boolean
result
=
allocateHostForVm
(
vm
);
results
.
put
(
vm
,
result
);
}
return
results
;
}
protected
boolean
allocateGpuHostForGpuVm
(
GpuVm
vm
)
{
for
(
GpuHost
gpuHost
:
getGpuHostList
())
{
List
<
Pair
<
Pgpu
,
Integer
>>
pgpuEntities
=
gpuHostPgpus
.
get
(
gpuHost
);
sortPgpusList
(
pgpuEntities
);
boolean
result
=
allocateHostForVm
(
vm
,
gpuHost
);
if
(
result
)
{
for
(
Pair
<
Pgpu
,
Integer
>
pgpuEntity
:
pgpuEntities
)
{
if
(
pgpuProfileMap
.
getOrDefault
(
pgpuEntity
.
getKey
(),
vm
.
getVgpu
().
getGddram
())
!=
vm
.
getVgpu
()
.
getGddram
())
{
continue
;
}
if
(
allocateGpuHostForVgpu
(
vm
.
getVgpu
(),
gpuHost
,
pgpuEntity
.
getKey
()))
{
pgpuEntities
.
remove
(
pgpuEntity
);
pgpuEntities
.
add
(
Pair
.
of
(
pgpuEntity
.
getKey
(),
pgpuEntity
.
getValue
()
+
1
));
pgpuProfileMap
.
put
(
pgpuEntity
.
getLeft
(),
vm
.
getVgpu
().
getGddram
());
return
true
;
}
}
deallocateHostForVm
(
vm
);
}
}
return
false
;
}
protected
void
sortPgpusList
(
List
<
Pair
<
Pgpu
,
Integer
>>
pgpuList
)
{
Collections
.
sort
(
pgpuList
,
new
Comparator
<
Pair
<
Pgpu
,
Integer
>>()
{
public
int
compare
(
Pair
<
Pgpu
,
Integer
>
p1
,
Pair
<
Pgpu
,
Integer
>
p2
)
{
return
Integer
.
compare
(
p1
.
getValue
(),
p2
.
getValue
());
};
});
}
@Override
public
boolean
allocateHostForVm
(
Vm
vm
)
{
GpuVm
gpuVm
=
(
GpuVm
)
vm
;
if
(!
gpuVm
.
hasVgpu
())
{
for
(
Host
host
:
getHostList
())
{
boolean
result
=
allocateHostForVm
(
vm
,
host
);
if
(
result
)
{
return
true
;
}
}
}
else
{
return
allocateGpuHostForGpuVm
(
gpuVm
);
}
return
false
;
}
@Override
protected
boolean
allocateGpuForVgpu
(
Vgpu
vgpu
,
GpuHost
gpuHost
)
{
throw
new
NotImplementedException
(
"not implemented"
);
}
}
modules/cloudsim/src/main/java/org/cloudbus/cloudsim/gpu/hardware_assisted/grid/GridGpuVmAllocationPolicyDepthFirst.java
deleted
100644 → 0
View file @
b42f823c
package
org
.
cloudbus
.
cloudsim
.
gpu
.
hardware_assisted
.
grid
;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.List
;
import
org.apache.commons.lang3.tuple.Pair
;
import
org.cloudbus.cloudsim.Host
;
import
org.cloudbus.cloudsim.gpu.Pgpu
;
import
org.cloudbus.cloudsim.gpu.allocation.VideoCardAllocationPolicy
;
import
org.cloudbus.cloudsim.gpu.allocation.VideoCardAllocationPolicyNull
;
import
org.cloudbus.cloudsim.gpu.selection.PgpuSelectionPolicy
;
import
org.cloudbus.cloudsim.gpu.selection.PgpuSelectionPolicyNull
;
/**
* This class extends {@link GridGpuVmAllocationPolicyBreadthFirst} to implement
* depth-first policy and enforce homogeneous vGPU allocation restriction of
* NVIDIA GRID technology according to NVIDIA documents.
*
* <b>Note</b>: This class performs a global placement, so classes required for
* hierarchical placement that extend or implement
* {@link VideoCardAllocationPolicy} and {@link PgpuSelectionPolicy} can be set
* to {@link VideoCardAllocationPolicyNull} and {@link PgpuSelectionPolicyNull}
* respectively. Otherwise, they are ignored.
*
* @author Ahmad Siavashi
*
*/
public
class
GridGpuVmAllocationPolicyDepthFirst
extends
GridGpuVmAllocationPolicyBreadthFirst
{
public
GridGpuVmAllocationPolicyDepthFirst
(
List
<?
extends
Host
>
list
)
{
super
(
list
);
}
@Override
protected
void
sortPgpusList
(
List
<
Pair
<
Pgpu
,
Integer
>>
pgpuList
)
{
Collections
.
sort
(
pgpuList
,
Collections
.
reverseOrder
(
new
Comparator
<
Pair
<
Pgpu
,
Integer
>>()
{
public
int
compare
(
Pair
<
Pgpu
,
Integer
>
p1
,
Pair
<
Pgpu
,
Integer
>
p2
)
{
return
Integer
.
compare
(
p1
.
getValue
(),
p2
.
getValue
());
};
}));
}
}
modules/cloudsim/src/main/java/org/cloudbus/cloudsim/gpu/hardware_assisted/grid/GridPerformanceVgpuSchedulerFairShare.java
deleted
100644 → 0
View file @
b42f823c
package
org
.
cloudbus
.
cloudsim
.
gpu
.
hardware_assisted
.
grid
;
import
java.util.List
;
import
org.cloudbus.cloudsim.gpu.Pgpu
;
import
org.cloudbus.cloudsim.gpu.Vgpu
;
import
org.cloudbus.cloudsim.gpu.VgpuScheduler
;
import
org.cloudbus.cloudsim.gpu.performance.PerformanceScheduler
;
import
org.cloudbus.cloudsim.gpu.performance.models.PerformanceModel
;
import
org.cloudbus.cloudsim.gpu.selection.PgpuSelectionPolicy
;
/**
* * {@link GridPerformanceVgpuSchedulerFairShare} extends
* {@link org.cloudbus.cloudsim.gpu.VgpuSchedulerFairShare VgpuSchedulerFairShare}
* to add support for
* {@link org.cloudbus.cloudsim.gpu.performance.models.PerformanceModel
* PerformanceModels}.
*
* @author Ahmad Siavashi
*
*/
public
class
GridPerformanceVgpuSchedulerFairShare
extends
GridVgpuSchedulerFairShare
implements
PerformanceScheduler
<
Vgpu
>
{
/** The performance model */
private
PerformanceModel
<
VgpuScheduler
,
Vgpu
>
performanceModel
;
/**
* @see org.cloudbus.cloudsim.gpu.VgpuSchedulerFairShare#VgpuSchedulerFairShare(int,
* List, PgpuSelectionPolicy) VgpuSchedulerFairShare(int, List,
* PgpuSelectionPolicy)
*
* @param performanceModel
* the performance model
*/
public
GridPerformanceVgpuSchedulerFairShare
(
String
videoCardType
,
List
<
Pgpu
>
pgpuList
,
PgpuSelectionPolicy
pgpuSelectionPolicy
,
PerformanceModel
<
VgpuScheduler
,
Vgpu
>
performanceModel
)
{
super
(
videoCardType
,
pgpuList
,
pgpuSelectionPolicy
);
this
.
performanceModel
=
performanceModel
;
}
@Override
public
List
<
Double
>
getAvailableMips
(
Vgpu
vgpu
,
List
<
Vgpu
>
vgpuList
)
{
return
this
.
performanceModel
.
getAvailableMips
(
this
,
vgpu
,
vgpuList
);
}
}
modules/cloudsim/src/main/java/org/cloudbus/cloudsim/gpu/hardware_assisted/grid/GridVgpuSchedulerFairShare.java
→
modules/cloudsim/src/main/java/org/cloudbus/cloudsim/gpu/hardware_assisted/grid/GridVgpuSchedulerFairShare
Ex
.java
View file @
5ed1fc12
package
org
.
cloudbus
.
cloudsim
.
gpu
.
hardware_assisted
.
grid
;
package
org
.
cloudbus
.
cloudsim
.
gpu
.
hardware_assisted
.
grid
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
.Entry
;
import
java.util.Map
;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.cloudbus.cloudsim.gpu.Pgpu
;
import
org.cloudbus.cloudsim.gpu.Pgpu
;
import
org.cloudbus.cloudsim.gpu.Vgpu
;
import
org.cloudbus.cloudsim.gpu.Vgpu
;
import
org.cloudbus.cloudsim.gpu.VgpuSchedulerFairShare
;
import
org.cloudbus.cloudsim.gpu.VgpuScheduler
;
import
org.cloudbus.cloudsim.gpu.performance.PerformanceVgpuSchedulerFairShareEx
;
import
org.cloudbus.cloudsim.gpu.performance.models.PerformanceModel
;
import
org.cloudbus.cloudsim.gpu.selection.PgpuSelectionPolicy
;
import
org.cloudbus.cloudsim.gpu.selection.PgpuSelectionPolicy
;
/**
/**
...
@@ -17,52 +21,50 @@ import org.cloudbus.cloudsim.gpu.selection.PgpuSelectionPolicy;
...
@@ -17,52 +21,50 @@ import org.cloudbus.cloudsim.gpu.selection.PgpuSelectionPolicy;
*
*
* @author Ahmad Siavashi
* @author Ahmad Siavashi
*/
*/
public
class
GridVgpuSchedulerFairShare
extends
VgpuSchedulerFairShare
{
public
class
GridVgpuSchedulerFairShareEx
extends
PerformanceVgpuSchedulerFairShareEx
{
protected
final
String
[]
profiles
;
protected
Map
<
Pgpu
,
String
>
allocationMap
;
/**
/**
* Instantiates a new fair-share vgpu scheduler.
* Instantiates a new fair-share vgpu scheduler.
*
*
* @param pgpulist
* @param pgpulist the list of gpu PEs of the video card where the VgpuScheduler
* the list of gpu PEs of the video card where the VgpuScheduler is
* is associated to.
* associated to.
*/
*/
public
GridVgpuSchedulerFairShare
(
String
videoCardType
,
List
<
Pgpu
>
pgpuList
,
PgpuSelectionPolicy
pgpuSelectionPolicy
)
{
super
(
videoCardType
,
pgpuList
,
pgpuSelectionPolicy
);
}
/**
public
GridVgpuSchedulerFairShareEx
(
String
videoCardType
,
List
<
Pgpu
>
pgpuList
,
* Checks whether the vgpu type is supported by this video card type or not.
PgpuSelectionPolicy
pgpuSelectionPolicy
,
PerformanceModel
<
VgpuScheduler
,
Vgpu
>
performanceModel
,
*
String
[]
profiles
)
{
* @param vgpu
super
(
videoCardType
,
pgpuList
,
pgpuSelectionPolicy
,
performanceModel
);
* the vgpu
this
.
allocationMap
=
new
HashMap
<>();
* @return $true if the video card supports the vgpu type.
this
.
profiles
=
profiles
;
*/
protected
boolean
isVideoCardSuitableForVgpu
(
Vgpu
vgpu
)
{
if
(!
GridVgpuTags
.
isVideoCardSuitable
(
getVideoCardType
(),
vgpu
.
getType
()))
{
return
false
;
}
for
(
Entry
<
Pgpu
,
List
<
Vgpu
>>
entry
:
getPgpuVgpuMap
().
entrySet
())
{
if
(
GridVgpuTags
.
isPgpuSuitable
(
entry
,
vgpu
))
{
return
true
;
}
}
@Override
public
boolean
isSuitable
(
Pgpu
pgpu
,
Vgpu
vgpu
)
{
if
((
this
.
allocationMap
.
getOrDefault
(
pgpu
,
null
)
==
null
||
this
.
allocationMap
.
get
(
pgpu
).
equals
(
vgpu
.
getType
()))
&&
ArrayUtils
.
contains
(
this
.
profiles
,
vgpu
.
getType
()))
{
return
super
.
isSuitable
(
pgpu
,
vgpu
);
}
}
return
false
;
return
false
;
}
}
@Override
@Override
public
boolean
isSuitable
(
final
Vgpu
vgpu
)
{
public
boolean
allocatePgpuForVgpu
(
Pgpu
pgpu
,
Vgpu
vgpu
,
List
<
Double
>
mipsShare
,
int
gddramShare
,
long
bwShare
)
{
if
(!
isVideoCardSuitableForVgpu
(
vgpu
))
{
if
(
super
.
allocatePgpuForVgpu
(
pgpu
,
vgpu
,
mipsShare
,
gddramShare
,
bwShare
))
{
return
false
;
this
.
allocationMap
.
put
(
pgpu
,
vgpu
.
getType
());
return
true
;
}
}
return
super
.
isSuitable
(
vgpu
)
;
return
false
;
}
}
@Override
@Override
public
boolean
allocatePgpuForVgpu
(
final
Vgpu
vgpu
,
final
List
<
Double
>
mipsShare
,
final
int
gddramShare
,
public
void
deallocatePgpuForVgpu
(
Vgpu
vgpu
)
{
final
long
bwShare
)
{
Pgpu
pgpu
=
getPgpuForVgpu
(
vgpu
);
if
(
!
isVideoCardSuitableForVgpu
(
vgpu
)
)
{
if
(
getPgpuVgpuMap
().
get
(
pgpu
).
size
()
==
1
)
{
return
false
;
this
.
allocationMap
.
remove
(
pgpu
)
;
}
}
return
super
.
allocatePgpuForVgpu
(
vgpu
,
mipsShare
,
gddramShare
,
bwShare
);
super
.
deallocatePgpuForVgpu
(
vgpu
);
}
}
}
}
modules/cloudsim/src/main/java/org/cloudbus/cloudsim/gpu/hardware_assisted/grid/GridVgpuSchedulerSpaceShared.java
0 → 100644
View file @
5ed1fc12
package
org
.
cloudbus
.
cloudsim
.
gpu
.
hardware_assisted
.
grid
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.cloudbus.cloudsim.gpu.Pgpu
;
import
org.cloudbus.cloudsim.gpu.Vgpu
;
import
org.cloudbus.cloudsim.gpu.VgpuScheduler
;
import
org.cloudbus.cloudsim.gpu.performance.PerformanceVgpuSchedulerSpaceShared
;
import
org.cloudbus.cloudsim.gpu.performance.models.PerformanceModel
;
import
org.cloudbus.cloudsim.gpu.selection.PgpuSelectionPolicy
;
/**
* A space-shared vGPU Scheduler that considers GRID restrictions.
*
* @author Ahmad Siavashi
*/
public
class
GridVgpuSchedulerSpaceShared
extends
PerformanceVgpuSchedulerSpaceShared
{
protected
final
String
[]
profiles
;
protected
Map
<
Pgpu
,
String
>
allocationMap
;
public
GridVgpuSchedulerSpaceShared
(
String
videoCardType
,
List
<
Pgpu
>
pgpuList
,
PgpuSelectionPolicy
pgpuSelectionPolicy
,
PerformanceModel
<
VgpuScheduler
,
Vgpu
>
performanceModel
,
String
[]
profiles
)
{
super
(
videoCardType
,
pgpuList
,
pgpuSelectionPolicy
,
performanceModel
);
this
.
allocationMap
=
new
HashMap
<>();
this
.
profiles
=
profiles
;
}
@Override
public
boolean
isSuitable
(
Pgpu
pgpu
,
Vgpu
vgpu
)
{
if
((
this
.
allocationMap
.
getOrDefault
(
pgpu
,
null
)
==
null
||
this
.
allocationMap
.
get
(
pgpu
).
equals
(
vgpu
.
getType
()))
&&
ArrayUtils
.
contains
(
this
.
profiles
,
vgpu
.
getType
()))
{
return
super
.
isSuitable
(
pgpu
,
vgpu
);
}
return
false
;
}
@Override
public
boolean
allocatePgpuForVgpu
(
Pgpu
pgpu
,
Vgpu
vgpu
,
List
<
Double
>
mipsShare
,
int
gddramShare
,
long
bwShare
)
{
if
(
super
.
allocatePgpuForVgpu
(
pgpu
,
vgpu
,
mipsShare
,
gddramShare
,
bwShare
))
{
this
.
allocationMap
.
put
(
pgpu
,
vgpu
.
getType
());
return
true
;
}
return
false
;
}
@Override
public
void
deallocatePgpuForVgpu
(
Vgpu
vgpu
)
{
Pgpu
pgpu
=
getPgpuForVgpu
(
vgpu
);
if
(
getPgpuVgpuMap
().
get
(
pgpu
).
size
()
==
1
)
{
this
.
allocationMap
.
remove
(
pgpu
);
}
super
.
deallocatePgpuForVgpu
(
vgpu
);
}
}
modules/cloudsim/src/main/java/org/cloudbus/cloudsim/gpu/hardware_assisted/grid/GridVgpuTags.java
View file @
5ed1fc12
package
org
.
cloudbus
.
cloudsim
.
gpu
.
hardware_assisted
.
grid
;
package
org
.
cloudbus
.
cloudsim
.
gpu
.
hardware_assisted
.
grid
;
import
java.util.List
;
import
java.util.Map.Entry
;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.cloudbus.cloudsim.gpu.BusTags
;
import
org.cloudbus.cloudsim.gpu.BusTags
;
import
org.cloudbus.cloudsim.gpu.GpuTaskScheduler
;
import
org.cloudbus.cloudsim.gpu.GpuTaskScheduler
;
import
org.cloudbus.cloudsim.gpu.Pgpu
;
import
org.cloudbus.cloudsim.gpu.Vgpu
;
import
org.cloudbus.cloudsim.gpu.Vgpu
;
/**
/**
...
@@ -20,34 +15,18 @@ import org.cloudbus.cloudsim.gpu.Vgpu;
...
@@ -20,34 +15,18 @@ import org.cloudbus.cloudsim.gpu.Vgpu;
public
class
GridVgpuTags
{
public
class
GridVgpuTags
{
public
final
static
String
DONT_CARE
=
null
;
/** NVIDIA GRID K1 Profiles */
/** NVIDIA GRID K1 Profiles */
public
final
static
int
MAX_K120Q_VGPUS_PER_K1_PGPU
=
8
;
public
final
static
int
MAX_K140Q_VGPUS_PER_K1_PGPU
=
4
;
public
final
static
int
MAX_K160Q_VGPUS_PER_K1_PGPU
=
2
;
public
final
static
int
MAX_K180Q_VGPUS_PER_K1_PGPU
=
1
;
public
final
static
String
K1_K120Q
=
"NVIDIA K120Q"
;
public
final
static
String
K1_K120Q
=
"NVIDIA K120Q"
;
public
final
static
String
K1_K140Q
=
"NVIDIA K140Q"
;
public
final
static
String
K1_K140Q
=
"NVIDIA K140Q"
;
public
final
static
String
K1_K160Q
=
"NVIDIA K160Q"
;
public
final
static
String
K1_K160Q
=
"NVIDIA K160Q"
;
public
final
static
String
K1_K180Q
=
"NVIDIA K180Q"
;
public
final
static
String
K1_K180Q
=
"NVIDIA K180Q"
;
public
final
static
String
[]
K1_VGPUS
=
{
K1_K120Q
,
K1_K140Q
,
K1_K160Q
,
K1_K180Q
};
/** NVIDIA GRID K2 Profiles */
/** NVIDIA GRID K2 Profiles */
public
final
static
int
MAX_K220Q_VGPUS_PER_K2_PGPU
=
8
;
public
final
static
int
MAX_K240Q_VGPUS_PER_K2_PGPU
=
4
;
public
final
static
int
MAX_K260Q_VGPUS_PER_K2_PGPU
=
2
;
public
final
static
int
MAX_K280Q_VGPUS_PER_K2_PGPU
=
1
;
public
final
static
String
K2_K220Q
=
"NVIDIA K220Q"
;
public
final
static
String
K2_K220Q
=
"NVIDIA K220Q"
;
public
final
static
String
K2_K240Q
=
"NVIDIA K240Q"
;
public
final
static
String
K2_K240Q
=
"NVIDIA K240Q"
;
public
final
static
String
K2_K260Q
=
"NVIDIA K260Q"
;
public
final
static
String
K2_K260Q
=
"NVIDIA K260Q"
;
public
final
static
String
K2_K280Q
=
"NVIDIA K280Q"
;
public
final
static
String
K2_K280Q
=
"NVIDIA K280Q"
;
public
final
static
String
[]
K2_VGPUS
=
{
K2_K220Q
,
K2_K240Q
,
K2_K260Q
,
K2_K280Q
};
/**
/**
* K1 Board Pass through type 1/pGPU, 4/board
* K1 Board Pass through type 1/pGPU, 4/board
*
*
...
@@ -63,7 +42,7 @@ public class GridVgpuTags {
...
@@ -63,7 +42,7 @@ public class GridVgpuTags {
final
int
gddram
=
4096
;
final
int
gddram
=
4096
;
// Bandwidth: 28.5 GB/s
// Bandwidth: 28.5 GB/s
final
long
bw
=
(
long
)
28.5
*
1024
;
final
long
bw
=
(
long
)
28.5
*
1024
;
Vgpu
vgpu
=
new
Vgpu
(
vgpuId
,
mips
,
numberOfPes
,
gddram
,
bw
,
type
,
DONT_CARE
,
scheduler
,
BusTags
.
PCI_E_3_X16_BW
);
Vgpu
vgpu
=
new
Vgpu
(
vgpuId
,
mips
,
numberOfPes
,
gddram
,
bw
,
type
,
null
,
scheduler
,
BusTags
.
PCI_E_3_X16_BW
);
return
vgpu
;
return
vgpu
;
}
}
...
@@ -82,7 +61,7 @@ public class GridVgpuTags {
...
@@ -82,7 +61,7 @@ public class GridVgpuTags {
final
int
gddram
=
2048
;
final
int
gddram
=
2048
;
// Bandwidth: 28.5 GB/s
// Bandwidth: 28.5 GB/s
final
long
bw
=
(
long
)
28.5
*
1024
;
final
long
bw
=
(
long
)
28.5
*
1024
;
Vgpu
vgpu
=
new
Vgpu
(
vgpuId
,
mips
,
numberOfPes
,
gddram
,
bw
,
type
,
DONT_CARE
,
scheduler
,
BusTags
.
PCI_E_3_X16_BW
);
Vgpu
vgpu
=
new
Vgpu
(
vgpuId
,
mips
,
numberOfPes
,
gddram
,
bw
,
type
,
null
,
scheduler
,
BusTags
.
PCI_E_3_X16_BW
);
return
vgpu
;
return
vgpu
;
}
}
...
@@ -101,7 +80,7 @@ public class GridVgpuTags {
...
@@ -101,7 +80,7 @@ public class GridVgpuTags {
final
int
gddram
=
1024
;
final
int
gddram
=
1024
;
// Bandwidth: 28.5 GB/s
// Bandwidth: 28.5 GB/s
final
long
bw
=
(
long
)
28.5
*
1024
;
final
long
bw
=
(
long
)
28.5
*
1024
;
Vgpu
vgpu
=
new
Vgpu
(
vgpuId
,
mips
,
numberOfPes
,
gddram
,
bw
,
type
,
DONT_CARE
,
scheduler
,
BusTags
.
PCI_E_3_X16_BW
);
Vgpu
vgpu
=
new
Vgpu
(
vgpuId
,
mips
,
numberOfPes
,
gddram
,
bw
,
type
,
null
,
scheduler
,
BusTags
.
PCI_E_3_X16_BW
);
return
vgpu
;
return
vgpu
;
}
}
...
@@ -120,7 +99,7 @@ public class GridVgpuTags {
...
@@ -120,7 +99,7 @@ public class GridVgpuTags {
final
int
gddram
=
512
;
final
int
gddram
=
512
;
// Bandwidth: 28.5 GB/s
// Bandwidth: 28.5 GB/s
final
long
bw
=
(
long
)
28.5
*
1024
;
final
long
bw
=
(
long
)
28.5
*
1024
;
Vgpu
vgpu
=
new
Vgpu
(
vgpuId
,
mips
,
numberOfPes
,
gddram
,
bw
,
type
,
DONT_CARE
,
scheduler
,
BusTags
.
PCI_E_3_X16_BW
);
Vgpu
vgpu
=
new
Vgpu
(
vgpuId
,
mips
,
numberOfPes
,
gddram
,
bw
,
type
,
null
,
scheduler
,
BusTags
.
PCI_E_3_X16_BW
);
return
vgpu
;
return
vgpu
;
}
}
...
@@ -139,7 +118,7 @@ public class GridVgpuTags {
...
@@ -139,7 +118,7 @@ public class GridVgpuTags {
final
int
gddram
=
512
;
final
int
gddram
=
512
;
// Bandwidth: 160 GB/s
// Bandwidth: 160 GB/s
final
long
bw
=
160
*
1024
;
final
long
bw
=
160
*
1024
;
Vgpu
vgpu
=
new
Vgpu
(
vgpuId
,
mips
,
numberOfPes
,
gddram
,
bw
,
type
,
DONT_CARE
,
scheduler
,
BusTags
.
PCI_E_3_X16_BW
);
Vgpu
vgpu
=
new
Vgpu
(
vgpuId
,
mips
,
numberOfPes
,
gddram
,
bw
,
type
,
null
,
scheduler
,
BusTags
.
PCI_E_3_X16_BW
);
return
vgpu
;
return
vgpu
;
}
}
...
@@ -158,7 +137,7 @@ public class GridVgpuTags {
...
@@ -158,7 +137,7 @@ public class GridVgpuTags {
final
int
gddram
=
1024
;
final
int
gddram
=
1024
;
// Bandwidth: 160 GB/s
// Bandwidth: 160 GB/s
final
long
bw
=
160
*
1024
;
final
long
bw
=
160
*
1024
;
Vgpu
vgpu
=
new
Vgpu
(
vgpuId
,
mips
,
numberOfPes
,
gddram
,
bw
,
type
,
DONT_CARE
,
scheduler
,
BusTags
.
PCI_E_3_X16_BW
);
Vgpu
vgpu
=
new
Vgpu
(
vgpuId
,
mips
,
numberOfPes
,
gddram
,
bw
,
type
,
null
,
scheduler
,
BusTags
.
PCI_E_3_X16_BW
);
return
vgpu
;
return
vgpu
;
}
}
...
@@ -177,7 +156,7 @@ public class GridVgpuTags {
...
@@ -177,7 +156,7 @@ public class GridVgpuTags {
final
int
gddram
=
2048
;
final
int
gddram
=
2048
;
// Bandwidth: 160 GB/s
// Bandwidth: 160 GB/s
final
long
bw
=
160
*
1024
;
final
long
bw
=
160
*
1024
;
Vgpu
vgpu
=
new
Vgpu
(
vgpuId
,
mips
,
numberOfPes
,
gddram
,
bw
,
type
,
DONT_CARE
,
scheduler
,
BusTags
.
PCI_E_3_X16_BW
);
Vgpu
vgpu
=
new
Vgpu
(
vgpuId
,
mips
,
numberOfPes
,
gddram
,
bw
,
type
,
null
,
scheduler
,
BusTags
.
PCI_E_3_X16_BW
);
return
vgpu
;
return
vgpu
;
}
}
...
@@ -196,75 +175,10 @@ public class GridVgpuTags {
...
@@ -196,75 +175,10 @@ public class GridVgpuTags {
final
int
gddram
=
4096
;
final
int
gddram
=
4096
;
// Bandwidth: 160 GB/s
// Bandwidth: 160 GB/s
final
long
bw
=
160
*
1024
;
final
long
bw
=
160
*
1024
;
Vgpu
vgpu
=
new
Vgpu
(
vgpuId
,
mips
,
numberOfPes
,
gddram
,
bw
,
type
,
DONT_CARE
,
scheduler
,
BusTags
.
PCI_E_3_X16_BW
);
Vgpu
vgpu
=
new
Vgpu
(
vgpuId
,
mips
,
numberOfPes
,
gddram
,
bw
,
type
,
null
,
scheduler
,
BusTags
.
PCI_E_3_X16_BW
);
return
vgpu
;
return
vgpu
;
}
}
/**
* Checks whether a videoCard type supports a given vgpu type or not.
*
* @param videoCardType
* type of the videoCard
* @param vgpuType
* type of the vgpu
* @return $true if the videoCard supports the given vgpu type; $false
* otherwise.
*/
public
static
boolean
isVideoCardSuitable
(
String
videoCardType
,
String
vgpuType
)
{
switch
(
videoCardType
)
{
case
GridVideoCardTags
.
NVIDIA_K1_CARD
:
return
ArrayUtils
.
contains
(
GridVgpuTags
.
K1_VGPUS
,
vgpuType
);
case
GridVideoCardTags
.
NVIDIA_K2_CARD
:
return
ArrayUtils
.
contains
(
GridVgpuTags
.
K2_VGPUS
,
vgpuType
);
default
:
return
true
;
}
}
/**
* Checks whether it is possible to allocate the given vgpu on any of the given
* pgpus or not.
*
* @param currentResidents
* videoCard's pgpus with their current resident vgpus
* @param newVgpu
* the newly arrived vgpu
* @return $true if a suitable pgpu exists for <b>newVgpu</b>; $false otherwise
*/
public
static
boolean
isPgpuSuitable
(
Entry
<
Pgpu
,
List
<
Vgpu
>>
currentResidents
,
Vgpu
newVgpu
)
{
Pgpu
pgpu
=
currentResidents
.
getKey
();
List
<
Vgpu
>
vgpus
=
currentResidents
.
getValue
();
if
(
vgpus
.
isEmpty
())
{
return
true
;
}
else
if
(
vgpus
.
get
(
0
).
getType
()
!=
newVgpu
.
getType
())
{
return
false
;
}
int
currentNumberOfVgpus
=
vgpus
.
size
();
switch
(
newVgpu
.
getType
())
{
case
GridVgpuTags
.
K1_K120Q
:
return
currentNumberOfVgpus
<
GridVgpuTags
.
MAX_K120Q_VGPUS_PER_K1_PGPU
;
case
GridVgpuTags
.
K1_K140Q
:
return
currentNumberOfVgpus
<
GridVgpuTags
.
MAX_K140Q_VGPUS_PER_K1_PGPU
;
case
GridVgpuTags
.
K1_K160Q
:
return
currentNumberOfVgpus
<
GridVgpuTags
.
MAX_K160Q_VGPUS_PER_K1_PGPU
;
case
GridVgpuTags
.
K1_K180Q
:
return
currentNumberOfVgpus
<
GridVgpuTags
.
MAX_K180Q_VGPUS_PER_K1_PGPU
;
case
GridVgpuTags
.
K2_K220Q
:
return
currentNumberOfVgpus
<
GridVgpuTags
.
MAX_K220Q_VGPUS_PER_K2_PGPU
;
case
GridVgpuTags
.
K2_K240Q
:
return
currentNumberOfVgpus
<
GridVgpuTags
.
MAX_K240Q_VGPUS_PER_K2_PGPU
;
case
GridVgpuTags
.
K2_K260Q
:
return
currentNumberOfVgpus
<
GridVgpuTags
.
MAX_K260Q_VGPUS_PER_K2_PGPU
;
case
GridVgpuTags
.
K2_K280Q
:
return
currentNumberOfVgpus
<
GridVgpuTags
.
MAX_K280Q_VGPUS_PER_K2_PGPU
;
}
if
(
pgpu
.
getGddramProvisioner
().
isSuitableForVgpu
(
newVgpu
,
newVgpu
.
getGddram
())
&&
pgpu
.
getBwProvisioner
().
isSuitableForVgpu
(
newVgpu
,
newVgpu
.
getBw
()))
{
return
true
;
}
return
false
;
}
/**
/**
* Singleton class (cannot be instantiated)
* Singleton class (cannot be instantiated)
*/
*/
...
...
modules/cloudsim/src/main/java/org/cloudbus/cloudsim/gpu/hardware_assisted/grid/GridVideoCardTags.java
View file @
5ed1fc12
...
@@ -19,7 +19,6 @@ public class GridVideoCardTags {
...
@@ -19,7 +19,6 @@ public class GridVideoCardTags {
public
final
static
String
NVIDIA_K80_CARD
=
"NVIDIA K80"
;
public
final
static
String
NVIDIA_K80_CARD
=
"NVIDIA K80"
;
public
final
static
String
NVIDIA_M60_CARD
=
"NVIDIA M60"
;
public
final
static
String
NVIDIA_M60_CARD
=
"NVIDIA M60"
;
public
final
static
int
NVIDIA_KEPLER_SMX_CUDA_CORES
=
192
;
public
final
static
int
NVIDIA_KEPLER_SMX_CUDA_CORES
=
192
;
public
final
static
int
NVIDIA_MAXWELL_SMM_CUDA_CORES
=
128
;
public
final
static
int
NVIDIA_MAXWELL_SMM_CUDA_CORES
=
128
;
...
@@ -42,6 +41,9 @@ public class GridVideoCardTags {
...
@@ -42,6 +41,9 @@ public class GridVideoCardTags {
/** 4 x 28.5/s */
/** 4 x 28.5/s */
public
final
static
long
NVIDIA_K1_CARD_BW_PER_BUS
=
(
long
)
28.5
*
1024
;
public
final
static
long
NVIDIA_K1_CARD_BW_PER_BUS
=
(
long
)
28.5
*
1024
;
public
final
static
String
[]
K1_VGPUS
=
{
GridVgpuTags
.
K1_K120Q
,
GridVgpuTags
.
K1_K140Q
,
GridVgpuTags
.
K1_K160Q
,
GridVgpuTags
.
K1_K180Q
};
// NVIDIA GRID K2 Spec
// NVIDIA GRID K2 Spec
/** 225 Watts */
/** 225 Watts */
...
@@ -61,6 +63,9 @@ public class GridVideoCardTags {
...
@@ -61,6 +63,9 @@ public class GridVideoCardTags {
/** 2 x 160.0 GB/s */
/** 2 x 160.0 GB/s */
public
final
static
long
NVIDIA_K2_CARD_BW_PER_BUS
=
160
*
1024
;
public
final
static
long
NVIDIA_K2_CARD_BW_PER_BUS
=
160
*
1024
;
public
final
static
String
[]
K2_VGPUS
=
{
GridVgpuTags
.
K2_K220Q
,
GridVgpuTags
.
K2_K240Q
,
GridVgpuTags
.
K2_K260Q
,
GridVgpuTags
.
K2_K280Q
};
public
static
double
getGpuPeFrequencyFromMips
(
String
type
,
double
mips
)
{
public
static
double
getGpuPeFrequencyFromMips
(
String
type
,
double
mips
)
{
double
frequency
=
mips
;
double
frequency
=
mips
;
switch
(
type
)
{
switch
(
type
)
{
...
...
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