Is VSCode `@profview` broken on 1.11?

When I run the profiling code from this example in VSCode with Julia 1.11, the flame graph is empty. With Julia 1.10 it displays the usual way.

function profile_test(n)
    for i = 1:n
        A = randn(100,100,20)
        m = maximum(A)
        Am = mapslices(sum, A; dims=2)
        B = A[:,:,5]
        Bsort = mapslices(sort, B; dims=1)
        b = rand(100)
        C = B.*b
    end
end

# compilation
@profview profile_test(1)
# pure runtime
@profview profile_test(10)

I’m not sure it is only a VSCode problem because I have observed similar behaviors with ProfileCanvas.jl and ProfileSVG.jl.

4 Likes

Yes I can also confirm its not working, with it always being empty on 1.11.

1 Like

For me it works as normal on my Windows computer, but on Linux it seems to show something the very first time I call @profview, and is completely empty after that.

1 Like

what is worse is that for me even the profile information is empty (it’s not the issue with a particular visualization tool:

julia> @profile peakflops()
2.5633960272396997e11

julia> Profile.print()
Overhead β•Ž [+additional indent] Count File:Line; Function
=========================================================
    β•Ž6708 @Base/task.jl:694; task_done_hook(t::Task)
    β•Ž 6708 @Base/task.jl:1021; wait()
6707β•Ž  6708 @Base/task.jl:1012; poptask(W::Base.IntrusiveLinkedListSynchronized{Task})
Total snapshots: 6708. Utilization: 0% across all threads and tasks. Use the `groupby` kwarg to break down by thread and/or task.

julia> versioninfo()
Julia Version 1.11.1
Commit 8f5b7ca12ad (2024-10-16 10:53 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 16 Γ— AMD Ryzen 7 7840U w/ Radeon  780M Graphics
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, znver4)
Threads: 8 default, 0 interactive, 4 GC (on 16 virtual cores)
Environment:
  JULIA_NUM_THREADS = 8

whereas

julia> @profile peakflops()
2.4386398606176114e11

julia> Profile.print()
Overhead β•Ž [+additional indent] Count File:Line; Function
=========================================================
     β•Ž1937  @Base/Base.jl:608; (::Base.var"#1055#1056")()
     β•Ž 1937  @Base/Base.jl:572; profile_printing_listener()
     β•Ž  1937  @Base/asyncevent.jl:159; wait
     β•Ž   1937  @Base/asyncevent.jl:142; _trywait(t::Base.AsyncCondition)

...... (lots of lines here)

   β•Ž    β•Ž    β•Ž    β•Ž    1233  …a/src/matmul.jl:113; *(A::Matrix{Float64}, B::Matrix…
     β•Ž    β•Ž    β•Ž    β•Ž     18    @Base/array.jl:420; similar
     β•Ž    β•Ž    β•Ž    β•Ž    β•Ž 18    @Base/boot.jl:487; Array
   18β•Ž    β•Ž    β•Ž    β•Ž    β•Ž  18    @Base/boot.jl:479; Array
     β•Ž    β•Ž    β•Ž    β•Ž     1215  …a/src/matmul.jl:237; mul!
     β•Ž    β•Ž    β•Ž    β•Ž    β•Ž 1215  …/src/matmul.jl:263; mul!
     β•Ž    β•Ž    β•Ž    β•Ž    β•Ž  1215  …/src/matmul.jl:352; generic_matmatmul!
     β•Ž    β•Ž    β•Ž    β•Ž    β•Ž   1215  …src/matmul.jl:605; gemm_wrapper!(C::Matrix{Float…
 1215β•Ž    β•Ž    β•Ž    β•Ž    β•Ž    1215  …a/src/blas.jl:1524; gemm!(transA::Char, transB:…
    3β•Ž    β•Ž    β•Ž    β•Ž  3     …LinearAlgebra.jl:616; peakflops(n::Int64; eltype::Data…
     β•Ž11622 @Base/task.jl:682; task_done_hook(t::Task)
     β•Ž 11622 @Base/task.jl:1008; wait()
11622β•Ž  11622 @Base/task.jl:999; poptask(W::Base.IntrusiveLinkedListSynchronized{Tas…
Total snapshots: 21307. Utilization: 36% across all threads and tasks. Use the `groupby` kwarg to break down by thread and/or task.

julia> versioninfo()
Julia Version 1.10.5
Commit 6f3fdf7b362 (2024-08-27 14:19 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 16 Γ— AMD Ryzen 7 7840U w/ Radeon  780M Graphics
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, znver3)
Threads: 8 default, 0 interactive, 4 GC (on 16 virtual cores)
Environment:
  JULIA_NUM_THREADS = 8
1 Like

Judging by the discussion on GitHub, this only seems to happen when Julia is launched with multiple threads