From db36030f358e506c8c5f1a3a2c32dd807bab4bb3 Mon Sep 17 00:00:00 2001 From: gilpazintel Date: Thu, 16 Jan 2025 12:31:49 +0200 Subject: [PATCH] bug fix --- third-party/rsutils/src/rsutilgpu.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/third-party/rsutils/src/rsutilgpu.cpp b/third-party/rsutils/src/rsutilgpu.cpp index 9cf6b269fb..ae84cc6c33 100644 --- a/third-party/rsutils/src/rsutilgpu.cpp +++ b/third-party/rsutils/src/rsutilgpu.cpp @@ -13,9 +13,8 @@ namespace rsutils { class GPUChecker { public: static bool is_gpu_available() { - bool retVal = false; -#ifdef RS2_USE_CUDA static int gpuDeviceCount = -1; +#ifdef RS2_USE_CUDA if (gpuDeviceCount < 0) { @@ -24,8 +23,7 @@ namespace rsutils { LOG_ERROR("cudaGetDeviceCount failed: " << cudaGetErrorString(error)); gpuDeviceCount = 0; // Set to 0 to avoid repeated error logging } - retVal = gpuDeviceCount > 0; - if (retVal == false) + if (gpuDeviceCount <= 0) { LOG_INFO("Avoid CUDA execution as no NVIDIA GPU found."); } @@ -35,7 +33,7 @@ namespace rsutils { } } #endif - return retVal; + return gpuDeviceCount > 0; } };