]> git.djapps.eu Git - pkg/ggml/sources/ggml/commitdiff
cuda : print the returned error when CUDA initialization fails (llama/6185)
authorslaren <redacted>
Wed, 20 Mar 2024 20:03:26 +0000 (21:03 +0100)
committerGeorgi Gerganov <redacted>
Wed, 27 Mar 2024 11:20:00 +0000 (13:20 +0200)
src/ggml-cuda.cu

index e70b79c300a267fc9ccdf98359169bcec87d4519..24af9f671f97a39f0c0c0349ed5a988d8f05343b 100644 (file)
@@ -294,8 +294,9 @@ static ggml_cuda_device_info ggml_cuda_init() {
 
     ggml_cuda_device_info info = {};
 
-    if (cudaGetDeviceCount(&info.device_count) != cudaSuccess) {
-        fprintf(stderr, "%s: no " GGML_CUDA_NAME " devices found, " GGML_CUDA_NAME " will be disabled\n", __func__);
+    cudaError_t err = cudaGetDeviceCount(&info.device_count);
+    if (err != cudaSuccess) {
+        fprintf(stderr, "%s: failed to initialize " GGML_CUDA_NAME ": %s\n", __func__, cudaGetErrorString(err));
         return info;
     }