Skip to content

Commit 3bcdff4

Browse files
committed
Proper error propagation for CuArrayDeviceProc
1 parent 72874f8 commit 3bcdff4

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

src/cu.jl

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,22 @@ end
7171

7272
function Dagger.execute!(proc::CuArrayDeviceProc, func, args...)
7373
tls = Dagger.get_tls()
74-
fetch(Threads.@spawn begin
74+
task = Threads.@spawn begin
7575
Dagger.set_tls!(tls)
7676
CUDA.device!(proc.device)
7777
CUDA.@sync func(args...)
78-
end)
78+
end
79+
try
80+
fetch(task)
81+
catch err
82+
@static if VERSION >= v"1.1"
83+
stk = Base.catch_stack(task)
84+
err, frames = stk[1]
85+
rethrow(CapturedException(err, frames))
86+
else
87+
rethrow(task.result)
88+
end
89+
end
7990
end
8091
Base.show(io::IO, proc::CuArrayDeviceProc) =
8192
print(io, "CuArrayDeviceProc on worker $(proc.owner), device $(proc.device), uuid $(proc.device_uuid)")

0 commit comments

Comments
 (0)