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

Update the documentation #879

Merged
merged 2 commits into from
Oct 2, 2024
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
5 changes: 3 additions & 2 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ makedocs(
"Generalized saddle-point and non-Hermitian partitioned systems" => "solvers/gsp.md"],
"Block-Krylov methods" => "block_krylov.md",
"In-place methods" => "inplace.md",
"Storage requirements" => "storage.md",
"Preconditioners" => "preconditioners.md",
"Storage requirements" => "storage.md",
"GPU support" => "gpu.md",
# "KrylovPreconditioners.jl" => "krylov_preconditioners.md",
"Warm-start" => "warm-start.md",
"Factorization-free operators" => "factorization-free.md",
"Matrix-free operators" => "matrix_free.md",
"Callbacks" => "callbacks.md",
"Performance tips" => "tips.md",
"Tutorials" => ["CG" => "examples/cg.md",
Expand Down
10 changes: 7 additions & 3 deletions docs/src/gpu.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ if CUDA.functional()
end
```

If you use a Krylov method that only requires `A * v` products (see [here](@ref factorization-free)), the most efficient format is `CuSparseMatrixCSR`.
If you use a Krylov method that only requires `A * v` products (see [here](@ref matrix-free)), the most efficient format is `CuSparseMatrixCSR`.
Optimized operator-vector and operator-matrix products that exploit GPU features can be also used by means of linear operators.

For instance, when executing sparse matrix products on NVIDIA GPUs, the `mul!` function utilized by Krylov.jl internally calls three routines from CUSPARSE.
Expand All @@ -68,8 +68,8 @@ opA_gpu = KrylovOperator(A_gpu)
x_gpu, stats = gmres(opA_gpu, b_gpu)
```

Preconditioners, especially incomplete Cholesky or Incomplete LU factorizations that involve triangular solves,
can be applied directly on GPU thanks to efficient operators that take advantage of CUSPARSE routines.
Preconditioners, especially incomplete Cholesky or incomplete LU factorizations that involve sparse triangular solves,
can be applied directly on GPU thanks to efficient operators (like `TriangularOperator`) that take advantage of CUSPARSE routines.

### Example with a symmetric positive-definite system

Expand Down Expand Up @@ -221,6 +221,10 @@ opA_gpu = KrylovOperator(A_gpu)
x_gpu, stats = bicgstab(opA_gpu, b_gpu)
```

Preconditioners, especially incomplete Cholesky or incomplete LU factorizations that involve sparse triangular solves,
can be applied directly on GPU thanks to efficient operators (like `TriangularOperator`) that take advantage of rocSPARSE routines.


## Intel GPUs

All solvers in Krylov.jl can be used with [oneAPI.jl](https://github.com/JuliaGPU/oneAPI.jl) and allow computations on Intel GPUs.
Expand Down
7 changes: 4 additions & 3 deletions docs/src/inplace.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
## In-place methods
## [In-place methods](@id in-place)

All solvers in Krylov.jl have an in-place variant implemented in a method whose name ends with `!`.
A workspace (`KrylovSolver`) that contains the storage needed by a Krylov method can be used to solve multiple linear systems that have the same dimensions in the same floating-point precision.
A workspace (`KrylovSolver`), which contains the storage needed by a Krylov method, can be used to solve multiple linear systems with the same dimensions and the same floating-point precision.
The section [storage requirements](@ref storage-requirements) specifies the memory needed for each Krylov method.
Each `KrylovSolver` has two constructors:

```@constructors
Expand Down Expand Up @@ -50,7 +51,7 @@ Krylov.issolved
## Examples

We illustrate the use of in-place Krylov solvers with two well-known optimization methods.
The details of the optimization methods are described in the section about [Factorization-free operators](@ref factorization-free).
The details of the optimization methods are described in the section about [Factorization-free operators](@ref matrix-free).

### Example 1: Newton's method for convex optimization without linesearch

Expand Down
4 changes: 2 additions & 2 deletions docs/src/factorization-free.md → docs/src/matrix_free.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ html.theme--documenter-dark .content table th:last-child {
</style>
```

## [Factorization-free operators](@id factorization-free)
## [Matrix-free operators](@id matrix-free)

All methods are factorization-free, which means that you only need to provide operator-vector products.
All methods are matrix-free, which means that you only need to provide operator-vector products.

The `A` or `B` input arguments of Krylov.jl solvers can be any object that represents a linear operator. That object must implement `mul!`, for multiplication with a vector, `size()` and `eltype()`. For certain methods it must also implement `adjoint()`.

Expand Down
11 changes: 9 additions & 2 deletions docs/src/preconditioners.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ Methods concerned: [`CGNE`](@ref cgne), [`CRMR`](@ref crmr), [`LNLQ`](@ref lnlq)

## Packages that provide preconditioners

- [IncompleteLU.jl](https://github.com/haampie/IncompleteLU.jl) implements the left-looking and Crout versions of ILU decompositions.
- [KrylovPreconditioners.jl](https://github.com/JuliaSmoothOptimizers/KrylovPreconditioners.jl) implements block-Jacobi, IC(0) and ILU(0) preconditioners.
- [ILUZero.jl](https://github.com/mcovalt/ILUZero.jl) is a Julia implementation of incomplete LU factorization with zero level of fill-in.
- [LimitedLDLFactorizations.jl](https://github.com/JuliaSmoothOptimizers/LimitedLDLFactorizations.jl) for limited-memory LDLᵀ factorization of symmetric matrices.
- [AlgebraicMultigrid.jl](https://github.com/JuliaLinearAlgebra/AlgebraicMultigrid.jl) provides two algebraic multigrid (AMG) preconditioners.
Expand All @@ -146,6 +146,13 @@ Methods concerned: [`CGNE`](@ref cgne), [`CRMR`](@ref crmr), [`LNLQ`](@ref lnlq)

## Examples

```julia
using KrylovPreconditioners, Krylov

P⁻¹ = BlockJacobiPreconditioner(A) # Block-Jacobi preconditioner
x, stats = gmres(A, b, M=P⁻¹)
```

```julia
using Krylov
n, m = size(A)
Expand All @@ -163,7 +170,7 @@ x, stats = minres(A, b, M=P⁻¹)
```

```julia
using IncompleteLU, Krylov
using KrylovPreconditioners, Krylov
Pℓ = ilu(A)
x, stats = gmres(A, b, M=Pℓ, ldiv=true) # left preconditioning
```
Expand Down
Loading