Skip to content

Commit

Permalink
Add comments about using block-GMRES on GPUs
Browse files Browse the repository at this point in the history
  • Loading branch information
amontoison committed Dec 8, 2023
1 parent 007a019 commit 80fa61c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 14 deletions.
23 changes: 23 additions & 0 deletions docs/src/block_krylov.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
## Block-GMRES

!!! note
`block_gmres` works on GPUs
with Julia 1.11.

If you want to use `block_gmres` on previous Julia versions, you can overload the function `Krylov.copy_triangle` with the following code:
```julia
using KernelAbstractions, Krylov

@kernel function copy_triangle_kernel!(dest, src)
i, j = @index(Global, NTuple)
if j >= i
@inbounds dest[i, j] = src[i, j]
end
end

function Krylov.copy_triangle(Q::AbstractMatrix{FC}, R::AbstractMatrix{FC}, k::Int) where FC <: Krylov.FloatOrComplex
backend = get_backend(Q)
ndrange = (k, k)
copy_triangle_kernel!(backend)(R, Q; ndrange=ndrange)
KernelAbstractions.synchronize(backend)
end
```

```@docs
block_gmres
block_gmres!
Expand Down
14 changes: 0 additions & 14 deletions src/block_krylov_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -156,20 +156,6 @@ function reduced_qr(A::AbstractMatrix{FC}, algo::String) where FC <: FloatOrComp
return Q, R
end

# @kernel function copy_triangle_kernel!(dest, src)
# i, j = @index(Global, NTuple)
# if j >= i
# @inbounds dest[i, j] = src[i, j]
# end
# end

# function copy_triangle(Q::AbstractMatrix{FC}, R::AbstractMatrix{FC}, k::Int) where FC <: FloatOrComplex
# backend = get_backend(Q)
# ndrange = (k, k)
# copy_triangle_kernel!(backend)(R, Q; ndrange=ndrange)
# KernelAbstractions.synchronize(backend)
# end

function copy_triangle(Q::AbstractMatrix{FC}, R::AbstractMatrix{FC}, k::Int) where FC <: FloatOrComplex
if VERSION < v"1.11"
for i = 1:k
Expand Down

0 comments on commit 80fa61c

Please sign in to comment.