Skip to content

Commit

Permalink
Fix defaultalg method ambiguity for SciMLOp + GPUArray
Browse files Browse the repository at this point in the history
should fix this error
```julia
Candidates:                                                                                                                                                        
  defaultalg(A::SciMLOperators.AbstractSciMLOperator, b, assump::LinearSolve.OperatorAssumptions)
    @ LinearSolve ~/.julia/packages/LinearSolve/Rq2MY/src/default.jl:132                                                                                           
  defaultalg(A, b::GPUArraysCore.AbstractGPUArray, assump::LinearSolve.OperatorAssumptions)                                   
    @ LinearSolve ~/.julia/packages/LinearSolve/Rq2MY/src/default.jl:106

Possible fix, define
  defaultalg(::SciMLOperators.AbstractSciMLOperator, ::GPUArraysCore.AbstractGPUArray, ::LinearSolve.OperatorAssumptions)

```
  • Loading branch information
vpuri3 authored Oct 2, 2023
1 parent 0f21a9d commit 93a5dc2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/default.jl
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ function defaultalg(A::GPUArraysCore.AbstractGPUArray, b::GPUArraysCore.Abstract
end
end

function defaultalg(A::SciMLBase.AbstractSciMLOperator, b,
function _defaultalg_scimlops(A::SciMLBase.AbstractSciMLOperator, b,
assump::OperatorAssumptions)
if has_ldiv!(A)
return DefaultLinearSolver(DefaultAlgorithmChoice.DirectLdiv!)
Expand All @@ -145,6 +145,9 @@ function defaultalg(A::SciMLBase.AbstractSciMLOperator, b,
end
end

defaultalg(A::SciMLBase.AbstractSciMLOperator, b, assump::OperatorAssumptions) = _defaultalg_scimlops(A, b, assump)
defaultalg(A::SciMLBase.AbstractSciMLOperator, b::GPUArraysCore.AbstractGPUArray, assump::OperatorAssumptions) = _defaultalg_scimlops(A, b, assump)

Check warning on line 149 in src/default.jl

View check run for this annotation

Codecov / codecov/patch

src/default.jl#L149

Added line #L149 was not covered by tests

# Allows A === nothing as a stand-in for dense matrix
function defaultalg(A, b, assump::OperatorAssumptions)
alg = if assump.issq
Expand Down

0 comments on commit 93a5dc2

Please sign in to comment.