Please see the issue on SumOfSquares.jl: https://github.com/JuliaOpt/SumOfSquares.jl/issues/95
I tried Julia master (Version 1.2.0-DEV.518 commit 54fe55b370) with --check-bounds=yes
. The error occurs on (at least) Windows and Linux and did not happen in Julia 1.1.
julia> optimize!(model)
Unreachable reached at 0x7fa00e107e04
signal (4): Illegal instruction
in expression starting at REPL[6]:1
Type at /home/coey/.julia/packages/SumOfSquares/mAduI/src/sos_polynomial_bridge.jl:32
jl_fptr_trampoline at /home/coey/julia/src/gf.c:1871
jl_apply_generic at /home/coey/julia/src/gf.c:2226
add_constraints at /home/coey/.julia/packages/MathOptInterface/C3lip/src/Bridges/bridgeoptimizer.jl:338
jl_fptr_trampoline at /home/coey/julia/src/gf.c:1871
jl_apply_generic at /home/coey/julia/src/gf.c:2226
copyconstraints! at /home/coey/.julia/packages/MathOptInterface/C3lip/src/Utilities/copy.jl:157
unknown function (ip: 0x7fa00e10291b)
jl_fptr_trampoline at /home/coey/julia/src/gf.c:1871
jl_apply_generic at /home/coey/julia/src/gf.c:2226
default_copy_to at /home/coey/.julia/packages/MathOptInterface/C3lip/src/Utilities/copy.jl:200
#automatic_copy_to#61 at /home/coey/.julia/packages/MathOptInterface/C3lip/src/Utilities/copy.jl:15 [inlined]
#automatic_copy_to at ./none:0 [inlined]
#copy_to#1 at /home/coey/.julia/packages/MathOptInterface/C3lip/src/Bridges/bridgeoptimizer.jl:91 [inlined]
#copy_to at ./none:0
unknown function (ip: 0x7fa00e0f73bd)
jl_fptr_trampoline at /home/coey/julia/src/gf.c:1871
jl_apply_generic at /home/coey/julia/src/gf.c:2226
attach_optimizer at /home/coey/.julia/packages/MathOptInterface/C3lip/src/Utilities/cachingoptimizer.jl:130
optimize! at /home/coey/.julia/packages/MathOptInterface/C3lip/src/Utilities/cachingoptimizer.jl:166
jl_fptr_trampoline at /home/coey/julia/src/gf.c:1871
jl_apply_generic at /home/coey/julia/src/gf.c:2226
#optimize!#77 at /home/coey/.julia/packages/JuMP/jnmGG/src/optimizer_interface.jl:132
optimize! at /home/coey/.julia/packages/JuMP/jnmGG/src/optimizer_interface.jl:105 [inlined]
optimize! at /home/coey/.julia/packages/JuMP/jnmGG/src/optimizer_interface.jl:105
jl_fptr_trampoline at /home/coey/julia/src/gf.c:1871
jl_apply_generic at /home/coey/julia/src/gf.c:2226
do_call at /home/coey/julia/src/interpreter.c:323
eval_value at /home/coey/julia/src/interpreter.c:411
eval_stmt_value at /home/coey/julia/src/interpreter.c:362 [inlined]
eval_body at /home/coey/julia/src/interpreter.c:758
jl_interpret_toplevel_thunk_callback at /home/coey/julia/src/interpreter.c:884
unknown function (ip: 0xfffffffffffffffe)
unknown function (ip: 0x7fa009f1970f)
unknown function (ip: 0xffffffffffffffff)
jl_interpret_toplevel_thunk at /home/coey/julia/src/interpreter.c:893
jl_toplevel_eval_flex at /home/coey/julia/src/toplevel.c:797
jl_toplevel_eval_flex at /home/coey/julia/src/toplevel.c:746
jl_toplevel_eval_in at /home/coey/julia/src/toplevel.c:826
eval at ./boot.jl:327
jl_apply_generic at /home/coey/julia/src/gf.c:2226
eval_user_input at /home/coey/julia/usr/share/julia/stdlib/v1.2/REPL/src/REPL.jl:86
macro expansion at /home/coey/julia/usr/share/julia/stdlib/v1.2/REPL/src/REPL.jl:118 [inlined]
#26 at ./task.jl:269
jl_apply_generic at /home/coey/julia/src/gf.c:2226
jl_apply at /home/coey/julia/src/julia.h:1594 [inlined]
start_task at /home/coey/julia/src/task.c:583
unknown function (ip: 0xffffffffffffffff)
Allocations: 70883226 (Pool: 70872874; Big: 10352); GC: 160
Illegal instruction (core dumped)
Can reproduce. Talking a look.
Looking at:
mi = Cthulhu.first_method_instance(Tuple{Type{
SumOfSquares.SOSPolynomialBridge{Float64,MathOptInterface.VectorAffineFunction{Float64},SemialgebraicSets.FullSpace,Union{SumOfSquares.GenericVariableBridge{Float64,MathOptInterface.Nonnegatives}, SumOfSquares.GenericVariableBridge{Float64,MathOptInterface.PositiveSemidefiniteConeTriangle}, SumOfSquares.GenericVariableBridge{Float64,SumOfSquares.EmptyCone}, SumOfSquares.GenericVariableBridge{Float64,SumOfSquares.PositiveSemidefinite2x2ConeTriangle}},MathOptInterface.PositiveSemidefiniteConeTriangle,MonomialBasis,Monomial{true},MonomialVector{true}}},
MathOptInterface.Bridges.LazyBridgeOptimizer{MosekModel,MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Bridges.AllBridgedConstraints{Float64}}},
MathOptInterface.VectorAffineFunction{Float64},
SumOfSquares.SOSPolynomialSet{SemialgebraicSets.FullSpace,NonnegPolyInnerCone{MathOptInterface.PositiveSemidefiniteConeTriangle},MonomialBasis,Monomial{true},MonomialVector{true},Tuple{}}
})
we see a call to
(SumOfSquares.SOSPolynomialBridge{...})(%34, %28, %44)
Where %34 is inferred as
Union{SumOfSquares.CopositiveInnerVariableBridge{_A,_B} where _B where _A, SumOfSquares.GenericVariableBridge{_A,Any} where _A, SumOfSquares.ScaledDiagonallyDominantVariableBridge{_A} where _A}
but at runtime, the value is of type
SumOfSquares.GenericVariableBridge{Float64, MathOptInterface.Nonnegatives}
which is not a subtype. Looking into where that inference result comes from.
That type comes from:
code_typed(SumOfSquares.add_variable_bridge, Tuple{Type, MathOptInterface.Bridges.LazyBridgeOptimizer{MosekModel,MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Bridges.AllBridgedConstraints{Float64}}}, Any})[2]
Reduced to the following intersection:
julia> TT = Tuple{typeof(SumOfSquares.add_variable_bridge), Type, MathOptInterface.Bridges.LazyBridgeOptimizer{MosekModel,MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Bridges.AllBridgedConstraints{Float64}}}, Any}
julia> ST = Tuple{typeof(SumOfSquares.add_variable_bridge),Type{SumOfSquares.GenericVariableBridge{T,S}},MathOptInterface.ModelLike,S} where S where T
julia> typeintersect(ST, TT)
Tuple{typeof(SumOfSquares.add_variable_bridge),Type{SumOfSquares.GenericVariableBridge{T,Any}},MathOptInterface.Bridges.LazyBridgeOptimizer{MosekModel,MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Bridges.AllBridgedConstraints{Float64}}},Any} where T
which is too narrow:
julia> IT = Tuple{typeof(SumOfSquares.add_variable_bridge),Type{SumOfSquares.GenericVariableBridge{T,S}},MathOptInterface.Bridges.LazyBridgeOptimizer{MosekModel,MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Bridges.AllBridgedConstraints{Float64}}},S} where S where T;
julia> IT <: ST
true
julia> IT <: TT
true
julia> typeintersect(ST, TT) <: IT
true
julia> IT <: typeintersect(ST, TT)
false
Standalone reduction:
abstract type Bar end
struct Bar1 <: Bar end
struct Foo{T}
end
julia> typeintersect(Tuple{Type{Foo{T}},Bar,T} where T, Tuple{Type,Bar1,Any})
Tuple{Type{Foo{Any}},Bar1,Any}
julia> IT = Tuple{Type{Foo{T}},Bar1,T} where T
Tuple{Type{Foo{T}},Bar1,T} where T
julia> IT <: typeintersect(Tuple{Type{Foo{T}},Bar,T} where T, Tuple{Type,Bar1,Any})
false
julia> typeintersect(Tuple{Type{Foo{T}},Bar,T} where T, Tuple{Type,Bar1,Any}) <: IT
true
julia> IT <: Tuple{Type{Foo{T}},Bar,T} where T
true
julia> IT <: Tuple{Type,Bar1,Any}
true
When I try to apply a fix for this, I get the following instead:
MOSEK error 1008: License cannot be located. The default search path is ':/home/jeff/mosek/mosek.lic:'.
*** A FLEXlm error occurred. FLEXlm reported:
*** end of FLEXlm report.
which I'm not sure is really an improvement :joy: :joy: :joy:
Ah yes, sorry, the MWE should use an open-source SDP solver so that you don't need the license.
You can try:
using CSDP, SumOfSquares, DynamicPolynomials
model = SOSModel(with_optimizer(CSDP.Optimizer))
@polyvar x
@variable(model, foo, Poly(monomials(x, 1:2)))
@constraint(model, foo >= 0)
optimize!(model)
This still causes the crash.
No worries, just trying to make a FLEXlm joke ;)
If only github had the right reaction emoji for me now
IDK if useful but I bisected Julia commits for this segfault:
a811eac310ef9fde3e9fdf5ff0fab842cd4b5a84 is the first bad commit
commit a811eac310ef9fde3e9fdf5ff0fab842cd4b5a84
Author: Jeff Bezanson <[email protected]>
Date: Thu Jan 31 16:58:50 2019 -0500
reduce max Union length in `tmerge` (#30833)
:040000 040000 b11366d5f172d98cbb9dab74a8051d4513348043 7e2402f6f4b2de8fe7a164e702594deb91d8aebb M base
:040000 040000 dec5a9671bb123980c653fff83b3bf924b4b3874 3581be92e469df97ec14c81dcfe0c45970c8ff3a M test
Most helpful comment
Standalone reduction: