소스 검색

Fix the validation of main device (#1872)

Howard Su 2 년 전
부모
커밋
64cc19b4fe
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      ggml-cuda.cu

+ 1 - 1
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) {
 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",
         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);
                 main_device, g_device_count, g_main_device);
         return;
         return;