Skip to content

Commit

Permalink
CUDA: fix peer access logic (#3231)
Browse files Browse the repository at this point in the history
  • Loading branch information
JohannesGaessler authored Sep 17, 2023
1 parent 111163e commit ee66942
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions ggml-cuda.cu
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}
}
}
Expand Down

0 comments on commit ee66942

Please sign in to comment.