This repository was archived by the owner on Aug 7, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
frontend/server/src/main/java/org/pytorch/serve/device Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -71,11 +71,16 @@ private IAcceleratorUtility createAcceleratorUtility() {
7171 private void populateAccelerators () {
7272 if (this .acceleratorUtil != null ) {
7373 String envVarName = this .acceleratorUtil .getGpuEnvVariableName ();
74- String requestedAcceleratorIds = System .getenv (envVarName );
75- LinkedHashSet <Integer > availableAcceleratorIds =
76- IAcceleratorUtility .parseVisibleDevicesEnv (requestedAcceleratorIds );
77- this .accelerators =
78- this .acceleratorUtil .getAvailableAccelerators (availableAcceleratorIds );
74+ if (envVarName != null ) {
75+ String requestedAcceleratorIds = System .getenv (envVarName );
76+ LinkedHashSet <Integer > availableAcceleratorIds =
77+ IAcceleratorUtility .parseVisibleDevicesEnv (requestedAcceleratorIds );
78+ this .accelerators =
79+ this .acceleratorUtil .getAvailableAccelerators (availableAcceleratorIds );
80+ } else {
81+ // Handle the case where envVarName is null
82+ this .accelerators = this .acceleratorUtil .getAvailableAccelerators (new LinkedHashSet <>());
83+ }
7984 } else {
8085 this .accelerators = new ArrayList <>();
8186 }
You can’t perform that action at this time.
0 commit comments