Commit 65eb3e16 authored by Ahmad Siavashi's avatar Ahmad Siavashi

Add isGpuEquipped method to GpuHost

Update classes to use isGpuEquipped method
parent c3a72367
......@@ -443,7 +443,7 @@ public class CloudSimGpuExample5 {
at.addRow("Host " + depth, dft.format(datacenter.getHostCpuEnergyMap().get(host)).toString() + " / "
+ dft.format(datacenter.getHostEnergyMap().get(host)).toString());
at.addRule();
if (host.getVideoCardAllocationPolicy() != null) {
if (host.isGpuEquipped()) {
for (PowerVideoCard videoCard : (List<PowerVideoCard>) host.getVideoCardAllocationPolicy()
.getVideoCards()) {
depth = "#" + videoCard.getId() + " / " + depth;
......
......@@ -452,7 +452,7 @@ public class CloudSimGpuExample6 {
at.addRow("Host " + depth, dft.format(datacenter.getHostCpuEnergyMap().get(host)).toString() + " / "
+ dft.format(datacenter.getHostEnergyMap().get(host)).toString());
at.addRule();
if (host.getVideoCardAllocationPolicy() != null) {
if (host.isGpuEquipped()) {
for (PowerVideoCard videoCard : (List<PowerVideoCard>) host.getVideoCardAllocationPolicy()
.getVideoCards()) {
depth = "#" + videoCard.getId() + " / " + depth;
......
......@@ -60,7 +60,7 @@ public class GpuHost extends Host {
public double updateVgpusProcessing(double currentTime) {
double smallerTime = Double.MAX_VALUE;
if (getVideoCardAllocationPolicy() != null) {
if (isGpuEquipped()) {
// Update resident vGPUs
for (Vgpu vgpu : getVideoCardAllocationPolicy().getVgpuVideoCardMap().keySet()) {
double time = vgpu.updateGpuTaskProcessing(currentTime, getVideoCardAllocationPolicy()
......
......@@ -42,7 +42,7 @@ public class PerformanceGpuHost extends GpuHost {
public double updateVgpusProcessing(double currentTime) {
double smallerTime = Double.MAX_VALUE;
if (getVideoCardAllocationPolicy() != null) {
if (isGpuEquipped()) {
List<Vgpu> runningVgpus = new ArrayList<Vgpu>();
for (Vgpu vgpu : getVideoCardAllocationPolicy().getVgpuVideoCardMap().keySet()) {
if (vgpu.getGpuTaskScheduler().runningTasks() > 0) {
......
......@@ -54,7 +54,7 @@ public class PowerGpuDatacenter extends GpuDatacenter {
getHostCpuEnergyMap().put(powerGpuHost, 0.0);
getHostVideoCardEnergyMap().put(powerGpuHost, new HashMap<PowerVideoCard, Double>());
VideoCardAllocationPolicy videoCardAllocationPolicy = powerGpuHost.getVideoCardAllocationPolicy();
if (videoCardAllocationPolicy != null) {
if (powerGpuHost.isGpuEquipped()) {
for (PowerVideoCard videoCard : (List<PowerVideoCard>) videoCardAllocationPolicy.getVideoCards()) {
getHostVideoCardEnergyMap().get(powerGpuHost).put(videoCard, 0.0);
}
......
......@@ -125,7 +125,7 @@ public class PowerGpuHost extends PerformanceGpuHost {
*/
public Map<VideoCard, Double> getCurrentVideoCardsPower() {
Map<VideoCard, Double> videoCardsPower = new HashMap<VideoCard, Double>();
if (getVideoCardAllocationPolicy() != null) {
if (isGpuEquipped()) {
for (VideoCard videoCard : getVideoCardAllocationPolicy().getVideoCards()) {
PowerVideoCard powerVideoCard = (PowerVideoCard) videoCard;
videoCardsPower.put(powerVideoCard, powerVideoCard.getPower());
......
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