Skip to content

Commit c3b0428

Browse files
authored
Merge pull request #59 from JuliaGPU/lcw/fixwait
Fix CUDA waiting on CUDA events
2 parents d2c085f + aa51754 commit c3b0428

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/backends/cuda.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ function wait(::CPU, ev::CudaEvent, progress=nothing)
6868
end
6969

7070
# Use this to synchronize between computation using the CuDefaultStream
71-
wait(::CUDA, ev::CudaEvent, progress=nothing) = __enqueue_wait(ev, CUDAdrv.CuDefaultStream())
71+
function wait(::CUDA, ev::CudaEvent, progress=nothing)
72+
CUDAdrv.wait(ev.event, CUDAdrv.CuDefaultStream())
73+
end
7274

7375
# There is no efficient wait for CPU->GPU synchronization, so instead we
7476
# do a CPU wait, and therefore block anyone from submitting more work.

test/test.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,11 @@ if has_cuda_gpu()
183183
wait(event5)
184184
@test event5 isa KernelAbstractions.Event
185185
end
186+
@testset "CUDA wait" begin
187+
event = kernel_empty(CUDA(), 1)(ndrange=1)
188+
wait(CUDA(), event)
189+
@test event isa KernelAbstractions.Event
190+
end
186191
end
187192

188193
@testset "CPU dependencies" begin

0 commit comments

Comments
 (0)