JuliaLinearAlgebra / IterativeSolvers.jl

Iterative algorithms for solving linear systems, eigensystems, and singular value problems
MIT License
399 stars 105 forks source link

GPU friendly BLAS calls #251

Open shashi opened 5 years ago

shashi commented 5 years ago

@ChrisRackauckas found out that using CuArrays fails at points like https://github.com/JuliaMath/IterativeSolvers.jl/blob/17ef2613dff1d80724886797160ee01bd1bd2c71/src/simple.jl#L38

where the call to BLAS.axpy! explicitly assumes that the inputs are OK with OpenBLAS. The right alternative would be to use LinearAlgebra.axpy! (which as it turns out is a different function) and let it naturally dispatch to BLAS iff possible.

pkofod commented 5 years ago

see also #245 (I actually believe this is a duplicate of that)

simonbyrne commented 5 years ago

There are also several hard-coded Matrix types, e.g. https://github.com/JuliaMath/IterativeSolvers.jl/blob/17ef2613dff1d80724886797160ee01bd1bd2c71/src/gmres.jl#L7

pkofod commented 5 years ago

Since I need this, I might be able to go over some of these. If anyone has a usecase/ something that doens't currently work, please post it so I can take it into account.

simonbyrne commented 5 years ago

We have some of our own code implemented: https://github.com/climate-machine/CLIMA/tree/master/src/LinearSolvers feel free to take/adapt what you need.

See also this comment for our needs: https://github.com/climate-machine/CLIMA/pull/330#issuecomment-516100717