Skip to content

Sparse Jacobian preparation with mixed mode AD and GreedyColoringAlgorithm(; postprocessing=true) fails #857

@SouthEndMusic

Description

@SouthEndMusic

MWE:

using DifferentiationInterface
using SparseConnectivityTracer
using SparseMatrixColorings
using ADTypes
import ForwardDiff
import Mooncake

sparsity_detector = TracerSparsityDetector()

function f!(y, x)
    y .= x
end

backend = AutoSparse(
    MixedMode(AutoForwardDiff(), AutoMooncake());
    sparsity_detector,
    coloring_algorithm=GreedyColoringAlgorithm(; postprocessing=true)
)

N = 50
x = zeros(N)
y = zeros(N)

jac_prep = prepare_jacobian(f!, y, backend, x)

Stack trace:

ERROR: ArgumentError: `stack` on an empty collection is not allowed
Stacktrace:
  [1] _empty_stack(::Function, ::Vararg{Any})
    @ Base .\abstractarray.jl:2994
  [2] _typed_stack(::Colon, ::Type{…}, ::Type{…}, A::Base.Generator{…}, Aax::Tuple{…})
    @ Base .\abstractarray.jl:2909
  [3] _typed_stack
    @ .\abstractarray.jl:2936 [inlined]
  [4] _typed_stack
    @ .\abstractarray.jl:2930 [inlined]
  [5] _stack
    @ .\abstractarray.jl:2898 [inlined]
  [6] _stack
    @ .\abstractarray.jl:2890 [inlined]
  [7] stack
    @ .\abstractarray.jl:2887 [inlined]
  [8] _prepare_mixed_sparse_jacobian_aux_aux(::Val{…}, ::DifferentiationInterface.BatchSizeSettings{…}, ::DifferentiationInterface.BatchSizeSettings{…}, ::SparseMatrixCSC{…}, ::SparseMatrixColorings.BicoloringResult{…}, ::Vector{…}, ::Tuple{…}, ::AutoSparse{…}, ::Vector{…})
    @ DifferentiationInterfaceSparseMatrixColoringsExt C:\ProgramData\DEVDrives\.julia\packages\DifferentiationInterface\TuoGH\ext\DifferentiationInterfaceSparseMatrixColoringsExt\jacobian_mixed.jl:117

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions