From 69043ee42f4c6e08a12662da4d0537b721eeee84 Mon Sep 17 00:00:00 2001 From: Jun Tian Date: Thu, 8 Aug 2024 15:37:59 +0800 Subject: [PATCH] Address a corner case when establishing p2p access (#2457) Co-authored-by: Tim Besard --- lib/cudadrv/context.jl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/cudadrv/context.jl b/lib/cudadrv/context.jl index 4e74dddf15..8b3c5071c1 100644 --- a/lib/cudadrv/context.jl +++ b/lib/cudadrv/context.jl @@ -402,8 +402,13 @@ function maybe_enable_peer_access(src::CuDevice, dst::CuDevice) enable_peer_access(context(dst)) peer_access[][src_idx, dst_idx] = 1 catch err - @warn "Enabling peer-to-peer access between $src and $dst failed; please file an issue." exception=(err,catch_backtrace()) - peer_access[][src_idx, dst_idx] = -1 + if err.code == CUDA.CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED + @warn "Peer-to-peer access between $src and $dst was unexpectedly already enabled" + CUDA.peer_access[][src_idx, dst_idx] = 1 + else + @warn "Enabling peer-to-peer access between $src and $dst failed; please file an issue." exception=(err,catch_backtrace()) + CUDA.peer_access[][src_idx, dst_idx] = -1 + end end end else