Skip to content

Consider emptying TensorKit cache after each CTMRG iteration? #341

Description

@Yue-Zhengyuan

I find that calling TensorKit.empty_globalcaches!() can significantly reduce memory usage when dealing with product of several symmetries: just inserting it between these two lines.

env, info = ctmrg_iteration(network, env, alg)
η, CS, TS = calc_convergence(env, CS, TS)

In my case I was contracting a PEPS with fZ2 x U(1) x U(1) symmetry, D = 8, using environment chi = 32. I use the sequential CTMRG with fullinfinite for the projectors. I was also restricting the cache sizes:

resize!(TensorKit.GLOBAL_FSTRANSPOSE_CACHE; maxsize = 400)
resize!(TensorKit.GLOBAL_FSBRAID_CACHE; maxsize = 400)
resize!(TensorKit.GLOBAL_FUSIONBLOCKSTRUCTURE_CACHE; maxsize = 400)
resize!(TensorKit.GLOBAL_TREEBRAIDER_CACHE; maxsize = 400)
resize!(TensorKit.GLOBAL_TREEPERMUTER_CACHE; maxsize = 400)
resize!(TensorKit.GLOBAL_TREETRANSPOSER_CACHE; maxsize = 400)

Using current master branch of PEPSKit, memory usage can go up to 24 GB, which is even more than the amount used fZ2 x U(1). But if I clear cache after each CTMRG iteration, memory usage can be reduced by half, though this seems to have some negative effect on the speed of CTMRG (I haven't been able to do a controlled test due to limited resources).

IIRC, @leburgel was also bothered by the memory issue and may find this cache clearing helpful.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions