From 10ed1b6292d552ecb3a062d7ca334f2dd2f75e17 Mon Sep 17 00:00:00 2001 From: Daniel Hiltgen Date: Thu, 28 Mar 2024 09:27:17 -0700 Subject: [PATCH] Detect too-old cuda driver "cudart init failure: 35" isn't particularly helpful in the logs. --- gpu/gpu_info_cudart.c | 4 ++++ gpu/gpu_info_cudart.h | 1 + 2 files changed, 5 insertions(+) diff --git a/gpu/gpu_info_cudart.c b/gpu/gpu_info_cudart.c index 9f69f845..ef13f5c0 100644 --- a/gpu/gpu_info_cudart.c +++ b/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; diff --git a/gpu/gpu_info_cudart.h b/gpu/gpu_info_cudart.h index 476e7555..492704a8 100644 --- a/gpu/gpu_info_cudart.h +++ b/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;