CUDA: fix peer access logic (#3231)

This commit is contained in:
Johannes Gäßler 2023-09-17 23:35:20 +02:00 committed by GitHub
parent 111163e246
commit ee66942d7e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6286,12 +6286,14 @@ void ggml_cuda_set_peer_access(const int n_tokens) {
continue; continue;
} }
int canAccessPeer; int can_access_peer;
CUDA_CHECK(cudaDeviceCanAccessPeer(&canAccessPeer, id, id_other)); CUDA_CHECK(cudaDeviceCanAccessPeer(&can_access_peer, id, id_other));
if (enable_peer_access) { if (can_access_peer) {
CUDA_CHECK(cudaDeviceEnablePeerAccess(id_other, 0)); if (enable_peer_access) {
} else { CUDA_CHECK(cudaDeviceEnablePeerAccess(id_other, 0));
CUDA_CHECK(cudaDeviceDisablePeerAccess(id_other)); } else {
CUDA_CHECK(cudaDeviceDisablePeerAccess(id_other));
}
} }
} }
} }