The result of sum(abs2, a) for complex a is also complex in case of a being a CuArray:
using CuArrays
a = zeros(ComplexF32, 10)
s = sum(abs2, a)
@show typeof(s)
agpu = CuArrays.zeros(ComplexF32, 10)
sgpu = sum(abs2, agpu)
@show typeof(sgpu)
typeof(s) = Float32
typeof(sgpu) = Complex{Float32}
Is it expected behavior?