You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gluten.apache.org by "Copilot (via GitHub)" <gi...@apache.org> on 2026/08/05 11:33:55 UTC
Re: [PR] [GLUTEN-11828][VL] Add cuda runtime detection [gluten]
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: commits-unsubscribe@gluten.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org