Skip to content

Commit 90b93f5

Browse files
committed
Fix: only destroy a CUDA stream from its initial context
1 parent cfd9ad6 commit 90b93f5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arrayjit/lib/cuda_backend.cudajit.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ let finalize ctx =
162162
Map.iteri ctx.global_arrays ~f:(fun ~key ~data:ptr ->
163163
if not @@ Option.exists ctx.parent ~f:(fun pc -> Map.mem pc.global_arrays key) then
164164
Cudajit.mem_free ptr);
165-
Cudajit.stream_destroy ctx.device.stream)
165+
if Option.is_none ctx.parent then Cudajit.stream_destroy ctx.device.stream)
166166

167167
let init device =
168168
let ctx =

0 commit comments

Comments
 (0)