@@ -27,20 +27,20 @@ GPU offloading is simple as it's done simply by changing the solver algorithm. T
2727example from the start of the documentation:
2828
2929``` julia
30- using LinearSolve
30+ import LinearSolve as LS
3131
3232A = rand (4 , 4 )
3333b = rand (4 )
34- prob = LinearProblem (A, b)
35- sol = solve (prob)
34+ prob = LS . LinearProblem (A, b)
35+ sol = LS . solve (prob)
3636sol. u
3737```
3838
3939This computation can be moved to the GPU by the following:
4040
4141``` julia
4242using CUDA # Add the GPU library
43- sol = solve (prob, CudaOffloadFactorization ())
43+ sol = LS . solve (prob, LS . CudaOffloadFactorization ())
4444sol. u
4545```
4646
@@ -56,8 +56,8 @@ using CUDA
5656
5757A = rand (4 , 4 ) |> cu
5858b = rand (4 ) |> cu
59- prob = LinearProblem (A, b)
60- sol = solve (prob)
59+ prob = LS . LinearProblem (A, b)
60+ sol = LS . solve (prob)
6161sol. u
6262```
6363
@@ -81,13 +81,13 @@ move things to CPU on command.
8181 However, this change in numerical precision needs to be accounted for in your mathematics
8282 as it could lead to instabilities. To disable this, use a constructor that is more
8383 specific about the bitsize, such as `CuArray{Float64}(A)`. Additionally, preferring more
84- stable factorization methods, such as `QRFactorization()`, can improve the numerics in
84+ stable factorization methods, such as `LS. QRFactorization()`, can improve the numerics in
8585 such cases.
8686
8787Similarly to other use cases, you can choose the solver, for example:
8888
8989``` julia
90- sol = solve (prob, QRFactorization ())
90+ sol = LS . solve (prob, LS . QRFactorization ())
9191```
9292
9393## Sparse Matrices on GPUs
@@ -96,10 +96,12 @@ Currently, sparse matrix computations on GPUs are only supported for CUDA. This
9696the ` CUDA.CUSPARSE ` sublibrary.
9797
9898``` julia
99- using LinearAlgebra, CUDA. CUSPARSE
99+ import LinearAlgebra as LA
100+ import SparseArrays as SA
101+ import CUDA
100102T = Float32
101103n = 100
102- A_cpu = sprand (T, n, n, 0.05 ) + I
104+ A_cpu = SA . sprand (T, n, n, 0.05 ) + LA . I
103105x_cpu = zeros (T, n)
104106b_cpu = rand (T, n)
105107
@@ -112,7 +114,7 @@ In order to solve such problems using a direct method, you must add
112114
113115``` julia
114116using CUDSS
115- sol = solve (prob, LUFactorization ())
117+ sol = LS . solve (prob, LS . LUFactorization ())
116118```
117119
118120!!! note
@@ -122,13 +124,13 @@ sol = solve(prob, LUFactorization())
122124Note that ` KrylovJL ` methods also work with sparse GPU arrays:
123125
124126``` julia
125- sol = solve (prob, KrylovJL_GMRES ())
127+ sol = LS . solve (prob, LS . KrylovJL_GMRES ())
126128```
127129
128130Note that CUSPARSE also has some GPU-based preconditioners, such as a built-in ` ilu ` . However:
129131
130132``` julia
131- sol = solve (prob, KrylovJL_GMRES (precs = (A, p) -> (CUDA. CUSPARSE. ilu02! (A, ' O' ), I)))
133+ sol = LS . solve (prob, LS . KrylovJL_GMRES (precs = (A, p) -> (CUDA. CUSPARSE. ilu02! (A, ' O' ), LA . I)))
132134```
133135
134136However, right now CUSPARSE is missing the right ` ldiv! ` implementation for this to work
0 commit comments