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

SparsityDetection bug in 02_advanced_ODE_solving notebook #148

Closed
finmod opened this issue Mar 31, 2020 · 3 comments · Fixed by SciML/SparsityDetection.jl#28
Closed

SparsityDetection bug in 02_advanced_ODE_solving notebook #148

finmod opened this issue Mar 31, 2020 · 3 comments · Fixed by SciML/SparsityDetection.jl#28

Comments

@finmod
Copy link

finmod commented Mar 31, 2020

Running:

using SparsityDetection, SparseArrays
input = rand(32,32,2)
output = similar(input)
sparsity_pattern = sparsity!(brusselator_2d_loop,output,input,p,0.0)
jac_sparsity = Float64.(sparse(sparsity_pattern))

throws the following error:

┌ Info: Precompiling SparsityDetection [684fba80-ace3-11e9-3d08-3bc7ed6f96df]
└ @ Base loading.jl:1260
MethodError: no method matching iterate(::Tuple{DataType,StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}}, ::Tuple{DataType,Int64})
Closest candidates are:
iterate(!Matched::Core.SimpleVector, ::Any) at essentials.jl:603
iterate(!Matched::ExponentialBackOff, ::Any) at error.jl:253
iterate(!Matched::Base.MethodList, ::Any...) at reflection.jl:854
...

Stacktrace:
[1] call at C:\Users\Denis.julia\packages\Cassette\7OymZ\src\context.jl:451 [inlined]
[2] fallback at C:\Users\Denis.julia\packages\Cassette\7OymZ\src\context.jl:448 [inlined]
[3] recurse(::Cassette.Context{SparsityDetection.var"##SparsityContext#Name",Tuple{Sparsity,SparsityDetection.Path},Cassette.Tag{SparsityDetection.var"##SparsityContext#Name",0x4e07e39148336526,Nothing},SparsityDetection.var"##PassType#253",IdDict{Module,Dict{Symbol,Cassette.BindingMeta}},Cassette.DisableHooks}, ::typeof(iterate), ::Cassette.Tagged{Cassette.Tag{SparsityDetection.var"##SparsityContext#Name",0x4e07e39148336526,Nothing},Tuple{DataType,StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}},Union{SparsityDetection.Input, SparsityDetection.Output, SparsityDetection.ProvinanceSet},Tuple{Cassette.Immutable{Cassette.Meta{Union{SparsityDetection.Input, SparsityDetection.Output, SparsityDetection.ProvinanceSet},Cassette.NoMetaMeta}},Cassette.Immutable{Cassette.Meta{Union{SparsityDetection.Input, SparsityDetection.Output, SparsityDetection.ProvinanceSet},NamedTuple{(:ref, :step, :len, :offset),Tuple{Cassette.Immutable{Cassette.Meta{Union{SparsityDetection.Input, SparsityDetection.Output, SparsityDetection.ProvinanceSet},NamedTuple{(:hi, :lo),Tuple{Cassette.Immutable{Cassette.Meta{Union{SparsityDetection.Input, SparsityDetection.Output, SparsityDetection.ProvinanceSet},Cassette.NoMetaMeta}},Cassette.Immutable{Cassette.Meta{Union{SparsityDetection.Input, SparsityDetection.Output, SparsityDetection.ProvinanceSet},Cassette.NoMetaMeta}}}}}},Cassette.Immutable{Cassette.Meta{Union{SparsityDetection.Input, SparsityDetection.Output, SparsityDetection.ProvinanceSet},NamedTuple{(:hi, :lo),Tuple{Cassette.Immutable{Cassette.Meta{Union{SparsityDetection.Input, SparsityDetection.Output, SparsityDetection.ProvinanceSet},Cassette.NoMetaMeta}},Cassette.Immutable{Cassette.Meta{Union{SparsityDetection.Input, SparsityDetection.Output, SparsityDetection.ProvinanceSet},Cassette.NoMetaMeta}}}}}},Cassette.Immutable{Cassette.Meta{Union{SparsityDetection.Input, SparsityDetection.Output, SparsityDetection.ProvinanceSet},Cassette.NoMetaMeta}},Cassette.Immutable{Cassette.Meta{Union{SparsityDetection.Input, SparsityDetection.Output, SparsityDetection.ProvinanceSet},Cassette.NoMetaMeta}}}}}}},Cassette.Context{SparsityDetection.var"##SparsityContext#Name",Tuple{Sparsity,SparsityDetection.Path},Cassette.Tag{SparsityDetection.var"##SparsityContext#Name",0x4e07e39148336526,Nothing},SparsityDetection.var"##PassType#253",IdDict{Module,Dict{Symbol,Cassette.BindingMeta}},Cassette.DisableHooks}}, ::Tuple{DataType,Int64}) at C:\Users\Denis.julia\packages\Cassette\7OymZ\src\overdub.jl:486
[4] overdub(::Cassette.Context{SparsityDetection.var"##SparsityContext#Name",Tuple{Sparsity,SparsityDetection.Path},Cassette.Tag{SparsityDetection.var"##SparsityContext#Name",0x4e07e39148336526,Nothing},SparsityDetection.var"##PassType#253",IdDict{Module,Dict{Symbol,Cassette.BindingMeta}},Cassette.DisableHooks}, ::Function, ::Cassette.Tagged{Cassette.Tag{SparsityDetection.var"##SparsityContext#Name",0x4e07e39148336526,Nothing},Tuple{DataType,StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}},Union{SparsityDetection.Input, SparsityDetection.Output, SparsityDetection.ProvinanceSet},Tuple{Cassette.Immutable{Cassette.Meta{Union{SparsityDetection.Input, SparsityDetection.Output, SparsityDetection.ProvinanceSet},Cassette.NoMetaMeta}},Cassette.Immutable{Cassette.Meta{Union{SparsityDetection.Input, SparsityDetection.Output, SparsityDetection.ProvinanceSet},NamedTuple{(:ref, :step, :len, :offset),Tuple{Cassette.Immutable{Cassette.Meta{Union{SparsityDetection.Input, SparsityDetection.Output, SparsityDetection.ProvinanceSet},NamedTuple{(:hi, :lo),Tuple{Cassette.Immutable{Cassette.Meta{Union{SparsityDetection.Input, SparsityDetection.Output, SparsityDetection.ProvinanceSet},Cassette.NoMetaMeta}},Cassette.Immutable{Cassette.Meta{Union{SparsityDetection.Input, SparsityDetection.Output, SparsityDetection.ProvinanceSet},Cassette.NoMetaMeta}}}}}},Cassette.Immutable{Cassette.Meta{Union{SparsityDetection.Input, SparsityDetection.Output, SparsityDetection.ProvinanceSet},NamedTuple{(:hi, :lo),Tuple{Cassette.Immutable{Cassette.Meta{Union{SparsityDetection.Input, SparsityDetection.Output, SparsityDetection.ProvinanceSet},Cassette.NoMetaMeta}},Cassette.Immutable{Cassette.Meta{Union{SparsityDetection.Input, SparsityDetection.Output, SparsityDetection.ProvinanceSet},Cassette.NoMetaMeta}}}}}},Cassette.Immutable{Cassette.Meta{Union{SparsityDetection.Input, SparsityDetection.Output, SparsityDetection.ProvinanceSet},Cassette.NoMetaMeta}},Cassette.Immutable{Cassette.Meta{Union{SparsityDetection.Input, SparsityDetection.Output, SparsityDetection.ProvinanceSet},Cassette.NoMetaMeta}}}}}}},Cassette.Context{SparsityDetection.var"##SparsityContext#Name",Tuple{Sparsity,SparsityDetection.Path},Cassette.Tag{SparsityDetection.var"##SparsityContext#Name",0x4e07e39148336526,Nothing},SparsityDetection.var"##PassType#253",IdDict{Module,Dict{Symbol,Cassette.BindingMeta}},Cassette.DisableHooks}}, ::Tuple{DataType,Int64}) at C:\Users\Denis.julia\packages\SparsityDetection\Q6Utm\src\sparsity_tracker.jl:134
[5] (::SparsityDetection.var"#8#9"{Cassette.Context{SparsityDetection.var"##SparsityContext#Name",Tuple{Sparsity,SparsityDetection.Path},Cassette.Tag{SparsityDetection.var"##SparsityContext#Name",0x4e07e39148336526,Nothing},SparsityDetection.var"##PassType#253",IdDict{Module,Dict{Symbol,Cassette.BindingMeta}},Cassette.DisableHooks},typeof(iterate)})(::Cassette.Tagged{Cassette.Tag{SparsityDetection.var"##SparsityContext#Name",0x4e07e39148336526,Nothing},Tuple{DataType,StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}},Union{SparsityDetection.Input, SparsityDetection.Output, SparsityDetection.ProvinanceSet},Tuple{Cassette.Immutable{Cassette.Meta{Union{SparsityDetection.Input, SparsityDetection.Output, SparsityDetection.ProvinanceSet},Cassette.NoMetaMeta}},Cassette.Immutable{Cassette.Meta{Union{SparsityDetection.Input, SparsityDetection.Output, SparsityDetection.ProvinanceSet},NamedTuple{(:ref, :step, :len, :offset),Tuple{Cassette.Immutable{Cassette.Meta{Union{SparsityDetection.Input, SparsityDetection.Output, SparsityDetection.ProvinanceSet},NamedTuple{(:hi, :lo),Tuple{Cassette.Immutable{Cassette.Meta{Union{SparsityDetection.Input, SparsityDetection.Output, SparsityDetection.ProvinanceSet},Cassette.NoMetaMeta}},Cassette.Immutable{Cassette.Meta{Union{SparsityDetection.Input, SparsityDetection.Output, SparsityDetection.ProvinanceSet},Cassette.NoMetaMeta}}}}}},Cassette.Immutable{Cassette.Meta{Union{SparsityDetection.Input, SparsityDetection.Output, SparsityDetection.ProvinanceSet},NamedTuple{(:hi, :lo),Tuple{Cassette.Immutable{Cassette.Meta{Union{SparsityDetection.Input, SparsityDetection.Output, SparsityDetection.ProvinanceSet},Cassette.NoMetaMeta}},Cassette.Immutable{Cassette.Meta{Union{SparsityDetection.Input, SparsityDetection.Output, SparsityDetection.ProvinanceSet},Cassette.NoMetaMeta}}}}}},Cassette.Immutable{Cassette.Meta{Union{SparsityDetection.Input, SparsityDetection.Output, SparsityDetection.ProvinanceSet},Cassette.NoMetaMeta}},Cassette.Immutable{Cassette.Meta{Union{SparsityDetection.Input, SparsityDetection.Output, SparsityDetection.ProvinanceSet},Cassette.NoMetaMeta}}}}}}},Cassette.Context{SparsityDetection.var"##SparsityContext#Name",Tuple{Sparsity,SparsityDetection.Path},Cassette.Tag{SparsityDetection.var"##SparsityContext#Name",0x4e07e39148336526,Nothing},SparsityDetection.var"##PassType#253",IdDict{Module,Dict{Symbol,Cassette.BindingMeta}},Cassette.DisableHooks}}, ::Vararg{Any,N} where N) at C:\Users\Denis.julia\packages\Cassette\7OymZ\src\context.jl:262
[6] overdub(::Cassette.Context{SparsityDetection.var"##SparsityContext#Name",Tuple{Sparsity,SparsityDetection.Path},Cassette.Tag{SparsityDetection.var"##SparsityContext#Name",0x4e07e39148336526,Nothing},SparsityDetection.var"##PassType#253",IdDict{Module,Dict{Symbol,Cassette.BindingMeta}},Cassette.DisableHooks}, ::typeof(Core._apply_iterate), ::Function, ::Function, ::Cassette.Tagged{Cassette.Tag{SparsityDetection.var"##SparsityContext#Name",0x4e07e39148336526,Nothing},Tuple{DataType,StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}},Union{SparsityDetection.Input, SparsityDetection.Output, SparsityDetection.ProvinanceSet},Tuple{Cassette.Immutable{Cassette.Meta{Union{SparsityDetection.Input, SparsityDetection.Output, SparsityDetection.ProvinanceSet},Cassette.NoMetaMeta}},Cassette.Immutable{Cassette.Meta{Union{SparsityDetection.Input, SparsityDetection.Output, SparsityDetection.ProvinanceSet},NamedTuple{(:ref, :step, :len, :offset),Tuple{Cassette.Immutable{Cassette.Meta{Union{SparsityDetection.Input, SparsityDetection.Output, SparsityDetection.ProvinanceSet},NamedTuple{(:hi, :lo),Tuple{Cassette.Immutable{Cassette.Meta{Union{SparsityDetection.Input, SparsityDetection.Output, SparsityDetection.ProvinanceSet},Cassette.NoMetaMeta}},Cassette.Immutable{Cassette.Meta{Union{SparsityDetection.Input, SparsityDetection.Output, SparsityDetection.ProvinanceSet},Cassette.NoMetaMeta}}}}}},Cassette.Immutable{Cassette.Meta{Union{SparsityDetection.Input, SparsityDetection.Output, SparsityDetection.ProvinanceSet},NamedTuple{(:hi, :lo),Tuple{Cassette.Immutable{Cassette.Meta{Union{SparsityDetection.Input, SparsityDetection.Output, SparsityDetection.ProvinanceSet},Cassette.NoMetaMeta}},Cassette.Immutable{Cassette.Meta{Union{SparsityDetection.Input, SparsityDetection.Output, SparsityDetection.ProvinanceSet},Cassette.NoMetaMeta}}}}}},Cassette.Immutable{Cassette.Meta{Union{SparsityDetection.Input, SparsityDetection.Output, SparsityDetection.ProvinanceSet},Cassette.NoMetaMeta}},Cassette.Immutable{Cassette.Meta{Union{SparsityDetection.Input, SparsityDetection.Output, SparsityDetection.ProvinanceSet},Cassette.NoMetaMeta}}}}}}},Cassette.Context{SparsityDetection.var"##SparsityContext#Name",Tuple{Sparsity,SparsityDetection.Path},Cassette.Tag{SparsityDetection.var"##SparsityContext#Name",0x4e07e39148336526,Nothing},SparsityDetection.var"##PassType#253",IdDict{Module,Dict{Symbol,Cassette.BindingMeta}},Cassette.DisableHooks}}, ::Tuple{Int64}) at C:\Users\Denis.julia\packages\Cassette\7OymZ\src\context.jl:262
[7] checkbounds at .\abstractarray.jl:502 [inlined]
[8] overdub at C:\Users\Denis.julia\packages\SparsityDetection\Q6Utm\src\sparsity_tracker.jl:134 [inlined]
[9] getindex at .\range.jl:641 [inlined]
[10] recurse(::Cassette.Context{SparsityDetection.var"##SparsityContext#Name",Tuple{Sparsity,SparsityDetection.Path},Cassette.Tag{SparsityDetection.var"##SparsityContext#Name",0x4e07e39148336526,Nothing},SparsityDetection.var"##PassType#253",IdDict{Module,Dict{Symbol,Cassette.BindingMeta}},Cassette.DisableHooks}, ::typeof(getindex), ::StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}, ::Int64) at C:\Users\Denis.julia\packages\Cassette\7OymZ\src\overdub.jl:0
[11] overdub(::Cassette.Context{SparsityDetection.var"##SparsityContext#Name",Tuple{Sparsity,SparsityDetection.Path},Cassette.Tag{SparsityDetection.var"##SparsityContext#Name",0x4e07e39148336526,Nothing},SparsityDetection.var"##PassType#253",IdDict{Module,Dict{Symbol,Cassette.BindingMeta}},Cassette.DisableHooks}, ::Function, ::StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}, ::Int64) at C:\Users\Denis.julia\packages\SparsityDetection\Q6Utm\src\sparsity_tracker.jl:134
[12] brusselator_2d_loop at .\In[11]:10 [inlined]
[13] recurse(::Cassette.Context{SparsityDetection.var"##SparsityContext#Name",Tuple{Sparsity,SparsityDetection.Path},Cassette.Tag{SparsityDetection.var"##SparsityContext#Name",0x4e07e39148336526,Nothing},SparsityDetection.var"##PassType#253",IdDict{Module,Dict{Symbol,Cassette.BindingMeta}},Cassette.DisableHooks}, ::typeof(brusselator_2d_loop), ::Cassette.Tagged{Cassette.Tag{SparsityDetection.var"##SparsityContext#Name",0x4e07e39148336526,Nothing},Array{Float64,3},Union{SparsityDetection.Input, SparsityDetection.Output, SparsityDetection.ProvinanceSet},Array{Cassette.Meta{Union{SparsityDetection.Input, SparsityDetection.Output, SparsityDetection.ProvinanceSet},Cassette.NoMetaMeta},3},Cassette.Context{SparsityDetection.var"##SparsityContext#Name",Tuple{Sparsity,SparsityDetection.Path},Cassette.Tag{SparsityDetection.var"##SparsityContext#Name",0x4e07e39148336526,Nothing},SparsityDetection.var"##PassType#253",IdDict{Module,Dict{Symbol,Cassette.BindingMeta}},Cassette.DisableHooks}}, ::Cassette.Tagged{Cassette.Tag{SparsityDetection.var"##SparsityContext#Name",0x4e07e39148336526,Nothing},Array{Float64,3},Union{SparsityDetection.Input, SparsityDetection.Output, SparsityDetection.ProvinanceSet},Array{Cassette.Meta{Union{SparsityDetection.Input, SparsityDetection.Output, SparsityDetection.ProvinanceSet},Cassette.NoMetaMeta},3},Cassette.Context{SparsityDetection.var"##SparsityContext#Name",Tuple{Sparsity,SparsityDetection.Path},Cassette.Tag{SparsityDetection.var"##SparsityContext#Name",0x4e07e39148336526,Nothing},SparsityDetection.var"##PassType#253",IdDict{Module,Dict{Symbol,Cassette.BindingMeta}},Cassette.DisableHooks}}, ::Cassette.Tagged{Cassette.Tag{SparsityDetection.var"##SparsityContext#Name",0x4e07e39148336526,Nothing},NTuple{4,Float64},Union{SparsityDetection.Input, SparsityDetection.Output, SparsityDetection.ProvinanceSet},NTuple{4,Cassette.Immutable{Cassette.Meta{Union{SparsityDetection.Input, SparsityDetection.Output, SparsityDetection.ProvinanceSet},Cassette.NoMetaMeta}}},Cassette.Context{SparsityDetection.var"##SparsityContext#Name",Tuple{Sparsity,SparsityDetection.Path},Cassette.Tag{SparsityDetection.var"##SparsityContext#Name",0x4e07e39148336526,Nothing},SparsityDetection.var"##PassType#253",IdDict{Module,Dict{Symbol,Cassette.BindingMeta}},Cassette.DisableHooks}}, ::Cassette.Tagged{Cassette.Tag{SparsityDetection.var"##SparsityContext#Name",0x4e07e39148336526,Nothing},Float64,Union{SparsityDetection.Input, SparsityDetection.Output, SparsityDetection.ProvinanceSet},Cassette.NoMetaMeta,Cassette.Context{SparsityDetection.var"##SparsityContext#Name",Tuple{Sparsity,SparsityDetection.Path},Cassette.Tag{SparsityDetection.var"##SparsityContext#Name",0x4e07e39148336526,Nothing},SparsityDetection.var"##PassType#253",IdDict{Module,Dict{Symbol,Cassette.BindingMeta}},Cassette.DisableHooks}}) at C:\Users\Denis.julia\packages\Cassette\7OymZ\src\overdub.jl:0
[14] sparsity!(::Function, ::Array{Float64,3}, ::Array{Float64,3}, ::NTuple{4,Float64}, ::Vararg{Any,N} where N; sparsity::Sparsity, verbose::Bool) at C:\Users\Denis.julia\packages\SparsityDetection\Q6Utm\src\program_sparsity.jl:29
[15] sparsity!(::Function, ::Array{Float64,3}, ::Array{Float64,3}, ::NTuple{4,Float64}, ::Vararg{Any,N} where N) at C:\Users\Denis.julia\packages\SparsityDetection\Q6Utm\src\program_sparsity.jl:23
[16] top-level scope at In[12]:4

@ChrisRackauckas
Copy link
Member

Is this on Julia v1.4? Cassette hasn't been updated to v1.4 yet.

JuliaLabs/Cassette.jl#161

@ChrisRackauckas
Copy link
Member

@shashi @vchuravy informed me that this is the Cassette issue on v1.4. Please let us know when this is fixed. Thanks!

@ChrisRackauckas
Copy link
Member

Fixed!

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

Successfully merging a pull request may close this issue.

2 participants