]> git.djapps.eu Git - pkg/ggml/sources/ggml/commitdiff
ggml-cuda : fix usage without CUDA devices (#627)
authorslaren <redacted>
Fri, 1 Dec 2023 20:05:59 +0000 (21:05 +0100)
committerGitHub <redacted>
Fri, 1 Dec 2023 20:05:59 +0000 (21:05 +0100)
src/ggml-cuda.cu

index 6b194c2ad2c858fbb512e2fab44db378221c563a..9a8e40eb80efa3f010553f52b620facb6b1157a9 100644 (file)
@@ -8135,7 +8135,9 @@ bool ggml_cuda_compute_forward(struct ggml_compute_params * params, struct ggml_
 
 int ggml_cuda_get_device_count() {
     int device_count;
-    CUDA_CHECK(cudaGetDeviceCount(&device_count));
+    if (cudaGetDeviceCount(&device_count) != cudaSuccess) {
+        return 0;
+    }
     return device_count;
 }