From b246e9fad41a2151c1e8c6f7c624b35c4a065e96 Mon Sep 17 00:00:00 2001 From: scorpion-26 Date: Tue, 22 Aug 2023 22:10:25 +0200 Subject: [PATCH] Log failure code for Nvidia polling --- src/NvidiaGPU.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/NvidiaGPU.h b/src/NvidiaGPU.h index 4ad0a3e..a2b0cbd 100644 --- a/src/NvidiaGPU.h +++ b/src/NvidiaGPU.h @@ -28,13 +28,13 @@ namespace NvidiaGPU typedef int (*PFN_nvmlInit)(); auto nvmlInit = (PFN_nvmlInit)dlsym(nvmldl, "nvmlInit"); int res = nvmlInit(); - ASSERT(res == 0, "Failed initializing nvml!"); + ASSERT(res == 0, "Failed initializing nvml (Error: " << res << ")!"); // Get GPU handle typedef int (*PFN_nvmlDeviceGetHandle)(uint32_t, void**); auto nvmlDeviceGetHandle = (PFN_nvmlDeviceGetHandle)dlsym(nvmldl, "nvmlDeviceGetHandleByIndex"); res = nvmlDeviceGetHandle(0, &nvmlGPUHandle); - ASSERT(res == 0, "Failed getting device"); + ASSERT(res == 0, "Failed getting device (Error: " << res << ")!"); } inline void Shutdown() @@ -68,7 +68,7 @@ namespace NvidiaGPU auto nvmlDeviceGetUtilizationRates = (PFN_nvmlDeviceGetUtilizationRates)dlsym(nvmldl, "nvmlDeviceGetUtilizationRates"); int res = nvmlDeviceGetUtilizationRates(nvmlGPUHandle, &util); - ASSERT(res == 0, "Failed getting utilization"); + ASSERT(res == 0, "Failed getting utilization (Error: " << res << ")!"); return util; } @@ -84,7 +84,7 @@ namespace NvidiaGPU auto nvmlDeviceGetTemperature = (PFN_nvmlDeviceGetTemperature)dlsym(nvmldl, "nvmlDeviceGetTemperature"); uint32_t temp; int res = nvmlDeviceGetTemperature(nvmlGPUHandle, 0, &temp); - ASSERT(res == 0, "Failed getting temperature"); + ASSERT(res == 0, "Failed getting temperature (Error: " << res << ")!"); return temp; } @@ -100,7 +100,7 @@ namespace NvidiaGPU auto nvmlDeviceGetMemoryInfo = (PFN_nvmlDeviceGetMemoryInfo)dlsym(nvmldl, "nvmlDeviceGetMemoryInfo"); VRAM mem; int res = nvmlDeviceGetMemoryInfo(nvmlGPUHandle, &mem); - ASSERT(res == 0, "Failed getting memory"); + ASSERT(res == 0, "Failed getting memory (Error: " << res << ")!"); return mem; } }