Skip to content

Commit

Permalink
Fix get_gpu_name returning empty name. (#5925)
Browse files Browse the repository at this point in the history
Repro in python shell
>>> subprocess.check_output(["nvidia-smi", "--query-gpu=gpu_name", "--format=csv"], encoding='utf-8').split("\n")[1:]
['NVIDIA A100-SXM4-40GB', '']

Tested fix
>>> subprocess.check_output(["nvidia-smi", "--query-gpu=gpu_name", "--format=csv"], encoding='utf-8').split("\n")[1:-1]
['NVIDIA A100-SXM4-40GB']
  • Loading branch information
golechwierowicz authored Nov 28, 2023
1 parent cfb3617 commit 16a40cc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion benchmarks/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def get_cpu_name():
def get_gpu_name():
gpu_names = subprocess.check_output(
["nvidia-smi", "--query-gpu=gpu_name", "--format=csv"],
encoding='utf-8').split("\n")[1:]
encoding='utf-8').split("\n")[1:-1]
if len(gpu_names) == 1:
return gpu_names[0]
return "One of " + ", ".join(gpu_names)
Expand Down

0 comments on commit 16a40cc

Please sign in to comment.