Skip to content

Commit 1c51f98

Browse files
authored
cuda : print the returned error when CUDA initialization fails (#6185)
1 parent f9c7ba3 commit 1c51f98

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

ggml-cuda.cu

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,8 +294,9 @@ static ggml_cuda_device_info ggml_cuda_init() {
294294

295295
ggml_cuda_device_info info = {};
296296

297-
if (cudaGetDeviceCount(&info.device_count) != cudaSuccess) {
298-
fprintf(stderr, "%s: no " GGML_CUDA_NAME " devices found, " GGML_CUDA_NAME " will be disabled\n", __func__);
297+
cudaError_t err = cudaGetDeviceCount(&info.device_count);
298+
if (err != cudaSuccess) {
299+
fprintf(stderr, "%s: failed to initialize " GGML_CUDA_NAME ": %s\n", __func__, cudaGetErrorString(err));
299300
return info;
300301
}
301302

0 commit comments

Comments
 (0)