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

AD error when using Optimization generated grad function #883

Open
Savya2105 opened this issue Mar 14, 2025 · 2 comments
Open

AD error when using Optimization generated grad function #883

Savya2105 opened this issue Mar 14, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@Savya2105
Copy link

Describe the bug 🐞

Error in AD when using the Optimization generated grad function. Works fine if we set autodiff=false within the solver. Also does not give the similar issue when using DifferentiationInterface.

Expected behavior

Should output the solution to the problem below something like this

Optimized solution:[0.9999991957829596, 0.9999983883484281]

Minimal Reproducible Example 👇

using DifferentialEquations, Optimization

function rosenbrock(u, p)
    (p[1] - u[1])^2 + p[2] * (u[2] - u[1]^2)^2
end

function create_prob()
    u0 = zeros(2)
    p = [1.0, 100.0]
    optf = OptimizationFunction(rosenbrock, AutoForwardDiff())
    prob = OptimizationProblem(optf, u0, p)
    return prob
end

function solve_prob(prob)
    u0, p = prob.u0, prob.p
    opt_cache = Optimization.OptimizationCache(prob, Optimization.LBFGS())
    optf = opt_cache.f
    
    function gradient_flow!(du, u, p, t)
        optf.grad(du, u, p)
        du .= -du
    end
    
    ode_prob = SteadyStateProblem(gradient_flow!, u0, p)
    sol = solve(ode_prob, DynamicSS(Rodas5()); maxiters=Int(1e6))
    return sol.u
end

function main()
    prob = create_prob()
    solution = solve_prob(prob)
    println("Optimized solution:", solution)
end

main()

Error & Stacktrace ⚠️

ERROR: First call to automatic differentiation for the Jacobian
failed. This means that the user `f` function is not compatible
with automatic differentiation. Methods to fix this include:

1. Turn off automatic differentiation (e.g. Rosenbrock23() becomes
   Rosenbrock23(autodiff=false)). More details can befound at
   https://docs.sciml.ai/DiffEqDocs/stable/features/performance_overloads/
2. Improving the compatibility of `f` with ForwardDiff.jl automatic
   differentiation (using tools like PreallocationTools.jl). More details
   can be found at https://docs.sciml.ai/DiffEqDocs/stable/basics/faq/#Autodifferentiation-and-Dual-Numbers
3. Defining analytical Jacobians. More details can be
   found at https://docs.sciml.ai/DiffEqDocs/stable/types/ode_types/#SciMLBase.ODEFunction

Note: turning off automatic differentiation tends to have a very minimal
performance impact (for this use case, because it's forward mode for a
square Jacobian. This is different from optimization gradient scenarios).
However, one should be careful as some methods are more sensitive to
accurate gradients than others. Specifically, Rodas methods like `Rodas4`
and `Rodas5P` require accurate Jacobians in order to have good convergence,
while many other methods like BDF (`QNDF`, `FBDF`), SDIRK (`KenCarp4`),
and Rosenbrock-W (`Rosenbrock23`) do not. Thus if using an algorithm which
is sensitive to autodiff and solving at a low tolerance, please change the
algorithm as well.

Invalid Tag object:
  Expected ForwardDiff.Tag{DifferentiationInterface.FixTail{typeof(rosenbrock), Tuple{Vector{Float64}}}, ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 2}},
  Observed ForwardDiff.Tag{DifferentiationInterface.FixTail{typeof(rosenbrock), Tuple{Vector{Float64}}}, Float64}.
Stacktrace:
  [1] WARNING: both NonlinearSolve and JumpProcesses export "NormTerminationMode"; uses of it in module DifferentialEquations must be qualified
jacobian!(J::Matrix{…}, f::SciMLBase.UJacobianWrapper{…}, x::Vector{…}, fx::Vector{…}, integrator::OrdinaryDiffEqCore.ODEIntegrator{…}, jac_config::SparseDiffTools.ForwardColorJacCache{…})
    @ OrdinaryDiffEqDifferentiation ~/.julia/packages/OrdinaryDiffEqDifferentiation/6Bzim/src/derivative_wrappers.jl:238
  [2] calc_J!
    @ ~/.julia/packages/OrdinaryDiffEqDifferentiation/6Bzim/src/derivative_utils.jl:152 [inlined]
  [3] calc_W!
    @ ~/.julia/packages/OrdinaryDiffEqDifferentiation/6Bzim/src/derivative_utils.jl:557 [inlined]
  [4] calc_W!
    @ ~/.julia/packages/OrdinaryDiffEqDifferentiation/6Bzim/src/derivative_utils.jl:495 [inlined]
  [5] calc_rosenbrock_differentiation!
    @ ~/.julia/packages/OrdinaryDiffEqDifferentiation/6Bzim/src/derivative_utils.jl:631 [inlined]
  [6] perform_step!(integrator::OrdinaryDiffEqCore.ODEIntegrator{…}, cache::OrdinaryDiffEqRosenbrock.RosenbrockCache{…}, repeat_step::Bool)
    @ OrdinaryDiffEqRosenbrock ~/.julia/packages/OrdinaryDiffEqRosenbrock/TfqbQ/src/rosenbrock_perform_step.jl:1337
  [7] perform_step!
    @ ~/.julia/packages/OrdinaryDiffEqRosenbrock/TfqbQ/src/rosenbrock_perform_step.jl:1320 [inlined]
  [8] solve!(integrator::OrdinaryDiffEqCore.ODEIntegrator{…})
    @ OrdinaryDiffEqCore ~/.julia/packages/OrdinaryDiffEqCore/vS7Uo/src/solve.jl:620
  [9] #__solve#62
    @ ~/.julia/packages/OrdinaryDiffEqCore/vS7Uo/src/solve.jl:7 [inlined]
 [10] __solve
    @ ~/.julia/packages/OrdinaryDiffEqCore/vS7Uo/src/solve.jl:1 [inlined]
 [11] solve_call(_prob::ODEProblem{…}, args::Rodas5{…}; merge_callbacks::Bool, kwargshandle::Nothing, kwargs::@Kwargs{})
    @ DiffEqBase ~/.julia/packages/DiffEqBase/PbBEl/src/solve.jl:635
 [12] #solve_up#44
    @ ~/.julia/packages/DiffEqBase/PbBEl/src/solve.jl:1128 [inlined]
 [13] solve_up
    @ ~/.julia/packages/DiffEqBase/PbBEl/src/solve.jl:1106 [inlined]
 [14] solve(prob::ODEProblem{…}, args::Rodas5{…}; sensealg::Nothing, u0::Nothing, p::Nothing, wrap::Val{…}, kwargs::@Kwargs{})
    @ DiffEqBase ~/.julia/packages/DiffEqBase/PbBEl/src/solve.jl:1043
 [15] solve
    @ ~/.julia/packages/DiffEqBase/PbBEl/src/solve.jl:1033 [inlined]
 [16] __solve(::SteadyStateProblem{…}, ::DynamicSS{…}; abstol::Float64, reltol::Float64, odesolve_kwargs::@NamedTuple{}, save_idxs::Nothing, termination_condition::DiffEqBase.NormTerminationMode{…}, kwargs::@Kwargs{})
    @ SteadyStateDiffEq ~/.julia/packages/SteadyStateDiffEq/KVNLU/src/solve.jl:56
 [17] __solve
    @ ~/.julia/packages/SteadyStateDiffEq/KVNLU/src/solve.jl:16 [inlined]
 [18] #solve_call#35
    @ ~/.julia/packages/DiffEqBase/PbBEl/src/solve.jl:635 [inlined]
 [19] solve_up(prob::SteadyStateProblem{…}, sensealg::Nothing, u0::Vector{…}, p::Vector{…}, args::DynamicSS{…}; kwargs::@Kwargs{})
    @ DiffEqBase ~/.julia/packages/DiffEqBase/PbBEl/src/solve.jl:1128
 [20] solve_up
    @ ~/.julia/packages/DiffEqBase/PbBEl/src/solve.jl:1106 [inlined]
 [21] solve(prob::SteadyStateProblem{…}, args::DynamicSS{…}; sensealg::Nothing, u0::Nothing, p::Nothing, wrap::Val{…}, kwargs::@Kwargs{})
    @ DiffEqBase ~/.julia/packages/DiffEqBase/PbBEl/src/solve.jl:1043
 [22] solve_prob(prob::OptimizationProblem{…})
    @ Main ~/Documents/julia/optf_grad.jl:26
 [23] main()
    @ Main ~/Documents/julia/optf_grad.jl:32
 [24] top-level scope
    @ ~/Documents/julia/optf_grad.jl:36

caused by: Invalid Tag object:
  Expected ForwardDiff.Tag{DifferentiationInterface.FixTail{typeof(rosenbrock), Tuple{Vector{Float64}}}, ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 2}},
  Observed ForwardDiff.Tag{DifferentiationInterface.FixTail{typeof(rosenbrock), Tuple{Vector{Float64}}}, Float64}.
Stacktrace:
  [1] checktag(::Type{…}, f::DifferentiationInterface.FixTail{…}, x::Vector{…})
    @ ForwardDiff ~/.julia/packages/ForwardDiff/UBbGT/src/config.jl:34
  [2] gradient!(result::Vector{…}, f::DifferentiationInterface.FixTail{…}, x::Vector{…}, cfg::ForwardDiff.GradientConfig{…}, ::Val{…})
    @ ForwardDiff ~/.julia/packages/ForwardDiff/UBbGT/src/gradient.jl:37
  [3] gradient!(f::typeof(rosenbrock), grad::Vector{…}, prep::DifferentiationInterfaceForwardDiffExt.ForwardDiffGradientPrep{…}, backend::AutoForwardDiff{…}, x::Vector{…}, contexts::DifferentiationInterface.Constant{…})
    @ DifferentiationInterfaceForwardDiffExt ~/.julia/packages/DifferentiationInterface/qrWdQ/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl:362
  [4] (::OptimizationBase.var"#grad#16"{})(res::Vector{…}, θ::Vector{…}, p::Vector{…})
    @ OptimizationBase ~/.julia/packages/OptimizationBase/gvXsf/src/OptimizationDIExt.jl:32
  [5] (::var"#gradient_flow!#13"{})(du::Vector{…}, u::Vector{…}, p::Vector{…}, t::Float64)
    @ Main ~/Documents/julia/optf_grad.jl:21
  [6] ODEFunction (repeats 2 times)
    @ ~/.julia/packages/SciMLBase/sYmAV/src/scimlfunctions.jl:2468 [inlined]
  [7] UJacobianWrapper
    @ ~/.julia/packages/SciMLBase/sYmAV/src/function_wrappers.jl:32 [inlined]
  [8] forwarddiff_color_jacobian!(J::Matrix{…}, f::SciMLBase.UJacobianWrapper{…}, x::Vector{…}, jac_cache::SparseDiffTools.ForwardColorJacCache{…})
    @ SparseDiffTools ~/.julia/packages/SparseDiffTools/rjbzw/src/differentiation/compute_jacobian_ad.jl:376
  [9] jacobian!(J::Matrix{…}, f::SciMLBase.UJacobianWrapper{…}, x::Vector{…}, fx::Vector{…}, integrator::OrdinaryDiffEqCore.ODEIntegrator{…}, jac_config::SparseDiffTools.ForwardColorJacCache{…})
    @ OrdinaryDiffEqDifferentiation ~/.julia/packages/OrdinaryDiffEqDifferentiation/6Bzim/src/derivative_wrappers.jl:236
 [10] calc_J!
    @ ~/.julia/packages/OrdinaryDiffEqDifferentiation/6Bzim/src/derivative_utils.jl:152 [inlined]
 [11] calc_W!
    @ ~/.julia/packages/OrdinaryDiffEqDifferentiation/6Bzim/src/derivative_utils.jl:557 [inlined]
 [12] calc_W!
    @ ~/.julia/packages/OrdinaryDiffEqDifferentiation/6Bzim/src/derivative_utils.jl:495 [inlined]
 [13] calc_rosenbrock_differentiation!
    @ ~/.julia/packages/OrdinaryDiffEqDifferentiation/6Bzim/src/derivative_utils.jl:631 [inlined]
 [14] perform_step!(integrator::OrdinaryDiffEqCore.ODEIntegrator{…}, cache::OrdinaryDiffEqRosenbrock.RosenbrockCache{…}, repeat_step::Bool)
    @ OrdinaryDiffEqRosenbrock ~/.julia/packages/OrdinaryDiffEqRosenbrock/TfqbQ/src/rosenbrock_perform_step.jl:1337
 [15] perform_step!
    @ ~/.julia/packages/OrdinaryDiffEqRosenbrock/TfqbQ/src/rosenbrock_perform_step.jl:1320 [inlined]
 [16] solve!(integrator::OrdinaryDiffEqCore.ODEIntegrator{…})
    @ OrdinaryDiffEqCore ~/.julia/packages/OrdinaryDiffEqCore/vS7Uo/src/solve.jl:620
 [17] #__solve#62
    @ ~/.julia/packages/OrdinaryDiffEqCore/vS7Uo/src/solve.jl:7 [inlined]
 [18] __solve
    @ ~/.julia/packages/OrdinaryDiffEqCore/vS7Uo/src/solve.jl:1 [inlined]
 [19] solve_call(_prob::ODEProblem{…}, args::Rodas5{…}; merge_callbacks::Bool, kwargshandle::Nothing, kwargs::@Kwargs{})
    @ DiffEqBase ~/.julia/packages/DiffEqBase/PbBEl/src/solve.jl:635
 [20] #solve_up#44
    @ ~/.julia/packages/DiffEqBase/PbBEl/src/solve.jl:1128 [inlined]
 [21] solve_up
    @ ~/.julia/packages/DiffEqBase/PbBEl/src/solve.jl:1106 [inlined]
 [22] solve(prob::ODEProblem{…}, args::Rodas5{…}; sensealg::Nothing, u0::Nothing, p::Nothing, wrap::Val{…}, kwargs::@Kwargs{})
    @ DiffEqBase ~/.julia/packages/DiffEqBase/PbBEl/src/solve.jl:1043
 [23] solve
    @ ~/.julia/packages/DiffEqBase/PbBEl/src/solve.jl:1033 [inlined]
 [24] __solve(::SteadyStateProblem{…}, ::DynamicSS{…}; abstol::Float64, reltol::Float64, odesolve_kwargs::@NamedTuple{}, save_idxs::Nothing, termination_condition::DiffEqBase.NormTerminationMode{…}, kwargs::@Kwargs{})
    @ SteadyStateDiffEq ~/.julia/packages/SteadyStateDiffEq/KVNLU/src/solve.jl:56
 [25] __solve
    @ ~/.julia/packages/SteadyStateDiffEq/KVNLU/src/solve.jl:16 [inlined]
 [26] #solve_call#35
    @ ~/.julia/packages/DiffEqBase/PbBEl/src/solve.jl:635 [inlined]
 [27] solve_up(prob::SteadyStateProblem{…}, sensealg::Nothing, u0::Vector{…}, p::Vector{…}, args::DynamicSS{…}; kwargs::@Kwargs{})
    @ DiffEqBase ~/.julia/packages/DiffEqBase/PbBEl/src/solve.jl:1128
 [28] solve_up
    @ ~/.julia/packages/DiffEqBase/PbBEl/src/solve.jl:1106 [inlined]
 [29] solve(prob::SteadyStateProblem{…}, args::DynamicSS{…}; sensealg::Nothing, u0::Nothing, p::Nothing, wrap::Val{…}, kwargs::@Kwargs{})
    @ DiffEqBase ~/.julia/packages/DiffEqBase/PbBEl/src/solve.jl:1043
 [30] solve_prob(prob::OptimizationProblem{…})
    @ Main ~/Documents/julia/optf_grad.jl:26
 [31] main()
    @ Main ~/Documents/julia/optf_grad.jl:32
 [32] top-level scope
    @ ~/Documents/julia/optf_grad.jl:36
Some type information was truncated. Use `show(err)` to see complete types.

After setting autodiff=false(works fine)

using DifferentialEquations, Optimization

function rosenbrock(u, p)
    (p[1] - u[1])^2 + p[2] * (u[2] - u[1]^2)^2
end

function create_prob()
    u0 = zeros(2)
    p = [1.0, 100.0]
    optf = OptimizationFunction(rosenbrock, AutoForwardDiff())
    prob = OptimizationProblem(optf, u0, p)
    return prob
end

function solve_prob(prob)
    u0, p = prob.u0, prob.p
    opt_cache = Optimization.OptimizationCache(prob, Optimization.LBFGS())
    optf = opt_cache.f
    
    function gradient_flow!(du, u, p, t)
        optf.grad(du, u, p)
        du .= -du
    end
    
    ode_prob = SteadyStateProblem(gradient_flow!, u0, p)
    sol = solve(ode_prob, DynamicSS(Rodas5(autodiff=false)); maxiters=Int(1e6))
    return sol.u
end

function main()
    prob = create_prob()
    solution = solve_prob(prob)
    println("Optimized solution:", solution)
end

main()

DI code(also works fine)

using DifferentialEquations, Optimization, DifferentiationInterface, ForwardDiff

function rosenbrock(u, p)
    (p[1] - u[1])^2 + p[2] * (u[2] - u[1]^2)^2
end

function create_prob()
    u0 = zeros(2)
    p = [1.0, 100.0]
    optf = OptimizationFunction(rosenbrock, AutoForwardDiff())
    prob = OptimizationProblem(optf, u0, p)
    return prob
end

function solve_prob(prob)
    u0, p = prob.u0, prob.p    
    backend = AutoForwardDiff()
    function gradient_flow!(du, u, p, t)
        f = x -> rosenbrock(x, p)
        grad = gradient(f, backend, u)
        du .= -grad
    end
    ode_prob = SteadyStateProblem(gradient_flow!, u0, p)
    sol = solve(ode_prob, DynamicSS(Rodas5()); maxiters=Int(1e6))
    return sol.u
end

function main()
    prob = create_prob()
    solution = solve_prob(prob)
    println("Optimized solution:", solution)
end

main()

Environment (please complete the following information):

  • Output of using Pkg; Pkg.status()
julia> using Pkg; Pkg.status()
Status `~/.julia/environments/v1.10/Project.toml`
  [0c46a032] DifferentialEquations v7.16.0
  [a0c0ee7d] DifferentiationInterface v0.6.43
  [f6369f11] ForwardDiff v0.10.38
  [7f7a1694] Optimization v4.1.1
  [36348300] OptimizationOptimJL v0.4.1
  [0bca4576] SciMLBase v2.75.1
⌃ [e88e6eb3] Zygote v0.6.75
Info Packages marked with ⌃ have new versions available and may be upgradable.
  • Output of using Pkg; Pkg.status(; mode = PKGMODE_MANIFEST)
julia> using Pkg; Pkg.status(; mode = PKGMODE_MANIFEST)
Status `~/.julia/environments/v1.10/Manifest.toml`
  [47edcb42] ADTypes v1.14.0
  [621f4979] AbstractFFTs v1.5.0
  [1520ce14] AbstractTrees v0.4.5
  [7d9f7c33] Accessors v0.1.42
⌃ [79e6a3ab] Adapt v4.2.0
  [66dad0bd] AliasTables v1.1.3
  [a95523ee] AlmostBlockDiagonals v0.1.10
  [ec485272] ArnoldiMethod v0.4.0
  [4fba245c] ArrayInterface v7.18.0
  [4c555306] ArrayLayouts v1.11.1
  [a9b6321e] Atomix v1.1.1
⌃ [aae01518] BandedMatrices v1.9.2
  [62783981] BitTwiddlingConvenienceFunctions v0.1.6
  [764a87c0] BoundaryValueDiffEq v5.16.0
  [7227322d] BoundaryValueDiffEqAscher v1.5.0
  [56b672f2] BoundaryValueDiffEqCore v1.8.0
  [85d9eb09] BoundaryValueDiffEqFIRK v1.6.0
  [1a22d4ce] BoundaryValueDiffEqMIRK v1.6.0
  [9255f1d6] BoundaryValueDiffEqMIRKN v1.5.0
  [ed55bfe0] BoundaryValueDiffEqShooting v1.6.0
  [70df07ce] BracketingNonlinearSolve v1.1.0
  [fa961155] CEnum v0.5.0
  [2a0fbf3d] CPUSummary v0.2.6
  [082447d4] ChainRules v1.72.3
  [d360d2e6] ChainRulesCore v1.25.1
  [fb6a15b2] CloseOpenIntervals v0.1.13
  [38540f10] CommonSolve v0.2.4
  [bbf7d656] CommonSubexpressions v0.3.1
  [f70d9fcc] CommonWorldInvalidations v1.0.0
  [34da2185] Compat v4.16.0
  [a33af91c] CompositionsBase v0.1.2
  [2569d6c7] ConcreteStructs v0.2.3
  [88cd18e8] ConsoleProgressMonitor v0.1.2
  [187b0558] ConstructionBase v1.5.8
  [adafc99b] CpuId v0.3.1
  [9a962f9c] DataAPI v1.16.0
  [864edb3b] DataStructures v0.18.20
  [e2d170a0] DataValueInterfaces v1.0.0
  [bcd4f6db] DelayDiffEq v5.52.0
  [2b5f629d] DiffEqBase v6.164.2
  [459566f4] DiffEqCallbacks v4.3.0
  [77a26b50] DiffEqNoiseProcess v5.24.1
  [163ba53b] DiffResults v1.1.0
  [b552c78f] DiffRules v1.15.1
  [0c46a032] DifferentialEquations v7.16.0
  [a0c0ee7d] DifferentiationInterface v0.6.43
  [b4f34e82] Distances v0.10.12
⌃ [31c24e10] Distributions v0.25.117
  [ffbed154] DocStringExtensions v0.9.3
  [4e289a0a] EnumX v1.0.4
  [f151be2c] EnzymeCore v0.8.8
  [d4d017d3] ExponentialUtilities v1.27.0
  [e2ba6199] ExprTools v0.1.10
  [55351af7] ExproniconLite v0.10.14
  [9d29842c] FastAlmostBandedMatrices v0.1.4
  [7034ab61] FastBroadcast v0.3.5
  [9aa1b823] FastClosures v0.3.2
  [442a2c76] FastGaussQuadrature v1.0.2
  [a4df4552] FastPower v1.1.1
  [1a297f60] FillArrays v1.13.0
  [6a86dc24] FiniteDiff v2.27.0
  [f6369f11] ForwardDiff v0.10.38
  [069b7b12] FunctionWrappers v1.1.3
  [77dc65aa] FunctionWrappersWrappers v0.1.3
  [d9f16b24] Functors v0.5.2
  [0c68f7d7] GPUArrays v11.2.2
  [46192b85] GPUArraysCore v0.2.0
  [c145ed77] GenericSchur v0.5.4
  [86223c79] Graphs v1.12.0
  [076d061b] HashArrayMappedTries v0.2.0
  [34004b35] HypergeometricFunctions v0.3.27
  [7869d1d1] IRTools v0.4.14
  [615f187c] IfElse v0.1.1
  [d25df0c9] Inflate v0.1.5
  [3587e190] InverseFunctions v0.1.17
  [92d709cd] IrrationalConstants v0.2.4
  [82899510] IteratorInterfaceExtensions v1.0.0
  [692b3bcd] JLLWrappers v1.7.0
  [ae98c720] Jieko v0.2.1
  [ccbc3e58] JumpProcesses v9.14.2
  [63c18a36] KernelAbstractions v0.9.34
  [ba0b0d4f] Krylov v0.9.10
  [5be7bae1] LBFGSB v0.4.1
  [929cbde3] LLVM v9.2.0
  [10f19ff3] LayoutPointers v0.1.17
  [5078a376] LazyArrays v2.6.1
  [1d6d02ad] LeftChildRightSiblingTrees v0.2.0
  [2d8b4e74] LevyArea v1.0.0
  [87fe0de2] LineSearch v0.1.4
  [d3d80556] LineSearches v7.3.0
  [7ed4a6bd] LinearSolve v3.4.0
  [2ab3a3ac] LogExpFunctions v0.3.29
  [e6f89c97] LoggingExtras v1.1.0
  [1914dd2f] MacroTools v0.5.15
  [d125e4d3] ManualMemory v0.1.8
  [a3b82374] MatrixFactorizations v3.0.1
  [bb5d69b7] MaybeInplace v0.1.4
  [e1d29d7a] Missings v1.2.0
  [2e0e35c7] Moshi v0.3.5
  [46d2c3a1] MuladdMacro v0.2.4
  [d41bc354] NLSolversBase v7.8.3
  [2774e3e8] NLsolve v4.5.1
  [77ba4419] NaNMath v1.1.2
  [8913a72c] NonlinearSolve v4.4.0
  [be0214bd] NonlinearSolveBase v1.5.0
  [5959db7a] NonlinearSolveFirstOrder v1.3.0
  [9a2c21bd] NonlinearSolveQuasiNewton v1.2.0
  [26075421] NonlinearSolveSpectralMethods v1.1.0
  [429524aa] Optim v1.11.0
  [7f7a1694] Optimization v4.1.1
  [bca83a33] OptimizationBase v2.4.0
  [36348300] OptimizationOptimJL v0.4.1
  [bac558e1] OrderedCollections v1.8.0
  [1dea7af3] OrdinaryDiffEq v6.92.0
  [89bda076] OrdinaryDiffEqAdamsBashforthMoulton v1.2.0
  [6ad6398a] OrdinaryDiffEqBDF v1.3.0
  [bbf590c4] OrdinaryDiffEqCore v1.19.0
  [50262376] OrdinaryDiffEqDefault v1.3.0
  [4302a76b] OrdinaryDiffEqDifferentiation v1.4.0
  [9286f039] OrdinaryDiffEqExplicitRK v1.1.0
  [e0540318] OrdinaryDiffEqExponentialRK v1.4.0
  [becaefa8] OrdinaryDiffEqExtrapolation v1.5.0
  [5960d6e9] OrdinaryDiffEqFIRK v1.8.0
  [101fe9f7] OrdinaryDiffEqFeagin v1.1.0
  [d3585ca7] OrdinaryDiffEqFunctionMap v1.1.1
  [d28bc4f8] OrdinaryDiffEqHighOrderRK v1.1.0
  [9f002381] OrdinaryDiffEqIMEXMultistep v1.3.0
  [521117fe] OrdinaryDiffEqLinear v1.1.0
  [1344f307] OrdinaryDiffEqLowOrderRK v1.2.0
  [b0944070] OrdinaryDiffEqLowStorageRK v1.2.1
  [127b3ac7] OrdinaryDiffEqNonlinearSolve v1.5.0
  [c9986a66] OrdinaryDiffEqNordsieck v1.1.0
  [5dd0a6cf] OrdinaryDiffEqPDIRK v1.3.0
  [5b33eab2] OrdinaryDiffEqPRK v1.1.0
  [04162be5] OrdinaryDiffEqQPRK v1.1.0
  [af6ede74] OrdinaryDiffEqRKN v1.1.0
  [43230ef6] OrdinaryDiffEqRosenbrock v1.7.0
  [2d112036] OrdinaryDiffEqSDIRK v1.3.0
  [669c94d9] OrdinaryDiffEqSSPRK v1.2.0
  [e3e12d00] OrdinaryDiffEqStabilizedIRK v1.3.0
  [358294b1] OrdinaryDiffEqStabilizedRK v1.1.0
  [fa646aed] OrdinaryDiffEqSymplecticRK v1.3.0
  [b1df2697] OrdinaryDiffEqTsit5 v1.1.0
  [79d7bb75] OrdinaryDiffEqVerner v1.1.1
  [90014a1f] PDMats v0.11.32
  [65ce6f38] PackageExtensionCompat v1.0.2
  [d96e819e] Parameters v0.12.3
  [e409e4f3] PoissonRandom v0.4.4
  [f517fe37] Polyester v0.7.16
  [1d0040c9] PolyesterWeave v0.2.2
  [85a6dd25] PositiveFactorizations v0.2.4
  [d236fae5] PreallocationTools v0.4.25
  [aea7be01] PrecompileTools v1.2.1
  [21216c6a] Preferences v1.4.3
  [33c8b6b6] ProgressLogging v0.1.4
  [92933f4c] ProgressMeter v1.10.2
  [43287f4e] PtrArrays v1.3.0
  [1fd47b50] QuadGK v2.11.2
  [74087812] Random123 v1.7.0
  [e6cf234a] RandomNumbers v1.6.0
  [c1ae055f] RealDot v0.1.0
  [3cdcf5f2] RecipesBase v1.3.4
  [731186ca] RecursiveArrayTools v3.31.0
  [189a3867] Reexport v1.2.2
  [ae029012] Requires v1.3.1
  [ae5879a3] ResettableStacks v1.1.1
  [79098fc4] Rmath v0.8.0
  [7e49a35a] RuntimeGeneratedFunctions v0.5.13
  [94e857df] SIMDTypes v0.1.0
  [0bca4576] SciMLBase v2.75.1
  [19f34311] SciMLJacobianOperators v0.1.1
  [c0aeaf25] SciMLOperators v0.3.12
  [53ae85a6] SciMLStructures v1.7.0
  [7e506255] ScopedValues v1.3.0
  [efcf1570] Setfield v1.1.2
  [727e6d20] SimpleNonlinearSolve v2.1.0
  [699a6c99] SimpleTraits v0.9.4
  [ce78b400] SimpleUnPack v1.1.0
  [a2af1166] SortingAlgorithms v1.2.1
⌃ [9f842d2f] SparseConnectivityTracer v0.6.13
  [47a9eef4] SparseDiffTools v2.23.1
  [dc90abb0] SparseInverseSubset v0.1.2
  [0a514795] SparseMatrixColorings v0.4.14
  [276daf66] SpecialFunctions v2.5.0
⌃ [aedffcd0] Static v1.1.1
  [0d7ed370] StaticArrayInterface v1.8.0
  [90137ffa] StaticArrays v1.9.13
  [1e83bf80] StaticArraysCore v1.4.3
  [82ae8749] StatsAPI v1.7.0
  [2913bbd2] StatsBase v0.34.4
  [4c63d2b9] StatsFuns v1.3.2
  [9672c7b4] SteadyStateDiffEq v2.4.1
  [789caeaf] StochasticDiffEq v6.74.0
  [7792a7ef] StrideArraysCore v0.5.7
  [09ab397b] StructArrays v0.7.0
  [c3572dad] Sundials v4.26.1
  [2efcf032] SymbolicIndexingInterface v0.3.38
  [3783bdb8] TableTraits v1.0.1
  [bd369af6] Tables v1.12.0
  [5d786b92] TerminalLoggers v0.1.7
  [8290d209] ThreadingUtilities v0.5.2
  [a759f4b9] TimerOutputs v0.5.28
  [781d530d] TruncatedStacktraces v1.4.0
  [3a884ed6] UnPack v1.0.2
  [013be700] UnsafeAtomics v0.3.0
  [19fa3120] VertexSafeGraphs v0.2.0
⌃ [e88e6eb3] Zygote v0.6.75
  [700de1a5] ZygoteRules v0.2.7
  [1d5cc7b8] IntelOpenMP_jll v2025.0.4+0
  [dad2f222] LLVMExtra_jll v0.0.35+0
  [81d17ec3] L_BFGS_B_jll v3.0.1+0
  [856f044c] MKL_jll v2025.0.1+1
  [efe28fd5] OpenSpecFun_jll v0.5.6+0
  [f50d1b31] Rmath_jll v0.5.1+0
⌅ [fb77eaff] Sundials_jll v5.2.2+0
  [1317d2d5] oneTBB_jll v2022.0.0+0
  [0dad84c5] ArgTools v1.1.1
  [56f22d72] Artifacts
  [2a0f44e3] Base64
  [ade2ca70] Dates
  [8ba89e20] Distributed
  [f43a241f] Downloads v1.6.0
  [7b1f6079] FileWatching
  [9fa8497b] Future
  [b77e0a4c] InteractiveUtils
  [4af54fe1] LazyArtifacts
  [b27032c2] LibCURL v0.6.4
  [76f85450] LibGit2
  [8f399da3] Libdl
  [37e2e46d] LinearAlgebra
  [56ddb016] Logging
  [d6f4376e] Markdown
  [a63ad114] Mmap
  [ca575930] NetworkOptions v1.2.0
  [44cfe95a] Pkg v1.10.0
  [de0858da] Printf
  [3fa0cd96] REPL
  [9a3f8284] Random
  [ea8e919c] SHA v0.7.0
  [9e88b42a] Serialization
  [1a1011a3] SharedArrays
  [6462fe0b] Sockets
  [2f01184e] SparseArrays v1.10.0
  [10745b16] Statistics v1.10.0
  [4607b0f0] SuiteSparse
  [fa267f1f] TOML v1.0.3
  [a4e569a6] Tar v1.10.0
  [cf7118a7] UUIDs
  [4ec0a83e] Unicode
  [e66e0078] CompilerSupportLibraries_jll v1.1.1+0
  [deac9b47] LibCURL_jll v8.4.0+0
  [e37daf67] LibGit2_jll v1.6.4+0
  [29816b5a] LibSSH2_jll v1.11.0+1
  [c8ffd9c3] MbedTLS_jll v2.28.2+1
  [14a3606d] MozillaCACerts_jll v2023.1.10
  [4536629a] OpenBLAS_jll v0.3.23+4
  [05823500] OpenLibm_jll v0.8.1+2
  [bea87d4a] SuiteSparse_jll v7.2.1+1
  [83775a58] Zlib_jll v1.2.13+1
  [8e850b90] libblastrampoline_jll v5.11.0+0
  [8e850ede] nghttp2_jll v1.52.0+1
  [3f19e933] p7zip_jll v17.4.0+2
Info Packages marked with ⌃ and ⌅ have new versions available. Those with ⌃ may be upgradable, but those with ⌅ are restricted by compatibility constraints from upgrading. To see why use `status --outdated -m`
  • Output of versioninfo()
julia> versioninfo()
Julia Version 1.10.8
Commit 4c16ff44be8 (2025-01-22 10:06 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: macOS (arm64-apple-darwin24.0.0)
  CPU: 8 × Apple M3
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, apple-m1)
Threads: 1 default, 0 interactive, 1 GC (on 4 virtual cores)
Environment:
  JULIA_EDITOR = code
  JULIA_NUM_THREADS = 

Additional context

Add any other context about the problem here.

@Savya2105 Savya2105 added the bug Something isn't working label Mar 14, 2025
@ChrisRackauckas
Copy link
Member

@Vaibhavdixit02 do you know what could cause this?

@Vaibhavdixit02
Copy link
Member

Looks like mismatched FD tags. The manual construction of the OptimizationCache is pretty suspicious here I wouldn't recommend that. I am not on my computer right now to run it but avoiding that might do the trick

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants