Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
gilpazintel committed Jan 16, 2025
1 parent 76be591 commit db36030
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions third-party/rsutils/src/rsutilgpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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.");
}
Expand All @@ -35,7 +33,7 @@ namespace rsutils {
}
}
#endif
return retVal;
return gpuDeviceCount > 0;
}
};

Expand Down

0 comments on commit db36030

Please sign in to comment.