Commit ad64ecd5 authored by Ahmad Siavashi's avatar Ahmad Siavashi

power model added

parent dc418c00
Pipeline #14 canceled with stages
package org.cloudbus.cloudsim.examples.gpu.lpds;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
public class LpdsWorkload {
@JsonSerialize
@JsonDeserialize
public List<LpdsDatacenter> datacenters;
@JsonSerialize
@JsonDeserialize
public Map<Integer, Integer> gpu_cloudlet_vm_map;
@JsonSerialize
@JsonDeserialize
public List<LpdsGpuCloudlet> gpu_cloudlets;
@JsonSerialize
@JsonDeserialize
public List<LpdsVm> vms;
@JsonSerialize
@JsonDeserialize
public LpdsBroker broker;
}
class LpdsVgpu {
public int type;
public int memory;
}
class LpdsVm {
public int id;
public int num_vcpus;
public String type;
public double ram;
@JsonSerialize
@JsonDeserialize
public LpdsVgpu vgpu;
}
class LpdsGpuTask {
public int block_length;
public int num_blocks;;
public int gddram;
public String gddram_utilization_model;
public String gpu_utilization_model;
}
class LpdsGpuCloudlet {
public int id;
public int length;
public int num_pes;
public String tag;
public String cpu_utilization_model;
@JsonSerialize
@JsonDeserialize
public LpdsGpuTask gpu_task;
}
class LpdsBroker {
public String name;
}
class LpdsDatacenter {
public String name;
public double scheduling_interval;
@JsonSerialize
@JsonDeserialize
public List<LpdsHost> hosts;
public String vm_allocation_policy;
}
class LpdsHost {
public String type;
public int num_pes;
public int pe_mips;
public int ram;
public String video_card_allocation_policy;
@JsonSerialize
@JsonDeserialize
public List<LpdsVideoCard> video_cards;
}
class LpdsVideoCard {
@JsonSerialize
@JsonDeserialize
public LpdsGpu gpu;
public int num_gpus;
public String type;
public String gpu_selection_policy;
}
class LpdsGpu {
public int num_pes;
public int gddram;
public int pe_mips;
}
{
"broker": {
"name": "portal"
},
"datacenters": [
{
"hosts": [
{
"num_pes": 40,
"pe_mips": 46400,
"ram": 60,
"type": "DUAL_INTEL_XEON_E5_2666_V3",
"video_card_allocation_policy": "simple",
"video_cards": []
},
{
"num_pes": 40,
"pe_mips": 46400,
"ram": 60,
"type": "DUAL_INTEL_XEON_E5_2666_V3_DUAL_NVIDIA_M60",
"video_card_allocation_policy": "simple",
"video_cards": [
{
"gpu": {
"gddram": 8192,
"num_pes": 16,
"pe_mips": 142592
},
"gpu_selection_policy": "simple",
"num_gpus": 2,
"type": "Tesla M60"
}
]
}
],
"name": "DC",
"scheduling_interval": 1.0,
"vm_allocation_policy": "simple"
}
],
"gpu_cloudlet_vm_map": {
"0": 0
},
"gpu_cloudlets": [
{
"cpu_utilization_model": "high",
"gpu_task": {
"block_length": 132813,
"gddram": 512,
"gddram_utilization_model": "medium",
"gpu_utilization_model": "low",
"num_blocks": 128
},
"id": 0,
"length": 652977327,
"num_pes": 1,
"tag": "BFS"
}
],
"vms": [
{
"id": 0,
"num_vcpus": 2,
"ram": 3.75,
"type": 1,
"vgpu": {
"memory": 1024,
"type": null
}
}
]
}
\ No newline at end of file
package org.cloudbus.cloudsim.gpu.power.models;
import java.util.Map;
import java.util.Map.Entry;
import org.cloudbus.cloudsim.gpu.Pgpu;
/**
* Implements a power model where the power consumption is linear to resource
* usage and frequency.
*
* @author Ahmad Siavashi
*
*/
public class VideoCardPowerModelLinear implements VideoCardPowerModel {
private boolean powerGate;
private double a3, a2, a1, a0;
private int frequency;
/**
* A power model where the power consumption is linear to resource usage and
* frequency.
*
* @param frequency
* nominal frequency of the device in MHz
* @param a3
* constant parameter of the model
* @param a2
* constant parameter of the model
*
* @param a1
* constant parameter of the model
*
* @param a0
* constant parameter of the model
*
* @param powerGate
* power gates individual GPUs if they are idle
*/
public VideoCardPowerModelLinear(int frequency, double a3, double a2, double a1, double a0, boolean powerGate) {
this.powerGate = powerGate;
this.frequency = frequency;
this.a3 = a3;
this.a2 = a2;
this.a1 = a1;
this.a0 = a0;
}
@Override
public double getPower(Map<Pgpu, Double> pgpuUtilization, Map<Pgpu, Double> gddramUtilization,
double bwUtilization) {
double totalVideoCardPower = 0.0;
for (Entry<Pgpu, Double> entry : pgpuUtilization.entrySet()) {
Double utilization = entry.getValue();
double pgpuPower = 0.0;
if (!this.powerGate || this.powerGate && utilization > 0.0) {
pgpuPower = powerFunction(frequency, utilization);
}
totalVideoCardPower += pgpuPower;
}
return totalVideoCardPower;
}
/**
*
* @param f
* pgpu frequency
* @param u
* pgpu utilization
* @return power consumption for the given f and u
*/
protected double powerFunction(double f, double u) {
u *= 100;
double power = a3 * f * u + a2 * f + a1 * u + a0;
return power;
}
}
......@@ -8,7 +8,7 @@ import org.cloudbus.cloudsim.gpu.Pgpu;
import org.cloudbus.cloudsim.gpu.VideoCardTags;
/**
* Implements a power model for NVIDIA GRID K1 video card where the power consumption is linear to resource
* Implements a process variation-aware power model for NVIDIA GRID K1 video card where the power consumption is linear to resource
* usage and frequency.
*
* @author Ahmad Siavashi
......
......@@ -8,7 +8,7 @@ import org.cloudbus.cloudsim.gpu.Pgpu;
import org.cloudbus.cloudsim.gpu.VideoCardTags;
/**
* Implements a power model for NVIDIA GRID K2 video card where the power
* Implements a process variation-aware power model for NVIDIA GRID K2 video card where the power
* consumption is linear to resource usage and frequency.
*
* @author Ahmad Siavashi
......
......@@ -11,6 +11,7 @@ import org.cloudbus.cloudsim.gpu.Pgpu;
import org.cloudbus.cloudsim.gpu.Vgpu;
import org.cloudbus.cloudsim.gpu.VgpuScheduler;
import org.cloudbus.cloudsim.gpu.VgpuSchedulerFairShare;
import org.cloudbus.cloudsim.gpu.performance.PerformanceScheduler;
import org.cloudbus.cloudsim.gpu.performance.PerformanceVgpuSchedulerFairShare;
import org.cloudbus.cloudsim.gpu.performance.models.PerformanceModel;
import org.cloudbus.cloudsim.gpu.selection.PgpuSelectionPolicy;
......@@ -21,7 +22,7 @@ import org.cloudbus.cloudsim.util.MathUtil;
*
* @author Ahmad Siavashi
*/
public class RemoteVgpuSchedulerFairShare extends PerformanceVgpuSchedulerFairShare {
public class RemoteVgpuSchedulerFairShare extends PerformanceVgpuSchedulerFairShare implements PerformanceScheduler<Vgpu> {
/**
* Extends {@link VgpuSchedulerFairShare} to add support for GPU remoting.
......
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