Open MazenAli opened 1 month ago
I don't think we have many timers inside the codebase right now anyway, what were you hoping to time?
As an alternative, I would recommend using a profiler.
I wanted to time dmrg, i.e., how much time dmrg spends in the subroutines, e.g., truncating, eigenvalue solve, etc. You do use the timeit_debug decorators, but I couldn't find tests for it. Did you test it?
I don't remember testing it, I haven't used TimerOutputs
in a long time, we were mostly using it in the codebase for debugging some performance issues early on when developing the package. Probably we should remove it at this point, it isn't really meant for external users.
I'll keep this issue open as a reminder to remove TimerOutputs
from the codebase.
@MazenAli to summarize, I would recommend using a profiler instead, or dev'ing the package and adding your own timers with TimerOutputs
if you prefer to use TimerOutputs
.
Description of bug
The
@timeit_debug
decorator fromTimerOutputs
does not to seem to function properly astimeit_debug_enabled
is not defined inITensors
. See also screenshot of README fromTimerOutputs
.Minimal runnable code
```julia using Pkg Pkg.add("TimerOutputs") using ITensors, ITensorMPS, TimerOutputs TimerOutputs.enable_debug_timings(ITensors) const timer = TimerOutput() # Build MPO J = 4.0 h = 1.0 L = 15 ampo = AutoMPO() for j in 1:(L - 1) add!(ampo, -J, "Sz", j, "Sz", j + 1) add!(ampo, -h, "Sx", j) end add!(ampo, -h, "Sx", L) sites = siteinds("S=1/2", L) ham = MPO(ampo, sites) # Do DMRG psi0 = MPS(sites, "Up") nsweeps = 20 maxdim = 15 cutoff = 0 @timeit_debug timer "dmrg" energy, _ = dmrg(ham, psi0; nsweeps=nsweeps, maxdim=maxdim, mindim=maxdim, cutoff=cutoff, outputlevel=0) println("Run $i: $energy") println(timer) ```
Output of minimal runnable code
```julia root@8506b93efb68:/opt/project/examples# julia tmp.jl Resolving package versions... No Changes to `~/.julia/environments/v1.10/Project.toml` No Changes to `~/.julia/environments/v1.10/Manifest.toml` ERROR: LoadError: UndefVarError: `timeit_debug_enabled` not defined Stacktrace: [1] enable_debug_timings(m::Module) @ TimerOutputs ~/.julia/packages/TimerOutputs/Lw5SP/src/TimerOutput.jl:187 [2] top-level scope @ /opt/project/examples/tmp.jl:5 in expression starting at /opt/project/examples/tmp.jl:5 root@8506b93efb68:/opt/project/examples# ```
Version information
versioninfo()
:using Pkg; Pkg.status("ITensors")
: