GPUArrays.jl icon indicating copy to clipboard operation
GPUArrays.jl copied to clipboard

`promote_type` on GPU arrays of Float32 and ComplexF32 promotes to UnionAll

Open nHackel opened this issue 1 year ago • 0 comments

Hello,

I stumbled over this difference between CPU and GPU arrays:

julia> using JLArrays

julia> using CUDA

julia> a = rand(Float32, 1); b = rand(ComplexF32, 1);

julia> promote_type(typeof(a), typeof(b))
Vector{ComplexF32} (alias for Array{Complex{Float32}, 1})

julia> promote_type(typeof(JLArray(a)), typeof(JLArray(b)))
JLArray{T, 1} where T

julia> promote_type(typeof(CuArray(a)), typeof(CuArray(b)))
CuArray{T, 1, CUDA.DeviceMemory} where T

I've noticed this behaviour originally on CuArrays, but noticed it is also present for JLArrays, so I hope this is the correct repository. I have not been able to test it out on other GPU arrays (yet)

nHackel avatar Jun 24 '24 13:06 nHackel