Skip to content

only use LU for CUDA when v1.8+ #176

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

Merged
merged 1 commit into from
Aug 11, 2022
Merged
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
26 changes: 19 additions & 7 deletions src/default.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ function defaultalg(A, b)
# This catches the case where A is a CuMatrix
# Which does not have LU fully defined
elseif A isa GPUArraysCore.AbstractGPUArray || b isa GPUArraysCore.AbstractGPUArray
alg = LUFactorization()
if VERSION >= v"1.8-"
alg = LUFactorization()
else
alg = QRFactorization()
end

# Not factorizable operator, default to only using A*x
else
Expand Down Expand Up @@ -118,9 +122,13 @@ function SciMLBase.solve(cache::LinearCache, alg::Nothing,
# This catches the case where A is a CuMatrix
# Which does not have LU fully defined
elseif A isa GPUArraysCore.AbstractGPUArray
alg = LUFactorization()
SciMLBase.solve(cache, alg, args...; kwargs...)

if VERSION >= v"1.8-"
alg = LUFactorization()
SciMLBase.solve(cache, alg, args...; kwargs...)
else
alg = QRFactorization()
SciMLBase.solve(cache, alg, args...; kwargs...)
end
# Not factorizable operator, default to only using A*x
# IterativeSolvers is faster on CPU but not GPU-compatible
else
Expand Down Expand Up @@ -185,9 +193,13 @@ function init_cacheval(alg::Nothing, A, b, u, Pl, Pr, maxiters, abstol, reltol,
# This catches the case where A is a CuMatrix
# Which does not have LU fully defined
elseif A isa GPUArraysCore.AbstractGPUArray
alg = LUFactorization()
init_cacheval(alg, A, b, u, Pl, Pr, maxiters, abstol, reltol, verbose)

if VERSION >= v"1.8-"
alg = LUFactorization()
init_cacheval(alg, A, b, u, Pl, Pr, maxiters, abstol, reltol, verbose)
else
alg = QRFactorization()
init_cacheval(alg, A, b, u, Pl, Pr, maxiters, abstol, reltol, verbose)
end
# Not factorizable operator, default to only using A*x
# IterativeSolvers is faster on CPU but not GPU-compatible
else
Expand Down