Commit 4388aeb5 authored by Ahmad Siavashi's avatar Ahmad Siavashi

Merge branch 'master' into gpu_remoting

parents 59a0ddda a58c4742
...@@ -176,23 +176,23 @@ public class GpuHost extends Host { ...@@ -176,23 +176,23 @@ public class GpuHost extends Host {
@Override @Override
public double updateVmsProcessing(double currentTime) { public double updateVmsProcessing(double currentTime) {
double smallerTime = Double.MAX_VALUE; double smallerTime = Double.MAX_VALUE;
// Update resident VMs
for (Vm vm : getVmList()) { for (Vm vm : getVmList()) {
GpuVm gpuVm = (GpuVm) vm; double time = vm.updateVmProcessing(currentTime, getVmScheduler().getAllocatedMipsForVm(vm));
double time = gpuVm.updateVmProcessing(currentTime, getVmScheduler().getAllocatedMipsForVm(gpuVm)); if (time > 0.0 && time < smallerTime) {
Vgpu vgpu = gpuVm.getVgpu(); smallerTime = time;
double deviceTime = vgpu.updateTaskProcessing(currentTime, getVideoCardAllocationPolicy()
.getVgpuVideoCardMap().get(vgpu).getVgpuScheduler().getAllocatedMipsForVgpu(vgpu));
if (vgpu.getGpuTaskScheduler().runningTasks() > 0) {
if (time == 0) {
time = deviceTime;
} else {
time = ((deviceTime < time) ? deviceTime : time);
} }
} }
if (getVideoCardAllocationPolicy() != null) {
// Update resident vGPUs
for (Vgpu vgpu : getVideoCardAllocationPolicy().getVgpuVideoCardMap().keySet()) {
double time = vgpu.updateTaskProcessing(currentTime, getVideoCardAllocationPolicy()
.getVgpuVideoCardMap().get(vgpu).getVgpuScheduler().getAllocatedMipsForVgpu(vgpu));
if (time > 0.0 && time < smallerTime) { if (time > 0.0 && time < smallerTime) {
smallerTime = time; smallerTime = time;
} }
} }
}
return smallerTime; return smallerTime;
} }
......
...@@ -18,7 +18,8 @@ import org.cloudbus.cloudsim.provisioners.RamProvisioner; ...@@ -18,7 +18,8 @@ import org.cloudbus.cloudsim.provisioners.RamProvisioner;
/** /**
* {@link PerformanceGpuHost} extends {@link GpuHost} to add support for * {@link PerformanceGpuHost} extends {@link GpuHost} to add support for
* schedulers that implement {@link PerformanceScheduler PerformanceScheduler} interface. * schedulers that implement {@link PerformanceScheduler PerformanceScheduler}
* interface.
* *
* @author Ahmad Siavashi * @author Ahmad Siavashi
* *
...@@ -44,38 +45,36 @@ public class PerformanceGpuHost extends GpuHost { ...@@ -44,38 +45,36 @@ public class PerformanceGpuHost extends GpuHost {
@Override @Override
public double updateVmsProcessing(double currentTime) { public double updateVmsProcessing(double currentTime) {
// To collect Vm that are probably sharing a resource // Update resident VMs
double smallerTime = Double.MAX_VALUE;
for (Vm vm : getVmList()) {
double time = vm.updateVmProcessing(currentTime, getVmScheduler().getAllocatedMipsForVm(vm));
if (time > 0.0 && time < smallerTime) {
smallerTime = time;
}
}
if (getVideoCardAllocationPolicy() != null) {
// To collect VMs that are probably sharing a resource
List<Vgpu> runningVgpus = new ArrayList<Vgpu>(); List<Vgpu> runningVgpus = new ArrayList<Vgpu>();
// Collect running gpu vms // Collect running gpu vms
for (Vm vm : getVmList()) { for (Vgpu vgpu : getVideoCardAllocationPolicy().getVgpuVideoCardMap().keySet()) {
GpuVm gpuVm = (GpuVm) vm; if (vgpu.getGpuTaskScheduler().runningTasks() > 0) {
Vgpu vgpu = gpuVm.getVgpu();
if (vgpu != null && vgpu.getGpuTaskScheduler().runningTasks() > 0) {
runningVgpus.add(vgpu); runningVgpus.add(vgpu);
} }
} }
double smallerTime = Double.MAX_VALUE; // Update resident vGPUs
for (Vm vm : getVmList()) { for (Vgpu vgpu : getVideoCardAllocationPolicy().getVgpuVideoCardMap().keySet()) {
GpuVm gpuVm = (GpuVm) vm;
double time = gpuVm.updateVmProcessing(currentTime, getVmScheduler().getAllocatedMipsForVm(gpuVm));
if (gpuVm.getVgpu() != null) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
PerformanceScheduler<Vgpu> vgpuScheduler = (PerformanceScheduler<Vgpu>) getVideoCardAllocationPolicy() PerformanceScheduler<Vgpu> vgpuScheduler = (PerformanceScheduler<Vgpu>) getVideoCardAllocationPolicy()
.getVgpuVideoCardMap().get(gpuVm.getVgpu()).getVgpuScheduler(); .getVgpuVideoCardMap().get(vgpu).getVgpuScheduler();
double deviceTime = gpuVm.getVgpu().updateTaskProcessing(currentTime, double time = vgpu.updateTaskProcessing(currentTime,
vgpuScheduler.getAvailableMips(gpuVm.getVgpu(), runningVgpus)); vgpuScheduler.getAvailableMips(vgpu, runningVgpus));
if (gpuVm.getVgpu().getGpuTaskScheduler().runningTasks() > 0) {
if (time == 0) {
time = deviceTime;
} else {
time = ((deviceTime < time) ? deviceTime : time);
}
}
}
if (time > 0.0 && time < smallerTime) { if (time > 0.0 && time < smallerTime) {
smallerTime = time; smallerTime = time;
} }
} }
}
return smallerTime; return smallerTime;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment