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

Simplify a ton since the bound is now v1.9 #424

Merged
merged 1 commit into from
Nov 7, 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
20 changes: 10 additions & 10 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,33 +62,33 @@ ArrayInterface = "7.4.11"
BandedMatrices = "1"
BlockDiagonals = "0.1"
ConcreteStructs = "0.2"
DocStringExtensions = "0.8, 0.9"
DocStringExtensions = "0.9"
EnumX = "1"
EnzymeCore = "0.5, 0.6"
FastLapackInterface = "1, 2"
EnzymeCore = "0.6"
FastLapackInterface = "2"
GPUArraysCore = "0.1"
HYPRE = "1.4.0"
InteractiveUtils = "1.6"
IterativeSolvers = "0.9.3"
Libdl = "1.6"
LinearAlgebra = "1.6"
LinearAlgebra = "1.9"
KLU = "0.3.0, 0.4"
KernelAbstractions = "0.9"
Krylov = "0.9"
KrylovKit = "0.5, 0.6"
KrylovKit = "0.6"
MKL = "0.6"
PrecompileTools = "1"
Preferences = "1"
RecursiveArrayTools = "2"
RecursiveFactorization = "0.2.8"
Reexport = "1"
Requires = "1"
SciMLBase = "1.82, 2"
SciMLOperators = "0.2, 0.3"
Setfield = "0.7, 0.8, 1"
SparseArrays = "1.6"
SciMLBase = "2"
SciMLOperators = "0.3"
Setfield = "1"
SparseArrays = "1.9"
Sparspak = "0.3.6"
SuiteSparse = "1.6"
SuiteSparse = "1.9"
UnPack = "1"
julia = "1.9"

Expand Down
2 changes: 1 addition & 1 deletion src/LinearSolve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ PrecompileTools.@recompile_invalidations begin
import Preferences
end

if VERSION >= v"1.8" && Preferences.@load_preference("TriggerMKLLBT", true)
if Preferences.@load_preference("TriggerMKLLBT", true)
using MKL
end

Expand Down
4 changes: 1 addition & 3 deletions src/appleaccelerate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,10 @@ end
default_alias_A(::AppleAccelerateLUFactorization, ::Any, ::Any) = false
default_alias_b(::AppleAccelerateLUFactorization, ::Any, ::Any) = false

const PREALLOCATED_APPLE_LU = @static if VERSION >= v"1.8"
const PREALLOCATED_APPLE_LU = begin
A = rand(0, 0)
luinst = ArrayInterface.lu_instance(A)
LU(luinst.factors, similar(A, Cint, 0), luinst.info), Ref{Cint}()
else
nothing
end

function LinearSolve.init_cacheval(alg::AppleAccelerateLUFactorization, A, b, u, Pl, Pr,
Expand Down
26 changes: 5 additions & 21 deletions src/default.jl
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,7 @@
if assump.condition === OperatorCondition.IllConditioned || !assump.issq
DefaultLinearSolver(DefaultAlgorithmChoice.QRFactorization)
else
@static if VERSION >= v"1.8-"
DefaultLinearSolver(DefaultAlgorithmChoice.LUFactorization)
else
DefaultLinearSolver(DefaultAlgorithmChoice.QRFactorization)
end
DefaultLinearSolver(DefaultAlgorithmChoice.LUFactorization)

Check warning on line 100 in src/default.jl

View check run for this annotation

Codecov / codecov/patch

src/default.jl#L100

Added line #L100 was not covered by tests
end
end

Expand All @@ -110,11 +106,7 @@
if assump.condition === OperatorCondition.IllConditioned || !assump.issq
DefaultLinearSolver(DefaultAlgorithmChoice.QRFactorization)
else
@static if VERSION >= v"1.8-"
DefaultLinearSolver(DefaultAlgorithmChoice.LUFactorization)
else
DefaultLinearSolver(DefaultAlgorithmChoice.QRFactorization)
end
DefaultLinearSolver(DefaultAlgorithmChoice.LUFactorization)

Check warning on line 109 in src/default.jl

View check run for this annotation

Codecov / codecov/patch

src/default.jl#L109

Added line #L109 was not covered by tests
end
end

Expand All @@ -124,11 +116,7 @@
if assump.condition === OperatorCondition.IllConditioned || !assump.issq
DefaultLinearSolver(DefaultAlgorithmChoice.QRFactorization)
else
@static if VERSION >= v"1.8-"
DefaultLinearSolver(DefaultAlgorithmChoice.LUFactorization)
else
DefaultLinearSolver(DefaultAlgorithmChoice.QRFactorization)
end
DefaultLinearSolver(DefaultAlgorithmChoice.LUFactorization)

Check warning on line 119 in src/default.jl

View check run for this annotation

Codecov / codecov/patch

src/default.jl#L119

Added line #L119 was not covered by tests
end
end

Expand Down Expand Up @@ -162,7 +150,7 @@
__conditioning(assump) === OperatorCondition.WellConditioned)
if length(b) <= 10
DefaultAlgorithmChoice.GenericLUFactorization
elseif VERSION >= v"1.8" && appleaccelerate_isavailable()
elseif appleaccelerate_isavailable()
DefaultAlgorithmChoice.AppleAccelerateLUFactorization
elseif (length(b) <= 100 || (isopenblas() && length(b) <= 500) ||
(usemkl && length(b) <= 200)) &&
Expand Down Expand Up @@ -327,11 +315,7 @@
end
defaultalg_symbol(::Type{<:GenericFactorization{typeof(ldlt!)}}) = :LDLtFactorization

@static if VERSION >= v"1.7"
defaultalg_symbol(::Type{<:QRFactorization{ColumnNorm}}) = :QRFactorizationPivoted
else
defaultalg_symbol(::Type{<:QRFactorization{Val{true}}}) = :QRFactorizationPivoted
end
defaultalg_symbol(::Type{<:QRFactorization{ColumnNorm}}) = :QRFactorizationPivoted

"""
if alg.alg === DefaultAlgorithmChoice.LUFactorization
Expand Down
13 changes: 3 additions & 10 deletions src/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,6 @@ function set_cacheval(cache::LinearCache, alg_cache)
end
end

@static if VERSION >= v"1.9" # qualified names only supported in Julia 1.9
@deprecate SciMLBase.solve(cache::LinearCache, args...; kwargs...) SciMLBase.solve!(cache::LinearCache,
args...;
kwargs...) false
else
function SciMLBase.solve(cache::LinearCache, args...; kwargs...)
@warn "SciMLBase.solve(cache::LinearCache, args...; kwargs...) is deprecated for SciMLBase.solve!(cache::LinearCache, args...; kwargs...) to follow the CommonSolve.jl interface."
SciMLBase.solve!(cache::LinearCache, args...; kwargs...)
end
end
@deprecate SciMLBase.solve(cache::LinearCache, args...; kwargs...) SciMLBase.solve!(cache::LinearCache,
args...;
kwargs...) false
139 changes: 51 additions & 88 deletions src/extension_algs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,12 @@
"""
struct HYPREAlgorithm <: SciMLLinearSolveAlgorithm
solver::Any

@static if VERSION >= v"1.9-"
function HYPREAlgorithm(solver)
ext = Base.get_extension(@__MODULE__, :LinearSolveHYPREExt)
if ext === nothing
error("HYPREAlgorithm requires that HYPRE is loaded, i.e. `using HYPRE`")
else
return new{}(solver)
end
function HYPREAlgorithm(solver)
ext = Base.get_extension(@__MODULE__, :LinearSolveHYPREExt)
if ext === nothing
error("HYPREAlgorithm requires that HYPRE is loaded, i.e. `using HYPRE`")

Check warning on line 57 in src/extension_algs.jl

View check run for this annotation

Codecov / codecov/patch

src/extension_algs.jl#L57

Added line #L57 was not covered by tests
else
return new{}(solver)
end
end
end
Expand All @@ -75,14 +72,12 @@
Using this solver requires adding the package CUDA.jl, i.e. `using CUDA`
"""
struct CudaOffloadFactorization <: LinearSolve.AbstractFactorization
@static if VERSION >= v"1.9-"
function CudaOffloadFactorization()
ext = Base.get_extension(@__MODULE__, :LinearSolveCUDAExt)
if ext === nothing
error("CudaOffloadFactorization requires that CUDA is loaded, i.e. `using CUDA`")
else
return new{}()
end
function CudaOffloadFactorization()
ext = Base.get_extension(@__MODULE__, :LinearSolveCUDAExt)
if ext === nothing
error("CudaOffloadFactorization requires that CUDA is loaded, i.e. `using CUDA`")

Check warning on line 78 in src/extension_algs.jl

View check run for this annotation

Codecov / codecov/patch

src/extension_algs.jl#L75-L78

Added lines #L75 - L78 were not covered by tests
else
return new{}()

Check warning on line 80 in src/extension_algs.jl

View check run for this annotation

Codecov / codecov/patch

src/extension_algs.jl#L80

Added line #L80 was not covered by tests
end
end
end
Expand Down Expand Up @@ -133,83 +128,51 @@
"""
MKLPardisoIterate(; kwargs...) = PardisoJL(; solver_type = 1, kwargs...)

@static if VERSION >= v"1.9-"
"""
```julia
PardisoJL(; nprocs::Union{Int, Nothing} = nothing,
solver_type = nothing,
matrix_type = nothing,
iparm::Union{Vector{Tuple{Int, Int}}, Nothing} = nothing,
dparm::Union{Vector{Tuple{Int, Int}}, Nothing} = nothing)
```

A generic method using MKL Pardiso. Specifying `solver_type` is required.

!!! note

Using this solver requires adding the package Pardiso.jl, i.e. `using Pardiso`

## Keyword Arguments

For the definition of the keyword arguments, see the Pardiso.jl documentation.
All values default to `nothing` and the solver internally determines the values
given the input types, and these keyword arguments are only for overriding the
default handling process. This should not be required by most users.
"""
struct PardisoJL{T1, T2} <: LinearSolve.SciMLLinearSolveAlgorithm
nprocs::Union{Int, Nothing}
solver_type::T1
matrix_type::T2
iparm::Union{Vector{Tuple{Int, Int}}, Nothing}
dparm::Union{Vector{Tuple{Int, Int}}, Nothing}

function PardisoJL(; nprocs::Union{Int, Nothing} = nothing,
"""
```julia
PardisoJL(; nprocs::Union{Int, Nothing} = nothing,
solver_type = nothing,
matrix_type = nothing,
iparm::Union{Vector{Tuple{Int, Int}}, Nothing} = nothing,
dparm::Union{Vector{Tuple{Int, Int}}, Nothing} = nothing)
ext = Base.get_extension(@__MODULE__, :LinearSolvePardisoExt)
if ext === nothing
error("PardisoJL requires that Pardiso is loaded, i.e. `using Pardiso`")
else
T1 = typeof(solver_type)
T2 = typeof(matrix_type)
@assert T1 <: Union{Int, Nothing, ext.Pardiso.Solver}
@assert T2 <: Union{Int, Nothing, ext.Pardiso.MatrixType}
return new{T1, T2}(nprocs, solver_type, matrix_type, iparm, dparm)
end
```

A generic method using MKL Pardiso. Specifying `solver_type` is required.

!!! note

Using this solver requires adding the package Pardiso.jl, i.e. `using Pardiso`

## Keyword Arguments

For the definition of the keyword arguments, see the Pardiso.jl documentation.
All values default to `nothing` and the solver internally determines the values
given the input types, and these keyword arguments are only for overriding the
default handling process. This should not be required by most users.
"""
struct PardisoJL{T1, T2} <: LinearSolve.SciMLLinearSolveAlgorithm
nprocs::Union{Int, Nothing}
solver_type::T1
matrix_type::T2
iparm::Union{Vector{Tuple{Int, Int}}, Nothing}
dparm::Union{Vector{Tuple{Int, Int}}, Nothing}

function PardisoJL(; nprocs::Union{Int, Nothing} = nothing,
solver_type = nothing,
matrix_type = nothing,
iparm::Union{Vector{Tuple{Int, Int}}, Nothing} = nothing,
dparm::Union{Vector{Tuple{Int, Int}}, Nothing} = nothing)
ext = Base.get_extension(@__MODULE__, :LinearSolvePardisoExt)
if ext === nothing
error("PardisoJL requires that Pardiso is loaded, i.e. `using Pardiso`")

Check warning on line 167 in src/extension_algs.jl

View check run for this annotation

Codecov / codecov/patch

src/extension_algs.jl#L167

Added line #L167 was not covered by tests
else
T1 = typeof(solver_type)
T2 = typeof(matrix_type)
@assert T1 <: Union{Int, Nothing, ext.Pardiso.Solver}
@assert T2 <: Union{Int, Nothing, ext.Pardiso.MatrixType}
return new{T1, T2}(nprocs, solver_type, matrix_type, iparm, dparm)
end
end
else
"""
```julia
PardisoJL(; nprocs::Union{Int, Nothing} = nothing,
solver_type = nothing,
matrix_type = nothing,
iparm::Union{Vector{Tuple{Int, Int}}, Nothing} = nothing,
dparm::Union{Vector{Tuple{Int, Int}}, Nothing} = nothing)
```

A generic method using MKL Pardiso. Specifying `solver_type` is required.

!!! note

Using this solver requires adding the package Pardiso.jl, i.e. `using Pardiso`

## Keyword Arguments

For the definition of the keyword arguments, see the Pardiso.jl documentation.
All values default to `nothing` and the solver internally determines the values
given the input types, and these keyword arguments are only for overriding the
default handling process. This should not be required by most users.
"""
Base.@kwdef struct PardisoJL <: LinearSolve.SciMLLinearSolveAlgorithm
nprocs::Union{Int, Nothing} = nothing
solver_type::Any = nothing
matrix_type::Any = nothing
iparm::Union{Vector{Tuple{Int, Int}}, Nothing} = nothing
dparm::Union{Vector{Tuple{Int, Int}}, Nothing} = nothing
end
end

"""
Expand Down
Loading