Bypass some overhead in TensorMap constructor, bypass overhead in sectorequal/sectorhash for trivial symmetry#476
Bypass some overhead in TensorMap constructor, bypass overhead in sectorequal/sectorhash for trivial symmetry#476lkdvos wants to merge 4 commits into
sectorequal/sectorhash for trivial symmetry#476Conversation
This removes the checks in the inner constructors to allow TensorMap construction without any overhead. To keep some of the warnings, I've added this back to some of the outer constructors.
|
I tested an earlier version of this branch (commit Allocation counts for DMRG dropped ~25-30% consistently:
( More broadly, essentially every MPO-MPS-application benchmark across all three algorithms and both tested sizes shows a real improvement — time ratios mostly 0.67–0.99, memory ratios 0.39–1.00, with zero memory regressions anywhere in the suite. DMRG's own time ratios land in a similar 0.88–0.99 range. Happy to share the full |
|
That is great to hear. Can I ask why you want to create a new MPS/MPO package, instead of using MPSKit, or, if you find that functionality is missing, contributing to it? I see in the description of your package that you think that MPSKit is somehow "VUMPS first", but that doesn't make any sense. MPSKit has full support for standard finite MPS, including DMRG, TDVP and a bunch of other functionality (like finite size excitations). |
Co-authored-by: Jutho <Jutho@users.noreply.github.com>
As discussed with @Jutho and @kshyatt before, this PR consists of two changes:
The first (set) is:
TensorMapare now no longer doing the checks, bypassing a small amount of overhead for looking up some of the cached data, as well as a small amount of overhead for the warnings withmaxlog = 1.The second is:
sectorequalandsectorhashcan be specialized forTrivialsymmetry type, as brought up in Unnecessary Set allocation in sectorequal/issetequal for Trivial sectors #475.Note that this is only a partial fix for #475, and to thoroughly fix some of this we would probably rather try to avoid caching the symmetry structure, which requires slightly more plumbing which I would like to hold off on for now, if this turns out to not be required it's a bunch of specialized code to maintain and check.