From 4b3307a6327af47cb1f188aa3fe3738348ade6bd Mon Sep 17 00:00:00 2001 From: golechwierowicz Date: Mon, 27 Nov 2023 16:05:18 +0000 Subject: [PATCH] Fix get_gpu_name returning empty name. 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'] --- benchmarks/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/benchmarks/util.py b/benchmarks/util.py index 0e62511d5a3..1e1912042da 100644 --- a/benchmarks/util.py +++ b/benchmarks/util.py @@ -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)