|
Dear MPSKit Developer, Thank you for this wonderful package! I am trying to use multithreading in IDMR I have attached my scripts. Can you help to improve the parallelism? Thank you! Best, |
Replies: 2 comments 6 replies
|
Hi Feng, It seems like you didn't upload the files here, and something went wrong. Considering the parallelization in IDMRG, this is indeed not straightforward, and can depend on a variety of settings. Some of this information I can deduce once you upload the script, but mostly the questions are about what kind of model you are considering, and what kind of symmetry you are using. Best, |
|
Hi Feng, I finally got to looking at your code in a bit more detail, thanks for your patience! Let me start with the long story short: the low core usage is not necessarily something you configured wrong, it is mostly a property of the IDMRG algorithm itself. Hopping operatorIn hop_l = ones(elt, pspace ← pspace ⊗ aspace) # c†
hop_r = ones(elt, aspace ⊗ pspace ← pspace) # c
Since the ratios differ, this is not an overall rescaling of The cleanest way to see the consequence is the free-electron limit. For a half-filled open chain of 20 sites at and at your actual I would strongly recommend not hand-writing these operators. TensorKitTensors.jl has them all, tested, for every symmetry combination: using TensorKitTensors.HubbardOperators
P = hubbard_space(U1Irrep, SU2Irrep)
hop = e_hopping(ComplexF64, U1Irrep, SU2Irrep) # already c†c + h.c.
d_op = ud_num(ComplexF64, U1Irrep, SU2Irrep) # n↑ n↓
n_op = e_num(ComplexF64, U1Irrep, SU2Irrep) # n↑ + n↓Note One thing you did that is definitely worth keeping: shifting the U(1) charges to I = sectortype(H)
H = MPSKit.add_physical_charge(H, fill(I(0, 1, 0), length(H)))which is exactly the mechanism 2. Core usage
So For symmetric tensors the work is spread over many small blocks, one per symmetry sector, and in the current stack those loops are serial:
That last one is the knob worth knowing about, which is somewhat hidden inside of TensorKit: TensorKit.set_num_transformer_threads(n) # threads permute/braid over fusion blocks
TensorKit.set_num_manipulation_threads(n) # threads construction of recoupling dataBoth default to Concretely, I would scan the split of your 32 cores between the two pools rather than guess: and set them explicitly in the script rather than through Honestly though: at small bond dimension your blocks are simply too small for 32 cores, and no setting we currently have will fix that. 3. Other improvementsYour loop currently does psi, _, _ = find_groundstate(psi, H, IDMRG2(...))
E = sum(real, expectation_value(psi, H)) / LBoth lines throw away work. envs = environments(psi, H, psi)
psi, envs, delta = find_groundstate(psi, H, IDMRG2(...), envs)
E = real(expectation_value(psi, H, envs)) / length(psi)Passing Ramp the bond dimension. Going straight to Checkpoint less often: Each 4. Change algorithm typesVUMPS, VOMPS and TDVP do parallelize over the unit cell through Best, |
Hi Feng,
I finally got to looking at your code in a bit more detail, thanks for your patience!
Let me start with the long story short: the low core usage is not necessarily something you configured wrong, it is mostly a property of the IDMRG algorithm itself.
However, before getting into that, on a separate note there is some code in
model_setup.jlthat probably is not what you meant.Hopping operator
In
hopping_SU2you build the creation operator asonessets every reduced matrix element to 1.With SU(2) spin symmetry those reduced matrix elements are not all 1: the Wigner–Eckart theore…