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

Failure on julia-nightly #402

Closed
dmbates opened this issue Oct 5, 2020 · 16 comments · Fixed by #404
Closed

Failure on julia-nightly #402

dmbates opened this issue Oct 5, 2020 · 16 comments · Fixed by #404
Assignees

Comments

@dmbates
Copy link
Collaborator

dmbates commented Oct 5, 2020

When running the tests by hand on

julia> versioninfo()
Julia Version 1.6.0-DEV.1128
Commit 8519538bb7 (2020-10-05 13:05 UTC)
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: Intel(R) Core(TM) i5-7500 CPU @ 3.40GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-10.0.1 (ORCJIT, skylake)
Environment:
  JULIA_EDITOR = "/usr/share/code/code"
  JULIA_NUM_THREADS = 4

I got a failure on

julia> pca = models(:kb07)[3].PCA.item

Principal components based on correlation matrix
Error showing value of type MixedModels.PCA{Float64}:
ERROR: MethodError: no method matching zero(::String)
Closest candidates are:
  zero(::T) where T<:Dates.TimeType at /home/bates/git/julia/usr/share/julia/stdlib/v1.6/Dates/src/types.jl:423
  zero(::Diagonal{T, StaticArrays.SVector{N, T}}) where {N, T} at /home/bates/.julia/packages/StaticArrays/l7lu2/src/SDiagonal.jl:43
  zero(::FillArrays.Zeros{T, N, Axes} where Axes) where {T, N} at /home/bates/.julia/packages/FillArrays/RM6r2/src/FillArrays.jl:517
  ...
Stacktrace:
  [1] iszero(x::String)
    @ Base ./number.jl:40
  [2] fzeropreserving(bc::Base.Broadcast.Broadcasted{LinearAlgebra.StructuredMatrixStyle{LowerTriangular{Float64, Matrix{Float64}}}, Tuple{Base.OneTo{Int64}, Base.OneTo{Int64}}, typeof(string), Tuple{LowerTriangular{Float64, Matrix{Float64}}}})
    @ LinearAlgebra ~/git/julia/usr/share/julia/stdlib/v1.6/LinearAlgebra/src/structuredbroadcast.jl:107
  [3] similar(bc::Base.Broadcast.Broadcasted{LinearAlgebra.StructuredMatrixStyle{LowerTriangular{Float64, Matrix{Float64}}}, Tuple{Base.OneTo{Int64}, Base.OneTo{Int64}}, typeof(string), Tuple{LowerTriangular{Float64, Matrix{Float64}}}}, #unused#::Type{String})
    @ LinearAlgebra ~/git/julia/usr/share/julia/stdlib/v1.6/LinearAlgebra/src/structuredbroadcast.jl:125
  [4] copy
    @ ./broadcast.jl:862 [inlined]
  [5] materialize
    @ ./broadcast.jl:837 [inlined]
  [6] show(io::IOContext{Base.TTY}, pca::MixedModels.PCA{Float64}; ndigitsmat::Int64, ndigitsvec::Int64, ndigitscum::Int64, covcor::Bool, loadings::Bool, variances::Bool, stddevs::Bool)
    @ MixedModels ~/.julia/dev/MixedModels/src/utilities.jl:248
  [7] show
    @ ~/.julia/dev/MixedModels/src/utilities.jl:238 [inlined]
  [8] show(io::IOContext{Base.TTY}, #unused#::MIME{Symbol("text/plain")}, x::MixedModels.PCA{Float64})
    @ Base.Multimedia ./multimedia.jl:47
  [9] (::REPL.var"#38#39"{REPL.REPLDisplay{REPL.LineEditREPL}, MIME{Symbol("text/plain")}, MixedModels.PCA{Float64}})(io::Any)
    @ REPL ~/git/julia/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:219
 [10] with_repl_linfo(f::Any, repl::REPL.LineEditREPL)
    @ REPL ~/git/julia/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:461
 [11] display(d::REPL.REPLDisplay, mime::MIME{Symbol("text/plain")}, x::Any)
    @ REPL ~/git/julia/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:212
 [12] display(d::REPL.REPLDisplay, x::Any)
    @ REPL ~/git/julia/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:224
 [13] display(x::Any)
    @ Base.Multimedia ./multimedia.jl:328
 [14] #invokelatest#2
    @ ./essentials.jl:709 [inlined]
 [15] invokelatest
    @ ./essentials.jl:708 [inlined]
 [16] print_response(errio::IO, response::Any, show_value::Bool, have_color::Bool, specialdisplay::Union{Nothing, AbstractDisplay})
    @ REPL ~/git/julia/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:246
 [17] (::REPL.var"#40#41"{REPL.LineEditREPL, Tuple{MixedModels.PCA{Float64}, Bool}, Bool, Bool})(io::Any)
    @ REPL ~/git/julia/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:230
 [18] with_repl_linfo(f::Any, repl::REPL.LineEditREPL)
    @ REPL ~/git/julia/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:461
 [19] print_response(repl::REPL.AbstractREPL, response::Any, show_value::Bool, have_color::Bool)
    @ REPL ~/git/julia/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:228
 [20] (::REPL.var"#do_respond#61"{Bool, Bool, VSCodeServer.var"#36#37"{REPL.LineEditREPL, REPL.LineEdit.Prompt}, REPL.LineEditREPL, REPL.LineEdit.Prompt})(s::REPL.LineEdit.MIState, buf::Any, ok::Bool)
    @ REPL ~/git/julia/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:797
 [21] #invokelatest#2
    @ ./essentials.jl:709 [inlined]
 [22] invokelatest
    @ ./essentials.jl:708 [inlined]
 [23] run_interface(terminal::REPL.Terminals.TextTerminal, m::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
    @ REPL.LineEdit ~/git/julia/usr/share/julia/stdlib/v1.6/REPL/src/LineEdit.jl:2435
 [24] run_frontend(repl::REPL.LineEditREPL, backend::REPL.REPLBackendRef)
    @ REPL ~/git/julia/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:1124
 [25] (::REPL.var"#44#49"{REPL.LineEditREPL, REPL.REPLBackendRef})()
    @ REPL ./task.jl:392

This is just an FYI issue as I will assign it to myself.

@dmbates dmbates self-assigned this Oct 5, 2020
@palday
Copy link
Member

palday commented Oct 5, 2020

Interesting. I'm curious about whether the underlying issue is some implicit assumption I made in the new show method.

@dmbates
Copy link
Collaborator Author

dmbates commented Oct 5, 2020

Appears to be. The highlighted line is utilities.jl:248. I'll keep digging unless you want to take over.

@palday
Copy link
Member

palday commented Oct 5, 2020

I won't get around to it until much later today, so if this is blocking your work on other issues, please keep digging. Otherwise, I'll take a look later tonight.

@dmbates
Copy link
Collaborator Author

dmbates commented Oct 5, 2020

It seems to be that 1.6.0 doesn't like string.(m) where m is LowerTriangular

julia> LowerTriangular(Float64.(I(4)))
4×4 LowerTriangular{Float64, Diagonal{Float64, Vector{Float64}}}:
 1.0            
 0.0  1.0        
 0.0  0.0  1.0    
 0.0  0.0  0.0  1.0

julia> string.(LowerTriangular(Float64.(I(4))))
ERROR: MethodError: no method matching zero(::String)
Closest candidates are:
  zero(::T) where T<:Dates.TimeType at /home/bates/git/julia/usr/share/julia/stdlib/v1.6/Dates/src/types.jl:423
  zero(::Diagonal{T, StaticArrays.SVector{N, T}}) where {N, T} at /home/bates/.julia/packages/StaticArrays/l7lu2/src/SDiagonal.jl:43
  zero(::FillArrays.Zeros{T, N, Axes} where Axes) where {T, N} at /home/bates/.julia/packages/FillArrays/RM6r2/src/FillArrays.jl:517
  ...
Stacktrace:
 [1] iszero(x::String)
   @ Base ./number.jl:40
 [2] fzeropreserving(bc::Base.Broadcast.Broadcasted{LinearAlgebra.StructuredMatrixStyle{LowerTriangular{Float64, Diagonal{Float64, Vector{Float64}}}}, Tuple{Base.OneTo{Int64}, Base.OneTo{Int64}}, typeof(string), Tuple{LowerTriangular{Float64, Diagonal{Float64, Vector{Float64}}}}})
   @ LinearAlgebra ~/git/julia/usr/share/julia/stdlib/v1.6/LinearAlgebra/src/structuredbroadcast.jl:107
 [3] similar(bc::Base.Broadcast.Broadcasted{LinearAlgebra.StructuredMatrixStyle{LowerTriangular{Float64, Diagonal{Float64, Vector{Float64}}}}, Tuple{Base.OneTo{Int64}, Base.OneTo{Int64}}, typeof(string), Tuple{LowerTriangular{Float64, Diagonal{Float64, Vector{Float64}}}}}, #unused#::Type{String})
   @ LinearAlgebra ~/git/julia/usr/share/julia/stdlib/v1.6/LinearAlgebra/src/structuredbroadcast.jl:125
 [4] copy
   @ ./broadcast.jl:862 [inlined]
 [5] materialize(bc::Base.Broadcast.Broadcasted{LinearAlgebra.StructuredMatrixStyle{LowerTriangular{Float64, Diagonal{Float64, Vector{Float64}}}}, Nothing, typeof(string), Tuple{LowerTriangular{Float64, Diagonal{Float64, Vector{Float64}}}}})
   @ Base.Broadcast ./broadcast.jl:837
 [6] top-level scope
   @ REPL[27]:1
 [7] eval
   @ ./boot.jl:360 [inlined]
 [8] include_string(mapexpr::typeof(identity), mod::Module, code::String, filename::String)
   @ Base ./loading.jl:1051

I'll see if I can conjure a workaround.

@palday
Copy link
Member

palday commented Oct 5, 2020

The crude, inefficient way would be to convert LowerTriangular to just Matrix.

@dmbates
Copy link
Collaborator Author

dmbates commented Oct 5, 2020

It may be possible to avoid the LowerTriangular conversion in the construction of printmat completely because the upper triangle is later overwritten with dotpad.

@palday
Copy link
Member

palday commented Oct 5, 2020

Of course: just create printmat as a Matrix of empty strings and populate the lower triangle with the actual values when populating the upper triangle with dotpad. (I'm sure you already figured this out; just writing this down for my own notes.)

@dmbates
Copy link
Collaborator Author

dmbates commented Oct 5, 2020

I was going to do that but then decided it was easier to just use the existing logic but with pca.covcor.data instead of LowerTriangular(pca.covcor). Just running the tests now then will commit. Feel free to change the logic if you prefer.

@palday
Copy link
Member

palday commented Oct 5, 2020

Perfect. I'm a fan of easy. 😄

@dmbates
Copy link
Collaborator Author

dmbates commented Oct 5, 2020

Something is still wrong. On my computer using julia-1.5.2 it takes 28 seconds to run models(:kb07) from a cold start. With julia-nightly it has been running for over 10 minutes with no sign of completing. I'll do some more digging.

@palday
Copy link
Member

palday commented Oct 5, 2020

I've noticed that the Future builds fail after several hours, which is probably timing out on this.

@dmbates
Copy link
Collaborator Author

dmbates commented Oct 5, 2020

It is not a matter of fitting the models as those can be fit in a comparable length of time to 1.5.2. It seems to have something to do with the modelcache. When I interrupt it manually it seems to be in a compilation loop around modelcache.jl:40.

@dmbates
Copy link
Collaborator Author

dmbates commented Oct 5, 2020

It seems to be a problem with the dot mapping of fit although I don't know why. I will replace it with a comprehension.

@palday
Copy link
Member

palday commented Oct 5, 2020

So the try...catch in there should probably be changed to use isdefined or @isdefined. I suspect it's catching too much.

@dmbates
Copy link
Collaborator Author

dmbates commented Oct 5, 2020

Unfortunately, using the comprehension worked in the REPL but not inside the models function. This construction still seems to throw the JIT compiler into a loop.

@dmbates
Copy link
Collaborator Author

dmbates commented Oct 5, 2020

@palday Feel free to modify #404 to use @isdefined or isdefined

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