Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add comments about using block-GMRES on GPUs #844

Merged
merged 1 commit into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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