Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

Cassette error when adding many variables #33

Open
ArnoStrouwen opened this issue May 7, 2020 · 3 comments
Open

Cassette error when adding many variables #33

ArnoStrouwen opened this issue May 7, 2020 · 3 comments

Comments

@ArnoStrouwen
Copy link
Member

Cassette prints these errors when adding too many variables.
But the end result is still correct.
When adding fewer numbers, say 4, I get no errors.

using SparsityDetection
function dynamic_sys!(dy,y)
    dy[1] =y[1]+y[3]+y[4]+y[5]+y[6]+y[7]+y[8]+y[10]
    dy[2] = y[2]+y[9]
end
y = ones(10);
test_dy = ones(2);
sparsity_pattern = jacobian_sparsity(dynamic_sys!,test_dy,y)
Internal error: encountered unexpected error in runtime:
TypeError(func=:Tuple, context="non-final parameter", expected=Type, got=Vararg{Cassette.Tagged{Cassette.Tag{getfield(SparsityDetection, Symbol("##JacobianSparsityContext#Name")), 0xe21597f7b0954799, Nothing}, Float64, SparsityDetection.ProvinanceSet, Cassette.NoMetaMeta, Cassette.Context{getfield(SparsityDetection, Symbol("##JacobianSparsityContext#Name")), Tuple{SparsityDetection.Sparsity, SparsityDetection.Path}, Cassette.Tag{getfield(SparsityDetection, Symbol("##JacobianSparsityContext#Name")), 0xe21597f7b0954799, Nothing}, getfield(SparsityDetection, Symbol("##PassType#253")), Base.IdDict{Module, Base.Dict{Symbol, Cassette.BindingMeta}}, Cassette.DisableHooks}}, N} where N)
jl_type_error_rt at /buildworker/worker/package_linux64/build/src/rtutils.c:118
jl_f_apply_type at /buildworker/worker/package_linux64/build/src/builtins.c:963
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2144 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2322
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1700 [inlined]
do_apply at /buildworker/worker/package_linux64/build/src/builtins.c:643
argtypes_to_type at ./compiler/typeutils.jl:46 [inlined]
abstract_call_known at ./compiler/abstractinterpretation.jl:872
abstract_call_known at ./compiler/abstractinterpretation.jl:662
abstract_iteration at ./compiler/abstractinterpretation.jl:553
precise_container_type at ./compiler/abstractinterpretation.jl:500
abstract_apply at ./compiler/abstractinterpretation.jl:579
abstract_call_known at ./compiler/abstractinterpretation.jl:668
abstract_call at ./compiler/abstractinterpretation.jl:895
abstract_apply at ./compiler/abstractinterpretation.jl:604
abstract_call_known at ./compiler/abstractinterpretation.jl:673
abstract_call at ./compiler/abstractinterpretation.jl:895
abstract_call at ./compiler/abstractinterpretation.jl:880
abstract_eval at ./compiler/abstractinterpretation.jl:974
typeinf_local at ./compiler/abstractinterpretation.jl:1227
typeinf_nocycle at ./compiler/abstractinterpretation.jl:1283
typeinf at ./compiler/typeinfer.jl:12
typeinf_edge at ./compiler/typeinfer.jl:488
abstract_call_method at ./compiler/abstractinterpretation.jl:404
abstract_call_gf_by_type at ./compiler/abstractinterpretation.jl:101
abstract_call_known at ./compiler/abstractinterpretation.jl:873
abstract_call at ./compiler/abstractinterpretation.jl:895
abstract_apply at ./compiler/abstractinterpretation.jl:604
abstract_call_known at ./compiler/abstractinterpretation.jl:673
abstract_call at ./compiler/abstractinterpretation.jl:895
abstract_call at ./compiler/abstractinterpretation.jl:880
abstract_eval at ./compiler/abstractinterpretation.jl:974
typeinf_local at ./compiler/abstractinterpretation.jl:1227
typeinf_nocycle at ./compiler/abstractinterpretation.jl:1283
typeinf at ./compiler/typeinfer.jl:12
typeinf_ext at ./compiler/typeinfer.jl:574
typeinf_ext at ./compiler/typeinfer.jl:605
jfptr_typeinf_ext_1.clone_1 at /home/arno/software/julia/lib/julia/sys.so (unknown line)
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2144 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2322
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1700 [inlined]
jl_type_infer at /buildworker/worker/package_linux64/build/src/gf.c:213
jl_compile_method_internal at /buildworker/worker/package_linux64/build/src/gf.c:1887
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2153 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2322
dynamic_sys! at ./REPL[2]:2 [inlined]
recurse at /home/arno/.julia/packages/Cassette/158rp/src/overdub.jl:0
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2158 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2322
overdub at /home/arno/.julia/packages/SparsityDetection/tR22q/src/propagate_tags.jl:44
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2158 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2322
overdub at /home/arno/.julia/packages/Cassette/158rp/src/context.jl:266
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2158 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2322
#2 at /home/arno/.julia/packages/SparsityDetection/tR22q/src/controlflow.jl:146 [inlined]
recurse at /home/arno/.julia/packages/Cassette/158rp/src/overdub.jl:0
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2158 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2322
#abstract_run#1 at /home/arno/.julia/packages/SparsityDetection/tR22q/src/controlflow.jl:146
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2158 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2322
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1700 [inlined]
do_apply at /buildworker/worker/package_linux64/build/src/builtins.c:643
abstract_run##kw at /home/arno/.julia/packages/SparsityDetection/tR22q/src/controlflow.jl:142
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2158 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2322
#jacobian_sparsity#21 at /home/arno/.julia/packages/SparsityDetection/tR22q/src/jacobian.jl:135
jacobian_sparsity at /home/arno/.julia/packages/SparsityDetection/tR22q/src/jacobian.jl:130
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2158 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2322
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1700 [inlined]
do_call at /buildworker/worker/package_linux64/build/src/interpreter.c:369
eval_value at /buildworker/worker/package_linux64/build/src/interpreter.c:458
eval_stmt_value at /buildworker/worker/package_linux64/build/src/interpreter.c:409 [inlined]
eval_body at /buildworker/worker/package_linux64/build/src/interpreter.c:817
jl_interpret_toplevel_thunk at /buildworker/worker/package_linux64/build/src/interpreter.c:911
top-level scope at REPL[5]:1
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:814
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:764
jl_toplevel_eval_in at /buildworker/worker/package_linux64/build/src/toplevel.c:843
eval at ./boot.jl:331
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2144 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2322
eval_user_input at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:86
run_backend at /home/arno/.julia/packages/Revise/0meWR/src/Revise.jl:1075
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2158 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2322
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1700 [inlined]
do_call at /buildworker/worker/package_linux64/build/src/interpreter.c:369
eval_value at /buildworker/worker/package_linux64/build/src/interpreter.c:458
eval_stmt_value at /buildworker/worker/package_linux64/build/src/interpreter.c:409 [inlined]
eval_body at /buildworker/worker/package_linux64/build/src/interpreter.c:817
jl_interpret_toplevel_thunk at /buildworker/worker/package_linux64/build/src/interpreter.c:911
top-level scope at none:0
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:814
jl_toplevel_eval_in at /buildworker/worker/package_linux64/build/src/toplevel.c:843
eval at ./boot.jl:331
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2144 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2322
eval_user_input at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:86
macro expansion at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:118 [inlined]
#26 at ./task.jl:358
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2144 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2322
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1700 [inlined]
start_task at /buildworker/worker/package_linux64/build/src/task.c:687
unknown function (ip: (nil))
Explored path: SparsityDetection.Path(Bool[], 1)
2×10 SparseArrays.SparseMatrixCSC{Bool,Int64} with 10 stored entries:
  [1,  1]  =  1
  [2,  2]  =  1
  [1,  3]  =  1
  [1,  4]  =  1
  [1,  5]  =  1
  [1,  6]  =  1
  [1,  7]  =  1
  [1,  8]  =  1
  [2,  9]  =  1
  [1, 10]  =  1
@ChrisRackauckas
Copy link
Member

I think it's due to not handling the +(x...) splatting case, since that's right around where the cutoff is.

@shashi
Copy link
Collaborator

shashi commented May 7, 2020

I don't know what you mean by handling the splatting case..

that code lowers to Core.apply and this package just lets Cassette handle it...

cc @vchuravy if he has any immediate ideas.

@ChrisRackauckas
Copy link
Member

Bump. @vchuravy?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants