From: Howard Su Date: Thu, 15 Jun 2023 17:29:59 +0000 (+0800) Subject: Fix the validation of main device (#1872) X-Git-Tag: gguf-v0.4.0~633 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=64cc19b4fe3df03bc20e520aa111c30cff3a655e;p=pkg%2Fggml%2Fsources%2Fllama.cpp Fix the validation of main device (#1872) --- diff --git a/ggml-cuda.cu b/ggml-cuda.cu index 0565571f..0873e3e5 100644 --- a/ggml-cuda.cu +++ b/ggml-cuda.cu @@ -2366,7 +2366,7 @@ void ggml_cuda_assign_buffers_no_scratch(struct ggml_tensor * tensor) { } void ggml_cuda_set_main_device(int main_device) { - if (main_device > g_device_count) { + if (main_device >= g_device_count) { fprintf(stderr, "warning: cannot set main_device=%d because there are only %d devices. Using device %d instead.\n", main_device, g_device_count, g_main_device); return;