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 {
@Override
public double updateVmsProcessing(double currentTime) {
double smallerTime = Double.MAX_VALUE;
// Update resident VMs
for (Vm vm : getVmList()) {
GpuVm gpuVm = (GpuVm) vm;
double time = gpuVm.updateVmProcessing(currentTime, getVmScheduler().getAllocatedMipsForVm(gpuVm));
Vgpu vgpu = gpuVm.getVgpu();
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);
}
}
double time = vm.updateVmProcessing(currentTime, getVmScheduler().getAllocatedMipsForVm(vm));
if (time > 0.0 && time < smallerTime) {
smallerTime = 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) {
smallerTime = time;
}
}
}
return smallerTime;
}
......
......@@ -18,7 +18,8 @@ import org.cloudbus.cloudsim.provisioners.RamProvisioner;
/**
* {@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
*
......@@ -33,7 +34,7 @@ public class PerformanceGpuHost extends GpuHost {
VideoCardAllocationPolicy videoCardAllocationPolicy) {
super(id, type, ramProvisioner, bwProvisioner, storage, peList, vmScheduler, videoCardAllocationPolicy);
}
/**
* @see org.cloudbus.cloudsim.gpu.GpuHost#GpuHost GpuHost
*/
......@@ -44,39 +45,37 @@ public class PerformanceGpuHost extends GpuHost {
@Override
public double updateVmsProcessing(double currentTime) {
// To collect Vm that are probably sharing a resource
List<Vgpu> runningVgpus = new ArrayList<Vgpu>();
// Collect running gpu vms
// Update resident VMs
double smallerTime = Double.MAX_VALUE;
for (Vm vm : getVmList()) {
GpuVm gpuVm = (GpuVm) vm;
Vgpu vgpu = gpuVm.getVgpu();
if (vgpu != null && vgpu.getGpuTaskScheduler().runningTasks() > 0) {
runningVgpus.add(vgpu);
double time = vm.updateVmProcessing(currentTime, getVmScheduler().getAllocatedMipsForVm(vm));
if (time > 0.0 && time < smallerTime) {
smallerTime = time;
}
}
double smallerTime = Double.MAX_VALUE;
for (Vm vm : getVmList()) {
GpuVm gpuVm = (GpuVm) vm;
double time = gpuVm.updateVmProcessing(currentTime, getVmScheduler().getAllocatedMipsForVm(gpuVm));
if (gpuVm.getVgpu() != null) {
if (getVideoCardAllocationPolicy() != null) {
// To collect VMs that are probably sharing a resource
List<Vgpu> runningVgpus = new ArrayList<Vgpu>();
// Collect running gpu vms
for (Vgpu vgpu : getVideoCardAllocationPolicy().getVgpuVideoCardMap().keySet()) {
if (vgpu.getGpuTaskScheduler().runningTasks() > 0) {
runningVgpus.add(vgpu);
}
}
// Update resident vGPUs
for (Vgpu vgpu : getVideoCardAllocationPolicy().getVgpuVideoCardMap().keySet()) {
@SuppressWarnings("unchecked")
PerformanceScheduler<Vgpu> vgpuScheduler = (PerformanceScheduler<Vgpu>) getVideoCardAllocationPolicy()
.getVgpuVideoCardMap().get(gpuVm.getVgpu()).getVgpuScheduler();
double deviceTime = gpuVm.getVgpu().updateTaskProcessing(currentTime,
vgpuScheduler.getAvailableMips(gpuVm.getVgpu(), runningVgpus));
if (gpuVm.getVgpu().getGpuTaskScheduler().runningTasks() > 0) {
if (time == 0) {
time = deviceTime;
} else {
time = ((deviceTime < time) ? deviceTime : time);
}
.getVgpuVideoCardMap().get(vgpu).getVgpuScheduler();
double time = vgpu.updateTaskProcessing(currentTime,
vgpuScheduler.getAvailableMips(vgpu, runningVgpus));
if (time > 0.0 && time < smallerTime) {
smallerTime = time;
}
}
if (time > 0.0 && time < smallerTime) {
smallerTime = time;
}
}
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