JuliaGPU / CUDA.jl

CUDA programming in Julia.
https://juliagpu.org/cuda/
Other
1.21k stars 221 forks source link

Getting Sparse CuArrays to work with Arpack #154

Open jebej opened 5 years ago

jebej commented 5 years ago

I'm trying to diagonalize a sparse CuArrays with eigs, which currently fails because it dispatches to the general matrix*vector multiplication. What would be needed to get it to work?

Is it only a question of defining the correct mul! method?

jebej commented 5 years ago

The issue is with aupd_wrapper in Arpack

https://github.com/JuliaLinearAlgebra/Arpack.jl/blob/04defa4276407b4401734da5dea3ac4615b9b443/src/libarpack.jl#L15-L18

which allocates the required dense arrays on the main memory.

I'm not sure what would be the best solution in order to allocate on the GPU memory instead. Julia has interfaces to allow matching the type of the element of an array, but not the type of memory.

jebej commented 5 years ago

The bigger issue is that a dense vector is needed by Arpack for updates, requiring a copy every iteration. Oh well...

rveltz commented 5 years ago

use KrylovKit maybe

andreasnoack commented 5 years ago

The output vectors of the matmuls have to be stored in CPU memory when using ARPACK. I suspect using https://github.com/haampie/ArnoldiMethod.jl would be the way to proceed here. It might not work yet with GPUs but it should be possible to make it work since it's completely written in Julia.