Skip to content

Commit

Permalink
Merge pull request kruize#1460 from bharathappali/gpu-update-impl-3
Browse files Browse the repository at this point in the history
KAMS - 3 : Adds support for MIG partition data in Device Details
  • Loading branch information
dinogun authored Feb 5, 2025
2 parents e09c130 + 02ee261 commit 104a5fa
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ public void write(JsonWriter out, DeviceDetails value) throws IOException {
out.name("hostName").value(accelerator.getHostName());
out.name("UUID").value(accelerator.getUUID());
out.name("deviceName").value(accelerator.getDeviceName());
out.name("isMIG").value(accelerator.isMIG());
out.name("isMIGSupported").value(accelerator.isMIGSupported());
out.name("isMIGPartition").value(accelerator.isMIGPartition());
}
// Add for other devices when added

Expand All @@ -41,7 +42,9 @@ public DeviceDetails read(JsonReader in) throws IOException {
String hostName = null;
String UUID = null;
String deviceName = null;
String profile = null;
boolean isMIG = false;
boolean isMIGPartition = false;

in.beginObject();
while (in.hasNext()) {
Expand All @@ -64,17 +67,23 @@ public DeviceDetails read(JsonReader in) throws IOException {
case "deviceName":
deviceName = in.nextString();
break;
case "isMIG":
case "isMIGSupported":
isMIG = in.nextBoolean();
break;
case "isMIGPartition":
isMIGPartition = in.nextBoolean();
break;
case "profile":
profile = in.nextString();
break;
default:
in.skipValue();
}
}
in.endObject();

if (type != null && type.equals(AnalyzerConstants.DeviceType.ACCELERATOR.name())) {
return (DeviceDetails) new AcceleratorDeviceData(modelName, hostName, UUID, deviceName, isMIG);
return (DeviceDetails) new AcceleratorDeviceData(modelName, hostName, UUID, deviceName, profile, isMIG, isMIGPartition);
}
// Add for other device types if implemented in future

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2227,7 +2227,7 @@ private void fetchContainerMetricsBasedOnDataSourceAndProfile(KruizeObject kruiz
metricObject.get(KruizeConstants.JSONKeys.HOSTNAME).getAsString(),
metricObject.get(KruizeConstants.JSONKeys.UUID).getAsString(),
metricObject.get(KruizeConstants.JSONKeys.DEVICE).getAsString(),
true);
null, true, false);

JsonArray valuesArray = resultObject.getAsJsonArray(KruizeConstants.DataSourceConstants
.DataSourceQueryJSONKeys.VALUES);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ public static void markAcceleratorDeviceStatusToContainer(ContainerData containe
metricObject.get(KruizeConstants.JSONKeys.HOSTNAME).getAsString(),
metricObject.get(KruizeConstants.JSONKeys.UUID).getAsString(),
metricObject.get(KruizeConstants.JSONKeys.DEVICE).getAsString(),
isSupportedMig);
null, isSupportedMig, false);


if (null == containerData.getContainerDeviceList()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,25 @@ public class AcceleratorDeviceData implements AcceleratorDeviceDetails {
private final String hostName;
private final String UUID;
private final String deviceName;
private boolean isMIG;
private final String profile;
private boolean isMIGSupported;
private boolean isMIGPartition;

public AcceleratorDeviceData (String modelName, String hostName, String UUID, String deviceName, boolean isMIG) {
public AcceleratorDeviceData (String modelName,
String hostName,
String UUID,
String deviceName,
String profile,
boolean isMIGSupported,
boolean isMIGPartition) {
this.profile = profile;
this.isMIGPartition = isMIGPartition;
this.manufacturer = "NVIDIA";
this.modelName = modelName;
this.hostName = hostName;
this.UUID = UUID;
this.deviceName = deviceName;
this.isMIG = isMIG;
this.isMIGSupported = isMIGSupported;
}

@Override
Expand Down Expand Up @@ -44,12 +54,16 @@ public String getDeviceName() {
return deviceName;
}

public boolean isMIG() {
return isMIG;
public String getProfile() {
return profile;
}

public void setMIG(boolean isMIG) {
this.isMIG = isMIG;
public boolean isMIGPartition() {
return isMIGPartition;
}

public boolean isMIGSupported() {
return isMIGSupported;
}

@Override
Expand Down

0 comments on commit 104a5fa

Please sign in to comment.