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

Relevant julia code under unknown #38

Open
koehlerson opened this issue Feb 15, 2021 · 8 comments
Open

Relevant julia code under unknown #38

koehlerson opened this issue Feb 15, 2021 · 8 comments

Comments

@koehlerson
Copy link

koehlerson commented Feb 15, 2021

Hey there,
thanks for the package! I'm trying to profile some code but I have troubles to get PProf properly running.

I'm on arch with PProf.jl version 2.0.1, graphviz 2.46.0-1 and julia 1.5.3
Whenever I profile something in Julia PProf gathers everything under "unknown" as in this screenshot
grafik

MWE would be to copy paste this https://kristofferc.github.io/JuAFEM.jl/dev/examples/hyperelasticity/#Plain-Program or alternatively just copy paste the example from the docs https://docs.julialang.org/en/v1/manual/profile/#Basic-usage

Here is the source view:
grafik

@NHDaly
Copy link
Member

NHDaly commented Feb 19, 2021

Hrmm weird! Thanks for the report!

Can you also paste a screenshot for the flamegraph view? It's a bit easier for my brain to see what's going on.

This might just be a benign artifact of the way julia names the root frame on arch? Let's have a look at the flamegraph to see if it helps at all...

@NHDaly
Copy link
Member

NHDaly commented Feb 19, 2021

Also, can you try pasting in the results of Profile.print()? That might show if this is a problem in PProf or something coming from base Julia. :)

@koehlerson
Copy link
Author

Here is the output of the flame graph
grafik

And this is Profile.print()

julia> Profile.print()
Overhead ╎ [+additional indent] Count File:Line; Function
=========================================================
     ╎6123  /build/julia/src/julia-1.5.3/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:288; run_repl(::REPL.AbstractREPL, ::Any)
 5173╎ 6123  @Base/client.jl:457; include(::String)
     ╎  45    none:0; #s16#28(::Any, ::Any, ::Any, ::Any, ::Any, ::Any)
   45╎   45    @SIMD/src/LLVM_intrinsics_old.jl:179; #s16#28
     ╎  5     none:0; #s17#111(::Any, ::Any, ::Any, ::Any, ::Any)
    5╎   5     @SIMD/src/LLVM_intrinsics_old.jl:581; #s17#111
     ╎  12    none:0; #s17#95(::Any, ::Any, ::Any, ::Any, ::Any, ::Any)
   10╎   12    @SIMD/src/LLVM_intrinsics_old.jl:383; #s17#95
    2╎    2     @SIMD/src/LLVM_intrinsics_old.jl:47; llvm_name(::Symbol, ::Int64, ::Type{T} where T)
     ╎  33    none:0; #s21#19(::Any, ::Any, ::Any, ::Any)
     ╎   33    @ForwardDiff/src/partials.jl:177; #s21#19
   33╎    33    @ForwardDiff/src/partials.jl:154; tupexpr(::Function, ::Int64)
     ╎  47    none:0; #s21#31(::Any, ::Any, ::Any, ::Any)
     ╎   47    @ForwardDiff/src/partials.jl:201; #s21#31
   47╎    47    @ForwardDiff/src/partials.jl:154; tupexpr(::Function, ::Int64)
     ╎  34    none:0; #s21#37(::Any, ::Any, ::Any, ::Any)
     ╎   34    @ForwardDiff/src/partials.jl:209; #s21#37
   34╎    34    @ForwardDiff/src/partials.jl:154; tupexpr(::Function, ::Int64)
     ╎  39    none:0; #s21#40(::Any, ::Any, ::Any, ::Any)
     ╎   39    @ForwardDiff/src/partials.jl:213; #s21#40
   39╎    39    @ForwardDiff/src/partials.jl:154; tupexpr(::Function, ::Int64)
     ╎  49    none:0; #s21#43(::Any, ::Any, ::Any)
   12╎   49    @ForwardDiff/src/partials.jl:217; #s21#43
   37╎    37    @ForwardDiff/src/partials.jl:154; tupexpr(::Function, ::Int64)
     ╎  106   none:0; #s21#46(::Any, ::Any, ::Any, ::Any, ::Any, ::Any)
     ╎   106   @ForwardDiff/src/partials.jl:221; #s21#46
  106╎    106   @ForwardDiff/src/partials.jl:154; tupexpr(::Function, ::Int64)
     ╎  53    none:0; #s27#46(::Any, ::Any, ::Any, ::Any, ::Any)
    1╎   1     @Tensors/src/constructors.jl:21; #s27#46
   15╎   52    @Tensors/src/constructors.jl:22; #s27#46
   37╎    37    @Tensors/src/utilities.jl:2; tensor_create_linear(::Type{Tensor{1,3,T,M} where M where T}, ::Function)
     ╎  71    none:0; #s27#65(::Any, ::Any, ::Any, ::Any, ::Any)
    6╎   6     @Tensors/src/constructors.jl:78; #s27#65
    1╎   1     @Tensors/src/constructors.jl:80; #s27#65
   64╎   64    @Tensors/src/constructors.jl:88; #s27#65
     ╎  196   none:0; #s80#132(::Any, ::Any, ::Any)
   14╎   14    @Tensors/src/tensor_products.jl:357; #s80#132
  115╎   122   @Tensors/src/tensor_products.jl:359; #s80#132
     ╎    7     @Tensors/src/utilities.jl:34; reducer(::Array{Expr,1}, ::Array{Expr,1})
     ╎     7     @Tensors/src/utilities.jl:34; reducer(::Array{Expr,1}, ::Array{Expr,1}, ::Bool)
     ╎    ╎ 7     @Tensors/src/utilities.jl:52; remove_duplicates(::Array{Expr,1}, ::Array{Expr,1})
     ╎    ╎  7     @Base/array.jl:1861; findfirst
     ╎    ╎   7     @Base/array.jl:1810; findnext
     ╎    ╎    7     @Base/operators.jl:930; Fix2
     ╎    ╎     7     @Base/operators.jl:123; isequal
     ╎    ╎    ╎ 7     @Base/expr.jl:78; ==
    4╎    ╎    ╎  7     @Base/abstractarray.jl:1841; isequal(::Array{Any,1}, ::Array{Any,1})
     ╎    ╎    ╎   3     @Base/operators.jl:123; isequal(::Expr, ::Expr)
     ╎    ╎    ╎    3     @Base/expr.jl:78; ==
    3╎    ╎    ╎     3     @Base/abstractarray.jl:1841; isequal(::Array{Any,1}, ::Array{Any,1})
   60╎   60    @Tensors/src/tensor_products.jl:361; #s80#132
     ╎  8     none:0; #s80#148(::Any, ::Any, ::Any)
    4╎   8     @Tensors/src/math_ops.jl:97; #s80#148
    4╎    4     @Tensors/src/math_ops.jl:87; (::Tensors.var"#idx#149"{UnionAll})(::Int64, ::Int64)
     ╎  78    none:0; #s80#156(::Any, ::Any, ::Any)
    4╎   9     @Tensors/src/math_ops.jl:314; #s80#156
    5╎    5     @Tensors/src/math_ops.jl:313; (::Tensors.var"#idx#158"{DataType})(::Int64, ::Int64)
   21╎   69    @Tensors/src/math_ops.jl:315; #s80#156
     ╎    48    @Base/reducedim.jl:359; reduce(::Function, ::Array{Expr,1})
     ╎     48    @Base/reducedim.jl:359; #reduce#622
     ╎    ╎ 48    @Base/reducedim.jl:310; mapreduce
   15╎    ╎  48    @Base/reducedim.jl:310; #mapreduce#620
   33╎    ╎   33    @Base/reducedim.jl:318; _mapreduce_dim(::Function, ::Function, ::NamedTuple{(),Tuple{}}, ::Array{Expr,1}, ::Colon)
     ╎  28    none:0; #s80#164(::Any, ::Any, ::Any, ::Any, ::Any, ::Any)
   28╎   28    @Tensors/src/simd.jl:53; #s80#164
     ╎  35    none:0; #s80#167(::Any, ::Any, ::Any, ::Any, ::Any, ::Any)
   35╎   35    @Tensors/src/simd.jl:59; #s80#167
     ╎  83    none:0; #s80#170(::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any)
   78╎   83    @Tensors/src/simd.jl:66; #s80#170
    5╎    5     @Base/iterators.jl:910; product(::UnitRange{Int64}, ::Vararg{UnitRange{Int64},N} where N)
     ╎  28    none:0; #s80#176(::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Type{T} where T, ::Any)
   28╎   28    @Tensors/src/simd.jl:83; #s80#176
Total snapshots: 25980

@NHDaly
Copy link
Member

NHDaly commented Feb 22, 2021

Ah, whoops - shoot, to get the right thing to compare, we need Profile.print(C=true), since those Unknown frames look like they're probably C frames.

Sorry and thanks!
thanks for your thorough responses! ❤️

@koehlerson
Copy link
Author

profile-output.txt
its a lot, so I created a txt, because my browser didn't respond everytime I tried to paste it :D

no worries, I have to thank you for caring about my problem 👍

@NHDaly
Copy link
Member

NHDaly commented Feb 23, 2021

Aha - so in that view, we do see [unknown stackframe] show up quite a bit.

     ╎    ╎    ╎    ╎    ╎    ╎    ╎    ╎ +21 2     ...oducts.jl:79; #s72#111
     ╎    ╎    ╎    ╎    ╎    ╎    ╎    ╎ +22 2     [unknown stackframe]
     ╎    ╎    ╎    ╎    ╎    ╎    ╎    ╎ +23 2     ...lities.jl:34; reducer(::Array...
     ╎    ╎    ╎    ╎    ╎    ╎    ╎    ╎ +24 2     ...lities.jl:52; remove_duplicat...
     ╎    ╎    ╎    ╎    ╎    ╎    ╎    ╎ +25 2     .../array.jl:1861; findfirst
     ╎    ╎    ╎    ╎    ╎    ╎    ╎    ╎ +26 2     .../array.jl:1810; findnext
     ╎    ╎    ╎    ╎    ╎    ╎    ╎    ╎ +27 2     ...rators.jl:930; Fix2
     ╎    ╎    ╎    ╎    ╎    ╎    ╎    ╎ +28 2     ...rators.jl:123; isequal
     ╎    ╎    ╎    ╎    ╎    ╎    ╎    ╎ +29 2     ...e/expr.jl:78; ==
     ╎    ╎    ╎    ╎    ╎    ╎    ╎    ╎ +30 1     ...tarray.jl:1841; isequal(::Array...
     ╎    ╎    ╎    ╎    ╎    ╎    ╎    ╎ +31 1     [unknown stackframe]
     ╎    ╎    ╎    ╎    ╎    ╎    ╎    ╎ +32 1     ...rators.jl:123; isequal(::Expr,...
     ╎    ╎    ╎    ╎    ╎    ╎    ╎    ╎ +33 1     ...e/expr.jl:78; ==
     ╎    ╎    ╎    ╎    ╎    ╎    ╎    ╎ +34 1     ...tarray.jl:1841; isequal(::Array...
     ╎    ╎    ╎    ╎    ╎    ╎    ╎    ╎ +35 1     [unknown stackframe]
     ╎    ╎    ╎    ╎    ╎    ╎    ╎    ╎ +36 1     ...rators.jl:123; isequal(::Expr,...
     ╎    ╎    ╎    ╎    ╎    ╎    ╎    ╎ +37 1     ...e/expr.jl:78; ==
     ╎    ╎    ╎    ╎    ╎    ╎    ╎    ╎ +38 1     ...tarray.jl:1841; isequal(::Array...
    1╎    ╎    ╎    ╎    ╎    ╎    ╎    ╎ +39 1     ...ulia.so.1:?; jl_apply_generic
     ╎    ╎    ╎    ╎    ╎    ╎    ╎    ╎ +30 1     [unknown stackframe]

I'm not sure if that's the same thing that's being displayed as <unknown> in PProf?

@vchuravy: do you know?


Although actually, after looking through the text file some more.. i think maybe the <unknown> frames correspond to the frames in Profile that don't have a name at all? Like these:

     ╎ 7302  ...in/../lib/libc.so.6:?; __libc_start_main
     ╎  7302  julia:?; 
     ╎   7302  julia:?; 
     ╎    7302  /usr/lib/julia/sys.so:?; 
     ╎     7302  .../lib/julia/sys.so:?; 
     ╎    ╎ 7302  .../lib/julia/sys.so:?; 
     ╎    ╎  7302  .../lib/julia/sys.so:?; 
     ╎    ╎   7302  ...lib/julia/sys.so:?; 
     ╎    ╎    7302  ...ib/libjulia.so.1:?; jl_load_rewrite
     ╎    ╎     7302  ...b/libjulia.so.1:?; 
     ╎    ╎    ╎ 7302  ...b/libjulia.so.1:?; 
     ╎    ╎    ╎  7302  ...b/libjulia.so.1:?; 
     ╎    ╎    ╎   7302  .../libjulia.so.1:?; 
     ╎    ╎    ╎    7302  .../libjulia.so.1:?; 
     ╎    ╎    ╎     7302  ...libjulia.so.1:?; 
     ╎    ╎    ╎    ╎ 7302  ...libjulia.so.1:?; 
     ╎    ╎    ╎    ╎  7302  ...libjulia.so.1:?; 
     ╎    ╎    ╎    ╎   7302  ...ibjulia.so.1:?; jl_apply_generic

which seems to more or less correspond to the screenshot you posted?:
Screen Shot 2021-02-23 at 6 09 15 PM

@NHDaly
Copy link
Member

NHDaly commented Feb 23, 2021

ANYWAY, the simplest answer I have for you is that you can "hide" the frame, by typing <unknown> into the search box (without hitting enter), and then clicking REFINE => hide. Or you can manually add ?h=<unknown> to the URL which should also work. :)

It's annoying but that will clean up your profile! Hope that helps :)

@koehlerson
Copy link
Author

koehlerson commented Feb 26, 2021

Thanks for the suggestion, but it didn't work for me. I tried both, but the "unknown" node is still there. Anyhow, this is not really my problem. If I search for "solve", "assemble_element!", "assemble_global!", i.e. the functions that matter in this example: https://kristofferc.github.io/JuAFEM.jl/dev/examples/hyperelasticity/#Plain-Program I get no match. All I did is @profile in front of solve() and calling pprof() afterwards

But maybe it's related to Profile.jl, I'm not sure tbh

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

No branches or pull requests

2 participants