Browse Source

Detect too-old cuda driver

"cudart init failure: 35" isn't particularly helpful in the logs.
Daniel Hiltgen 1 year ago
parent
commit
10ed1b6292
2 changed files with 5 additions and 0 deletions
  1. 4 0
      gpu/gpu_info_cudart.c
  2. 1 0
      gpu/gpu_info_cudart.h

+ 4 - 0
gpu/gpu_info_cudart.c

@@ -62,6 +62,10 @@ void cudart_init(char *cudart_lib_path, cudart_init_resp_t *resp) {
     LOG(resp->ch.verbose, "cudaSetDevice err: %d\n", ret);
     UNLOAD_LIBRARY(resp->ch.handle);
     resp->ch.handle = NULL;
+    if (ret == CUDA_ERROR_INSUFFICIENT_DRIVER) {
+      resp->err = strdup("your nvidia driver is too old or missing, please upgrade to run ollama");
+      return;
+    }
     snprintf(buf, buflen, "cudart init failure: %d", ret);
     resp->err = strdup(buf);
     return;

+ 1 - 0
gpu/gpu_info_cudart.h

@@ -7,6 +7,7 @@
 typedef enum cudartReturn_enum {
   CUDART_SUCCESS = 0,
   CUDART_UNSUPPORTED = 1,
+  CUDA_ERROR_INSUFFICIENT_DRIVER = 35,
   // Other values omitted for now...
 } cudartReturn_t;