# Failing to precompile OptimizationBase

**URL:** <https://discourse.julialang.org/t/failing-to-precompile-optimizationbase/114926>\
**Category:** Package Management\
**Tags:** precompilation, optimization\
**Created:** [May 29, 2024, 4:16pm UTC](https://discourse.julialang.org/t/failing-to-precompile-optimizationbase/114926 "2024-05-29T16:16:50Z")\
**Posts on this page:** 13\
**Page:** 2

<div class="post-metadata">

**Author:** ![cefitzg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cefitzg/32/209724_2.png) [@cefitzg](https://discourse.julialang.org/u/cefitzg)\
**Post date:** [June 5, 2024, 5:32pm UTC](https://discourse.julialang.org/t/failing-to-precompile-optimizationbase/114926/21 "2024-06-05T17:32:15Z")

</div>

@Vaibhavdixit02, I will start fresh on the cluster when I install it and get latest versions. Has the change been made on your side? Let me know when it’s good so I can try installing again. Thanks for your quick help!

---

<div class="post-metadata">

**Author:** ![cefitzg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cefitzg/32/209724_2.png) [@cefitzg](https://discourse.julialang.org/u/cefitzg)\
**Post date:** [June 5, 2024, 6:31pm UTC](https://discourse.julialang.org/t/failing-to-precompile-optimizationbase/114926/22 "2024-06-05T18:31:22Z")

</div>

@Vaibhavdixit02, updated locally as well and still running into Enzyme precompile issues, just FYI.

---

<div class="post-metadata">

**Author:** ![gdalle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdalle/32/224680_2.png) [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Post date:** [June 5, 2024, 6:58pm UTC](https://discourse.julialang.org/t/failing-to-precompile-optimizationbase/114926/23 "2024-06-05T18:58:55Z")

</div>

That’s probably an unrelated issue:

> <https://github.com/EnzymeAD/Enzyme.jl/issues/1358>
>
> I wanted to use split reverse mode in order to compute pullbacks with array outp…uts. The only doc I found is 
> 
> \<https://enzymead.github.io/Enzyme.jl/stable/api/#EnzymeCore.autodiff\_thunk-Union{Tuple{RABI},%20Tuple{ModifiedBetweenT},%20Tuple{Width},%20Tuple{ReturnShadow},%20Tuple{ReturnPrimal},%20Tuple{A},%20Tuple{FA},%20Tuple{EnzymeCore.ReverseModeSplit{ReturnPrimal,%20ReturnShadow,%20Width,%20ModifiedBetweenT,%20RABI},%20Type{FA},%20Type{A},%20Vararg{Any}}}%20where%20{FA%3C:Annotation,%20A%3C:Annotation,%20ReturnPrimal,%20ReturnShadow,%20Width,%20ModifiedBetweenT,%20RABI%3C:EnzymeCore.ABI}\>
> 
> so I tried it but it fails on Julia 1.11:
> 
> \`\`\`julia
> julia\> using Enzyme
> 
> julia\> A = \[2.2\]; ∂A = zero(A)
> 1-element Vector{Float64}:
> 0.0
> 
> julia\> v = 3.3
> 3.3
> 
> julia\> function f(A, v)
> res = A\[1\] \* v
> A\[1\] = 0
> res
> end
> f (generic function with 1 method)
> 
> julia\> forward, reverse = autodiff\_thunk(ReverseSplitWithPrimal, Const{typeof(f)}, Active, Duplicated{typeof(A)}, Active{typeof(v)})
> ERROR: MethodError: no method matching get\_inference\_world(::Enzyme.Compiler.Interpreter.EnzymeInterpreter)
> The function \`get\_inference\_world\` exists, but no method is defined for this combination of argument types.
> 
> Closest candidates are:
> get\_inference\_world(::REPL.REPLCompletions.REPLInterpreter)
> @ REPL ~/.julia/juliaup/julia-1.11.0-alpha2+0.x64.linux.gnu/share/julia/stdlib/v1.11/REPL/src/REPLCompletions.jl:550
> get\_inference\_world(::Core.Compiler.NativeInterpreter)
> @ Core compiler/types.jl:402
> 
> Stacktrace:
> ⋮ internal @ Core.Compiler, Enzyme.Compiler, GPUCompiler, Core, Unknown
> \[11\] autodiff\_thunk(::EnzymeCore.ReverseModeSplit{true, true, 0, true, FFIABI}, ::Type{Const{typeof(f)}}, ::Type{Active}, ::Type, ::Vararg{Type})
> @ Enzyme ~/.julia/packages/Enzyme/l4FS0/src/Enzyme.jl:524
> Use \`err\` to retrieve the full stack trace.
> 
> julia\> err
> 1-element ExceptionStack:
> MethodError: no method matching get\_inference\_world(::Enzyme.Compiler.Interpreter.EnzymeInterpreter)
> The function \`get\_inference\_world\` exists, but no method is defined for this combination of argument types.
> 
> Closest candidates are:
> get\_inference\_world(::REPL.REPLCompletions.REPLInterpreter)
> @ REPL ~/.julia/juliaup/julia-1.11.0-alpha2+0.x64.linux.gnu/share/julia/stdlib/v1.11/REPL/src/REPLCompletions.jl:550
> get\_inference\_world(::Core.Compiler.NativeInterpreter)
> @ Core compiler/types.jl:402
> 
> Stacktrace:
> \[1\] Core.Compiler.InferenceState(result::Core.Compiler.InferenceResult, cache\_mode::UInt8, interp::Enzyme.Compiler.Interpreter.EnzymeInterpreter)
> @ Core.Compiler ./compiler/inferencestate.jl:493
> \[2\] Core.Compiler.InferenceState(result::Core.Compiler.InferenceResult, cache\_mode::Symbol, interp::Enzyme.Compiler.Interpreter.EnzymeInterpreter)
> @ Core.Compiler ./compiler/inferencestate.jl:499
> \[3\] typeinf(interp::Enzyme.Compiler.Interpreter.EnzymeInterpreter, result::Core.Compiler.InferenceResult, cache\_mode::Symbol)
> @ Core.Compiler ./compiler/typeinfer.jl:9
> \[4\] typeinf\_type(interp::Enzyme.Compiler.Interpreter.EnzymeInterpreter, mi::Core.MethodInstance)
> @ Core.Compiler ./compiler/typeinfer.jl:1072
> \[5\] typeinf\_type(interp::Enzyme.Compiler.Interpreter.EnzymeInterpreter, method::Method, atype::Any, sparams::Core.SimpleVector)
> @ Core.Compiler ./compiler/typeinfer.jl:1059
> \[6\] (::Enzyme.Compiler.var"#532#533"{…})(ctx::LLVM.Context)
> @ Enzyme.Compiler ~/.julia/packages/Enzyme/l4FS0/src/compiler.jl:5495
> \[7\] JuliaContext(f::Enzyme.Compiler.var"#532#533"{…})
> @ GPUCompiler ~/.julia/packages/GPUCompiler/U36Ed/src/driver.jl:47
> \[8\] #s1883#531
> @ ~/.julia/packages/Enzyme/l4FS0/src/compiler.jl:5482 \[inlined\]
> \[9\] 
> @ Enzyme.Compiler ./none:0
> \[10\] (::Core.GeneratedFunctionStub)(::UInt64, ::LineNumberNode, ::Any, ::Vararg{Any})
> @ Core ./boot.jl:705
> \[11\] autodiff\_thunk(::EnzymeCore.ReverseModeSplit{true, true, 0, true, FFIABI}, ::Type{Const{typeof(f)}}, ::Type{Active}, ::Type, ::Vararg{Type})
> @ Enzyme ~/.julia/packages/Enzyme/l4FS0/src/Enzyme.jl:524
> \[12\] top-level scope
> @ REPL\[23\]:1
> Some type information was truncated. Use \`show(err)\` to see complete types.
> 
> (docs) pkg\> st
> Status \`~/Work/GitHub/Julia/DifferentiationInterface.jl/docs/Project.toml\`
> \[47edcb42\] ADTypes v0.2.7
> \[d360d2e6\] ChainRulesCore v1.23.0
> \[0ca39b1e\] Chairmarks v1.2.0
> \[a93c6f00\] DataFrames v1.6.1
> \[163ba53b\] DiffResults v1.1.0
> \[a0c0ee7d\] DifferentiationInterface v0.1.0 \`..\`
> \[9f5e2b26\] Diffractor v0.2.5
> \[e30172f5\] Documenter v1.3.0
> \[a078cd44\] DocumenterMermaid v0.1.1
> \[7da242da\] Enzyme v0.11.20
> \[eb9bf01b\] FastDifferentiation v0.3.6
> \[1a297f60\] FillArrays v1.9.3
> \[6a86dc24\] FiniteDiff v2.23.0
> \[26cc04aa\] FiniteDifferences v0.12.31
> \[f6369f11\] ForwardDiff v0.10.36
> \[c3a54625\] JET v0.8.29
> \[98d1487c\] PolyesterForwardDiff v0.1.1
> \[37e2e3b7\] ReverseDiff v1.15.1
> \[9f7883ad\] Tracker v0.2.33
> \[e88e6eb3\] Zygote v0.6.69
> \[d6f4376e\] Markdown v1.11.0
> \[9a3f8284\] Random v1.11.0
> \[8dfed614\] Test v1.11.0
> 
> julia\> versioninfo()
> Julia Version 1.11.0-alpha2
> Commit 9dfd28ab751 (2024-03-18 20:35 UTC)
> Build Info:
> Official https://julialang.org/ release
> Platform Info:
> OS: Linux (x86\_64-linux-gnu)
> CPU: 12 × Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
> WORD\_SIZE: 64
> LLVM: libLLVM-16.0.6 (ORCJIT, skylake)
> Threads: 1 default, 0 interactive, 1 GC (on 12 virtual cores)
> \`\`\`

---

<div class="post-metadata">

**Author:** ![cefitzg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cefitzg/32/209724_2.png) [@cefitzg](https://discourse.julialang.org/u/cefitzg)\
**Post date:** [June 5, 2024, 7:05pm UTC](https://discourse.julialang.org/t/failing-to-precompile-optimizationbase/114926/24 "2024-06-05T19:05:29Z")

</div>

@gdalle, thanks for the heads up. For Optimization.jl 3.25.1 what versions of julia can I use?

---

<div class="post-metadata">

**Author:** ![gdalle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdalle/32/224680_2.png) [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Post date:** [June 5, 2024, 7:07pm UTC](https://discourse.julialang.org/t/failing-to-precompile-optimizationbase/114926/25 "2024-06-05T19:07:13Z")

</div>

for Optimization itself, 1.11 should be fine, but for Enzyme, stick to 1.10 for the time being

---

<div class="post-metadata">

**Author:** ![cefitzg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cefitzg/32/209724_2.png) [@cefitzg](https://discourse.julialang.org/u/cefitzg)\
**Post date:** [June 5, 2024, 7:09pm UTC](https://discourse.julialang.org/t/failing-to-precompile-optimizationbase/114926/26 "2024-06-05T19:09:37Z")

</div>

@gdalle, thanks. I just need a version where I can use new LBFGSB implementation in Optimization.jl, ModelingToolkit.jl, and SciMLSensitivity.jl. Will test now.

---

<div class="post-metadata">

**Author:** ![jaakkor2](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jaakkor2/32/2540_2.png) [@jaakkor2](https://discourse.julialang.org/u/jaakkor2)\
**Post date:** [June 6, 2024, 7:47am UTC](https://discourse.julialang.org/t/failing-to-precompile-optimizationbase/114926/27 "2024-06-06T07:47:08Z")

</div>

Created issue [OptimizationMTKExt.jl gets re-precompiled · Issue #55 · SciML/OptimizationBase.jl · GitHub](https://github.com/SciML/OptimizationBase.jl/issues/55)

---

<div class="post-metadata">

**Author:** ![cefitzg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cefitzg/32/209724_2.png) [@cefitzg](https://discourse.julialang.org/u/cefitzg)\
**Post date:** [June 6, 2024, 6:03pm UTC](https://discourse.julialang.org/t/failing-to-precompile-optimizationbase/114926/28 "2024-06-06T18:03:43Z")

</div>

@gdalle, did something change with Enzyme? Today I’m having issues getting it to compile on 1.10.

---

<div class="post-metadata">

**Author:** ![wsmoses](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wsmoses/32/26497_2.png) [@wsmoses](https://discourse.julialang.org/u/wsmoses)\
**Post date:** [June 6, 2024, 6:17pm UTC](https://discourse.julialang.org/t/failing-to-precompile-optimizationbase/114926/29 "2024-06-06T18:17:09Z")

</div>

A few hours ago LLVM.jl released a version which was breaking but not marked as breaking. This has since been fixed upstream x/ref: [LLVM.jl 7.2 seems to break Enzyme · Issue #1496 · EnzymeAD/Enzyme.jl · GitHub](https://github.com/EnzymeAD/Enzyme.jl/issues/1496)

---

<div class="post-metadata">

**Author:** ![PetrosStefanou](https://avatars.discourse-cdn.com/v4/letter/p/a88e57/32.png) [@PetrosStefanou](https://discourse.julialang.org/u/PetrosStefanou)\
**Post date:** [June 7, 2024, 7:53am UTC](https://discourse.julialang.org/t/failing-to-precompile-optimizationbase/114926/30 "2024-06-07T07:53:33Z")

</div>

Has there been any progress regarding the original precompilation problem?  
I am still getting the error in a fresh environment in julia 1.10.4.

---

<div class="post-metadata">

**Author:** ![gdalle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdalle/32/224680_2.png) [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Post date:** [June 7, 2024, 8:04am UTC](https://discourse.julialang.org/t/failing-to-precompile-optimizationbase/114926/31 "2024-06-07T08:04:53Z")

</div>

It should be fixed by the following combination of PRs, plus the associated releases:

1. [Fix constructor of AutoMTK by Vaibhavdixit02 · Pull Request #61 · SciML/ADTypes.jl · GitHub](https://github.com/SciML/ADTypes.jl/pull/61)
2. [Remove AutoMTK constructor overload here by Vaibhavdixit02 · Pull Request #56 · SciML/OptimizationBase.jl · GitHub](https://github.com/SciML/OptimizationBase.jl/pull/56)

Once @Vaibhavdixit02 over in the Boston time zone gives the green light, we’re good to merge and release

---

<div class="post-metadata">

**Author:** ![gdalle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdalle/32/224680_2.png) [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Post date:** [June 7, 2024, 3:11pm UTC](https://discourse.julialang.org/t/failing-to-precompile-optimizationbase/114926/32 "2024-06-07T15:11:01Z")

</div>

This should be fixed now with OptimizationBase v1.1, can you update your environment and try again?

---

<div class="post-metadata">

**Author:** ![PetrosStefanou](https://avatars.discourse-cdn.com/v4/letter/p/a88e57/32.png) [@PetrosStefanou](https://discourse.julialang.org/u/PetrosStefanou)\
**Post date:** [June 7, 2024, 4:47pm UTC](https://discourse.julialang.org/t/failing-to-precompile-optimizationbase/114926/33 "2024-06-07T16:47:07Z")

</div>

I can confirm that precompilation of OptimizationBase does not fail anymore. Many thanks for the effort.

[Previous page](https://discourse.julialang.org/t/failing-to-precompile-optimizationbase/114926.md?page=1)
