Skip to content
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
2 changes: 2 additions & 0 deletions ext/LinearSolveBLISExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ using SciMLBase: ReturnCode
const global libblis = blis_jll.blis
const global liblapack = LAPACK_jll.liblapack

LinearSolve.useblis() = true

function getrf!(A::AbstractMatrix{<:ComplexF64};
ipiv = similar(A, BlasInt, min(size(A, 1), size(A, 2))),
info = Ref{BlasInt}(),
Expand Down
2 changes: 2 additions & 0 deletions ext/LinearSolveCUDAExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ using LinearSolve: LinearSolve, is_cusparse, defaultalg, cudss_loaded, DefaultLi
using LinearSolve.LinearAlgebra, LinearSolve.SciMLBase, LinearSolve.ArrayInterface
using SciMLBase: AbstractSciMLOperator

LinearSolve.usecuda() = CUDA.functional()

function LinearSolve.is_cusparse(A::Union{
CUDA.CUSPARSE.CuSparseMatrixCSR, CUDA.CUSPARSE.CuSparseMatrixCSC})
true
Expand Down
6 changes: 6 additions & 0 deletions ext/LinearSolveMetalExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ using SciMLBase: AbstractSciMLOperator
using LinearSolve: ArrayInterface, MKLLUFactorization, MetalOffload32MixedLUFactorization,
@get_cacheval, LinearCache, SciMLBase, OperatorAssumptions

@static if Sys.isapple()

LinearSolve.usemetal() = true

end

default_alias_A(::MetalLUFactorization, ::Any, ::Any) = false
default_alias_b(::MetalLUFactorization, ::Any, ::Any) = false

Expand Down
15 changes: 3 additions & 12 deletions src/LinearSolve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -433,18 +433,9 @@ const HAS_APPLE_ACCELERATE = Ref(false)
appleaccelerate_isavailable() = HAS_APPLE_ACCELERATE[]

# Extension availability checking functions
useblis() = Base.get_extension(@__MODULE__, :LinearSolveBLISExt) !== nothing
function usecuda()
ext = Base.get_extension(@__MODULE__, :LinearSolveCUDAExt)
!isnothing(ext) && ext.CUDA.functional()
end

# Metal is only available on Apple platforms
@static if !Sys.isapple()
usemetal() = false
else
usemetal() = Base.get_extension(@__MODULE__, :LinearSolveMetalExt) !== nothing
end
useblis() = false
usecuda() = false
usemetal() = false

PrecompileTools.@compile_workload begin
A = rand(4, 4)
Expand Down
Loading