Skip to content

Commit

Permalink
Fix null pointer bug with populateAccelerators trying to get null App…
Browse files Browse the repository at this point in the history
…leUtil GPU env value
  • Loading branch information
jakki-amd committed Dec 17, 2024
1 parent bc96fa7 commit 29895d9
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,16 @@ private IAcceleratorUtility createAcceleratorUtility() {
private void populateAccelerators() {
if (this.acceleratorUtil != null) {
String envVarName = this.acceleratorUtil.getGpuEnvVariableName();
String requestedAcceleratorIds = System.getenv(envVarName);
LinkedHashSet<Integer> availableAcceleratorIds =
IAcceleratorUtility.parseVisibleDevicesEnv(requestedAcceleratorIds);
this.accelerators =
this.acceleratorUtil.getAvailableAccelerators(availableAcceleratorIds);
if (envVarName != null) {
String requestedAcceleratorIds = System.getenv(envVarName);
LinkedHashSet<Integer> availableAcceleratorIds =
IAcceleratorUtility.parseVisibleDevicesEnv(requestedAcceleratorIds);
this.accelerators =
this.acceleratorUtil.getAvailableAccelerators(availableAcceleratorIds);
} else {
// Handle the case where envVarName is null
this.accelerators = this.acceleratorUtil.getAvailableAccelerators(new LinkedHashSet<>());
}
} else {
this.accelerators = new ArrayList<>();
}
Expand Down

0 comments on commit 29895d9

Please sign in to comment.