Skip to content

Commit 60dfea1

Browse files
authored
Fix problem with getting NVidia HW (#76)
1 parent 051461a commit 60dfea1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,14 @@ def get_hw_parameters() -> Dict[str, Union[Dict[str, Any], float]]:
117117
'nvidia-smi --query-gpu=name,memory.total,driver_version,pstate '
118118
'--format=csv,noheader')
119119
gpu_info_arr = gpu_info.split(', ')
120+
if len(gpu_info_arr) == 0:
121+
return hw_params
120122
hw_params['GPU Nvidia'] = {
121123
'Name': gpu_info_arr[0],
122124
'Memory size': gpu_info_arr[1],
123125
'Performance mode': gpu_info_arr[3]
124126
}
125-
except (FileNotFoundError, json.JSONDecodeError):
127+
except (FileNotFoundError, json.JSONDecodeError, IndexError):
126128
pass
127129
return hw_params
128130

0 commit comments

Comments
 (0)