From: slaren Date: Wed, 20 Mar 2024 20:03:26 +0000 (+0100) Subject: cuda : print the returned error when CUDA initialization fails (llama/6185) X-Git-Tag: upstream/0.0.1642~827 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=2203e7612129eb8f05a7a0e74a0ecb81498269da;p=pkg%2Fggml%2Fsources%2Fggml cuda : print the returned error when CUDA initialization fails (llama/6185) --- diff --git a/src/ggml-cuda.cu b/src/ggml-cuda.cu index e70b79c3..24af9f67 100644 --- a/src/ggml-cuda.cu +++ b/src/ggml-cuda.cu @@ -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; }