Skip to content

Commit

Permalink
Decode output of nvmlDeviceGetName to avoid JSON serialize issue (#240
Browse files Browse the repository at this point in the history
)
  • Loading branch information
KeitaW authored Aug 15, 2024
1 parent cb30120 commit fd1d0f8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion optimum_benchmark/system_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ def get_gpus():
pynvml.nvmlInit()
for i in range(pynvml.nvmlDeviceGetCount()):
handle = pynvml.nvmlDeviceGetHandleByIndex(i)
gpus.append(pynvml.nvmlDeviceGetName(handle))
gpu = pynvml.nvmlDeviceGetName(handle)
gpu = gpu.decode("utf-8") if isinstance(gpu, bytes) else gpu # Older pynvml may return bytes
gpus.append(gpu)
pynvml.nvmlShutdown()

elif is_rocm_system():
Expand Down

0 comments on commit fd1d0f8

Please sign in to comment.