Hello,
I am trying to work on complex numbers.
a=[0 1;-1 0]
@time f=eigfact(a) #takes 0.000092 seconds
a=convert(Array{Complex64,2},a)
@time f=eigfact(a) #takes 0.062753 seconds
And then move the computation to GPU which does not seem to work.
using CUDAnative
using CuArrays
b=cu(a)
@time f=eigfact(b) #Throws following error message
#=
julia> @time f=eigfact(b)
ERROR: InexactError()
Stacktrace:
[1] trunc(::Type{Int64}, ::Float64) at ./float.jl:672
[2] poolidx(::Int64) at /home/malay/.julia/v0.6/CuArrays/src/memory.jl:31
[3] alloc(::Int64) at /home/malay/.julia/v0.6/CuArrays/src/memory.jl:203
[4] Type at /home/malay/.julia/v0.6/CuArrays/src/array.jl:34 [inlined]
[5] similar at /home/malay/.julia/v0.6/CuArrays/src/array.jl:44 [inlined]
[6] similar at ./abstractarray.jl:524 [inlined]
[7] geevx!(::Char, ::Char, ::Char, ::Char, ::CuArray{Complex{Float32},2}) at ./linalg/lapack.jl:2108
[8] #eigfact!#38(::Bool, ::Bool, ::Function, ::CuArray{Complex{Float32},2}) at ./linalg/eigen.jl:65
[9] (::Base.LinAlg.#kw##eigfact!)(::Array{Any,1}, ::Base.LinAlg.#eigfact!, ::CuArray{Complex{Float32},2}) at ./:0
[10] #eigfact#39(::Bool, ::Bool, ::Function, ::CuArray{Complex{Float16},2}) at ./linalg/eigen.jl:103
[11] eigfact(::CuArray{Complex{Float16},2}) at ./linalg/eigen.jl:102
=#
I even tried a sine function which errored as well
CUDAnative.sin(a)
ERROR: MethodError: no method matching sin(::Array{Complex{Float32},2})
You may have intended to import Base.sin
Closest candidates are:
sin(::Float32) at /home/malay/.julia/v0.6/CUDAnative/src/device/libdevice.jl:13
sin(::Float64) at /home/malay/.julia/v0.6/CUDAnative/src/device/libdevice.jl:12
sin(::ForwardDiff.Dual{T,V,N} where N where V<:Real) where T at /home/malay/.julia/v0.6/ForwardDiff/src/dual.jl:166
I am not sure if my approach is incorrect or my installation is incorrect or the functionality is not implemented yet. Please advise.
I am on Linux Mint, Cuda 9.1, Julia 6.4, gtx1060
My motive is to find the eigenvalues of complex matrixes and diagonalize them and then perform further calculations. I was thinking of moving the calculations to GPU to expedite them. I am not sure if GPU acceleration is possible for all complex number operations. I did see another thread here which states that eigen decomposition is not possible.
Futher, if someone has a nice documentation link for CuArrays and GPUArrays, it would be nice.
Thanks in advance.