From 88451ac7d82b744cfd69f772da531b5aa91e9b1e Mon Sep 17 00:00:00 2001 From: Marcelo Carneiro do Amaral Date: Wed, 26 Jul 2023 19:12:59 +0900 Subject: [PATCH] accelerator: ignore gpu error of process not found (#829) Signed-off-by: Marcelo Amaral --- pkg/power/accelerator/source/gpu_nvml.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/power/accelerator/source/gpu_nvml.go b/pkg/power/accelerator/source/gpu_nvml.go index 98f6eace85..1ee1bca7fa 100644 --- a/pkg/power/accelerator/source/gpu_nvml.go +++ b/pkg/power/accelerator/source/gpu_nvml.go @@ -114,6 +114,10 @@ func (n *GPUNvml) GetProcessResourceUtilizationPerDevice(device interface{}, sin processUtilizationSample, ret := device.(nvml.Device).GetProcessUtilization(lastUtilizationTimestamp) if ret != nvml.SUCCESS { + if ret == nvml.ERROR_NOT_FOUND { + // ignore the error if there is no process running in the GPU + return nil, nil + } return nil, fmt.Errorf("failed to get processes' utilization on device %v: %v", device, nvml.ErrorString(ret)) }