Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lazy initialization doesn't trigger with all API calls #2196

Open
maleadt opened this issue Dec 11, 2023 · 0 comments
Open

Lazy initialization doesn't trigger with all API calls #2196

maleadt opened this issue Dec 11, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@maleadt
Copy link
Member

maleadt commented Dec 11, 2023

We only lazily initialize when initializing the task-local state, not when e.g. calling cuDeviceGetCount. That can result in bad error reporting:

julia> using CUDA
julia> devices()
Error showing value of type CUDA.DeviceIterator:
ERROR: UndefVarError: `libcuda` not defined
Stacktrace:
  [1] macro expansion
    @ ~/.julia/packages/CUDA/YIj5X/lib/cudadrv/libcuda.jl:3090 [inlined]
  [2] #151
    @ ~/.julia/packages/CUDA/YIj5X/lib/utils/call.jl:27 [inlined]
  [3] check(f::CUDA.var"#151#152"{Base.RefValue{Int32}})
    @ CUDA ~/.julia/packages/CUDA/YIj5X/lib/cudadrv/libcuda.jl:32
  [4] cuDeviceGetCount(count::Base.RefValue{Int32})
    @ CUDA ~/.julia/packages/CUDA/YIj5X/lib/utils/call.jl:26
  [5] ndevices
    @ ~/.julia/packages/CUDA/YIj5X/lib/cudadrv/devices.jl:159 [inlined]
  [6] length
    @ ~/.julia/packages/CUDA/YIj5X/lib/cudadrv/devices.jl:143 [inlined]
@maleadt maleadt added bug Something isn't working enhancement New feature or request and removed bug Something isn't working labels Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant