Copilot commented on code in PR #11830:
URL: https://github.com/apache/gluten/pull/11830#discussion_r3720193764


##########
cpp/velox/compute/VeloxBackend.cc:
##########
@@ -120,6 +120,16 @@ ThreadManager* veloxThreadManagerFactory(const 
std::string& kind, std::unique_pt
 void veloxThreadManagerReleaser(ThreadManager* threadManager) {
   delete threadManager;
 }
+
+bool hasCudaRuntimeAndDevice() {
+#ifdef GLUTEN_ENABLE_GPU
+  int count = 0;
+  cudaError_t err = cudaGetDeviceCount(&count);
+  return err == cudaSuccess && count > 0;
+#else
+  return false;
+#endif
+}

Review Comment:
   This doesn’t actually detect absence of the CUDA *runtime* library in the 
common failure mode: if the binary is dynamically linked to libcudart, missing 
CUDA runtime typically fails at load time (before `hasCudaRuntimeAndDevice()` 
can run). If the intent is to support deployments where libcudart/libcuda may 
be missing, consider using explicit runtime loading (e.g., `dlopen`/`dlsym` or 
weak-linking) to probe availability without introducing a hard load-time 
dependency. Otherwise, this is more accurately ‘device/driver availability’ 
rather than ‘runtime detection’.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to