Wrap GPU names into multiple lines
This commit is contained in:
@@ -351,13 +351,19 @@ def correct_device_name(name):
|
|||||||
return "AMD " + name;
|
return "AMD " + name;
|
||||||
return name
|
return name
|
||||||
|
|
||||||
def construct_gpu_string(system_info):
|
def get_gpu_names(system_info):
|
||||||
gpu_names = []
|
gpu_names = []
|
||||||
for device in system_info["devices"]:
|
for device in system_info["devices"]:
|
||||||
if device["type"] == "CPU":
|
if device["type"] == "CPU":
|
||||||
continue
|
continue
|
||||||
gpu_names.append(correct_device_name(device["name"]))
|
gpu_names.append(correct_device_name(device["name"]))
|
||||||
return ", " . join(gpu_names)
|
return gpu_names
|
||||||
|
|
||||||
|
def indent_gpu_names(gpu_names):
|
||||||
|
indented_names = []
|
||||||
|
for name in gpu_names:
|
||||||
|
indented_names.append("- " + name)
|
||||||
|
return indented_names
|
||||||
|
|
||||||
def construct_platform_string(system_info):
|
def construct_platform_string(system_info):
|
||||||
"""
|
"""
|
||||||
@@ -368,9 +374,13 @@ def construct_platform_string(system_info):
|
|||||||
system_info["bitness"])
|
system_info["bitness"])
|
||||||
result += "\nCPU: {}" . format(
|
result += "\nCPU: {}" . format(
|
||||||
string_strip_trademark(system_info["cpu_brand"]))
|
string_strip_trademark(system_info["cpu_brand"]))
|
||||||
gpus = construct_gpu_string(system_info)
|
gpu_names = get_gpu_names(system_info)
|
||||||
if gpus:
|
num_gpus = len(gpu_names)
|
||||||
result += "\nGPU(s): {}" . format(gpus)
|
if num_gpus:
|
||||||
|
if num_gpus == 1:
|
||||||
|
result += "\nGPU: {}" . format(gpu_names[0])
|
||||||
|
else:
|
||||||
|
result += "\nGPUs:\n{}" . format("\n" . join(indent_gpu_names(gpu_names)))
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def convert_result_to_json_dict(ctx, results):
|
def convert_result_to_json_dict(ctx, results):
|
||||||
|
Reference in New Issue
Block a user