diff --git a/amdsmi_cli/amdsmi_commands.py b/amdsmi_cli/amdsmi_commands.py index cd88dfbd28..6c8e95398e 100644 --- a/amdsmi_cli/amdsmi_commands.py +++ b/amdsmi_cli/amdsmi_commands.py @@ -50,6 +50,11 @@ class AMDSMICommands(): sys.exit(-1) else: raise e + + if len(self.device_handles) == 0: + logging.error('Unable to detect any devices, check if driver is initialized (amdgpu not found in modules)') + sys.exit(-1) + self.stop = '' diff --git a/amdsmi_cli/amdsmi_helpers.py b/amdsmi_cli/amdsmi_helpers.py index cb5f7cf1bb..9e08bfbc70 100644 --- a/amdsmi_cli/amdsmi_helpers.py +++ b/amdsmi_cli/amdsmi_helpers.py @@ -154,6 +154,10 @@ class AMDSMIHelpers(): else: raise e + if len(device_handles) == 0: + logging.error('Unable to find any devices, check if driver is initialized (amdgpu not found in modules)') + sys.exit(-1) + # Handle spacing for the gpu_choices_str max_padding = int(math.log10(len(device_handles))) + 1