JuliaGPU / JuliaGPU/KernelAbstractions.jl
Unexpected behavior for `KA.device!(backend, num)`
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 523
- Forks
- 88
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 25
Description
Over at Oceananingans, we had memory issues related to the fact that it seems that
KA.device!(backend, num)
does not switch to the intended device
MWE:
julia> using CUDA, KernelAbstractions
julia> KernelAbstractions.device!(CUDABackend(), 2)
julia> CUDA.device() # should be device number 1
CuDevice(0): NVIDIA TITAN V
This is because device! is only defined for an Int32
https://github.com/JuliaGPU/CUDA.jl/blob/cd2ab1d22e36396b6a1141ee8782d182a5020087/src/CUDAKernels.jl#L67-L69
julia> KernelAbstractions.device!(CUDABackend(), Int32(2))
CuDevice(1): NVIDIA TITAN V
Why is this the case? Should we allow any integer? Or maybe a non-silent failure in case the device cannot be switched
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the Julia MWE with KernelAbstractions.device!(CUDABackend(), 2), then inspect CUDAKernels.jl at the linked device! definition. Compare Int and Int32 behavior and add coverage for the chosen integer-handling or failure behavior; done means device selection is no longer silently incorrect.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- hpc
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100