Skip to content
This repository was archived by the owner on Mar 12, 2021. It is now read-only.

Commit 51c06f1

Browse files
committed
Initialize before calling into CUDAdrv.
1 parent d02156a commit 51c06f1

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/memory.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,11 @@ synchronized right before and after executing `ex` to exclude any external effec
212212
"""
213213
macro time(ex)
214214
quote
215+
# @time might surround an application, so be sure to initialize CUDA before that
216+
# FIXME: this should be done in CUDAdrv (`synchronize(ctx=CuCurrentOrNewContext()`)
217+
# but the CUDA initialization mechanics are part of CUDAnative.jl
218+
CUDAnative.maybe_initialize("@time")
219+
215220
# coarse synchronization to exclude effects from previously-executed code
216221
CUDAdrv.synchronize()
217222

0 commit comments

Comments
 (0)