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

[ITensors] [ENCHANCEMENT] Remove TimerOutputs.jl as a dependency #1526

Open
MazenAli opened this issue Sep 9, 2024 · 4 comments
Open

[ITensors] [ENCHANCEMENT] Remove TimerOutputs.jl as a dependency #1526

MazenAli opened this issue Sep 9, 2024 · 4 comments
Labels
bug Something isn't working ITensors Issues or pull requests related to the `ITensors` package.

Comments

@MazenAli
Copy link

MazenAli commented Sep 9, 2024

Description of bug

The @timeit_debug decorator from TimerOutputs does not to seem to function properly as timeit_debug_enabled is not defined in ITensors. See also screenshot of README from TimerOutputs.

Screenshot 2024-09-09 at 16 08 05

Minimal runnable code

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

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

  • Output from versioninfo():
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 (aarch64-linux-gnu)
  CPU: 8 × unknown
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, generic)
Threads: 1 default, 0 interactive, 1 GC (on 8 virtual cores)
Environment:
  JULIA_GPG = 3673DF529D9049477F76B37566E3C7DC03D6E495
  JULIA_VERSION = 1.10.5
  JULIA_PATH = /usr/local/julia
  • Output from using Pkg; Pkg.status("ITensors"):
julia> using Pkg; Pkg.status("ITensors")
Status `~/.julia/environments/v1.10/Project.toml`
  [9136182c] ITensors v0.6.17
@MazenAli MazenAli added bug Something isn't working ITensors Issues or pull requests related to the `ITensors` package. labels Sep 9, 2024
@mtfishman
Copy link
Member

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.

@MazenAli
Copy link
Author

MazenAli commented Sep 9, 2024

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?

@mtfishman
Copy link
Member

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.

@mtfishman
Copy link
Member

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.

@mtfishman mtfishman changed the title [ITensors] [BUG] timeit_debug_enabled not defined [ITensors] [ENCHANCEMENT] Remove TimerOutputs.jl as a dependency Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ITensors Issues or pull requests related to the `ITensors` package.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants