Interpreting output of Profile: Finding where code is called

Dear Julia enthusiasts,

I’m currently profiling an optimisation code that relies on Optim.jl and Zygote to calculate the gradients. Interestingly, about half of the runtime seems to be spent on creating and destroying tasks. My code does not use any multi-threading, and the optimisation library does not either as far as I could find.

Here my questions:

  • Might the tasking be introduced by the profiling itself? Would that even show up in the report?
  • Is there a way to find out where in the code is called from? Perhaps even if the call is hidden in some other function? Essentially I’d like to have a call graph.

Cheers,
Renato

Update:

I found out that the reported time spent in tasking really seems to come from profiling itself. Even for the following simple example it is visible:

using Profile
using Random
using StatProfilerHTML

function f(A, x)
    return A * x
end

A = rand(10_000, 10_000)
x = rand(10_000)

@profile f(A, x)
statprofilehtml()

Screenshot of the output (cropped at the top part):