File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -28,16 +28,19 @@ mutable struct CuGraph
28
28
return obj
29
29
end
30
30
31
- global function capture (f:: Function ; flags= STREAM_CAPTURE_MODE_GLOBAL, throw_error:: Bool = true )
32
- cuStreamBeginCapture_v2 (stream (), flags)
33
-
31
+ global function capture (f:: Function ; flags= STREAM_CAPTURE_MODE_GLOBAL,
32
+ throw_error:: Bool = true )
33
+ # graph capture does not support asynchronous memory operations, so disable the GC
34
+ gc_state = GC. enable (false )
34
35
ctx = current_context ()
35
36
obj = nothing
36
37
try
38
+ cuStreamBeginCapture_v2 (stream (), flags)
37
39
f ()
38
40
finally
39
41
handle_ref = Ref {CUgraph} ()
40
42
err = unchecked_cuStreamEndCapture (stream (), handle_ref)
43
+ GC. enable (gc_state)
41
44
if err == ERROR_STREAM_CAPTURE_INVALIDATED && ! throw_error
42
45
return nothing
43
46
elseif err != CUDA_SUCCESS
You can’t perform that action at this time.
0 commit comments