]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
CUDA: fix peer access logic (#3231)
authorJohannes Gäßler <redacted>
Sun, 17 Sep 2023 21:35:20 +0000 (23:35 +0200)
committerGitHub <redacted>
Sun, 17 Sep 2023 21:35:20 +0000 (23:35 +0200)
ggml-cuda.cu

index 5346b9e09519ac98fb6709bd2643a9a3e9d4699c..08428ea3fab3b15f9b67e1a4ff5d576d52a3a629 100644 (file)
@@ -6286,12 +6286,14 @@ void ggml_cuda_set_peer_access(const int n_tokens) {
                 continue;
             }
 
-            int canAccessPeer;
-            CUDA_CHECK(cudaDeviceCanAccessPeer(&canAccessPeer, id, id_other));
-            if (enable_peer_access) {
-                CUDA_CHECK(cudaDeviceEnablePeerAccess(id_other, 0));
-            } else {
-                CUDA_CHECK(cudaDeviceDisablePeerAccess(id_other));
+            int can_access_peer;
+            CUDA_CHECK(cudaDeviceCanAccessPeer(&can_access_peer, id, id_other));
+            if (can_access_peer) {
+                if (enable_peer_access) {
+                    CUDA_CHECK(cudaDeviceEnablePeerAccess(id_other, 0));
+                } else {
+                    CUDA_CHECK(cudaDeviceDisablePeerAccess(id_other));
+                }
             }
         }
     }