Skip to content

Commit

Permalink
cuda : print the returned error when CUDA initialization fails (ggerg…
Browse files Browse the repository at this point in the history
  • Loading branch information
slaren authored and tybalex committed Apr 17, 2024
1 parent c2f0f97 commit 106f664
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ggml-cuda.cu
Expand Up @@ -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;
}

Expand Down

0 comments on commit 106f664

Please sign in to comment.