Skip to content

Commit 1dec082

Browse files
authored
Assert CUDA.jl is functional when creating the TLS. (#1868)
This should avoid some of the hard-to-understand libcuda-is-missing errors.
1 parent a763309 commit 1dec082

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/cudadrv/state.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ function task_local_state!(args...)
7171
if haskey(tls, :CUDA)
7272
validate_task_local_state(@inbounds(tls[:CUDA]))
7373
else
74+
# verify that CUDA.jl is functional. this doesn't belong here, but since we can't
75+
# error during `__init__`, we do it here instead as this is the first function
76+
# that's likely executed when using CUDA.jl
77+
@assert functional(true)
78+
7479
tls[:CUDA] = TaskLocalState(args...)
7580
end::TaskLocalState
7681
end

0 commit comments

Comments
 (0)