Commit 66e56f20 authored by one's avatar one
Browse files

Get GPU driver version

parent fb44b646
...@@ -307,6 +307,19 @@ class SystemInfo(): # pragma: no cover ...@@ -307,6 +307,19 @@ class SystemInfo(): # pragma: no cover
gpu_info[card][key] = value gpu_info[card][key] = value
return gpu_info return gpu_info
def _get_hygon_driver_version(self):
"""Get Hygon GPU driver version from hy-smi text output.
Returns:
str: Hygon GPU driver version.
"""
output = self._run_cmd('hy-smi --showdriverversion')
for line in output.splitlines():
key, separator, value = line.partition(':')
if separator and key.strip() == 'Driver Version':
return value.strip()
return ''
def get_gpu_hygon(self): def get_gpu_hygon(self):
"""Get hygon gpu info.""" """Get hygon gpu info."""
gpu_dict = { gpu_dict = {
...@@ -350,6 +363,11 @@ class SystemInfo(): # pragma: no cover ...@@ -350,6 +363,11 @@ class SystemInfo(): # pragma: no cover
except Exception: except Exception:
logger.exception('Error: get hygon gpu topology info failed') logger.exception('Error: get hygon gpu topology info failed')
try:
gpu_dict['driver_version'] = self._get_hygon_driver_version()
except Exception:
logger.exception('Error: get hygon gpu driver version failed')
gpu_dict['gpu_count'] = len(gpu_dict['rocm_info']) gpu_dict['gpu_count'] = len(gpu_dict['rocm_info'])
return gpu_dict return gpu_dict
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment