Open VietTralala opened 2 years ago
It looks like in the threaded loop multiple threads are modifying the MPS in-place: https://github.com/GTorlai/PastaQ.jl/blob/54cc060b60a13b132d93578f7bf5516eab23927a/src/circuits/getsamples.jl#L161
I wonder if that is causing issues?
It looks like in the threaded loop multiple threads are modifying the MPS in-place:
I wonder if that is causing issues?
Hm I reckon that this is not the issue, since nshot is 1 in my setting. I am trying to measure 1 shot for many different bases. So the parallelization over nshots in line 161 would only create 1 single thread?
Also I tried to change sample_ = getsamples!(M; kwargs...)
into sample_ = getsamples!(copy(M); kwargs...)
howoever still experiencing the bug :|
Hi @VietTralala ,
I encountered the same issue. Have you solved the problem?
Problem
Hi @GTorlai,
I am trying to use your code with ITensors.jl to compute the groundstate of a 2D Heisenberg model and obtain random pauli measurements from it. The code works fine when starting julia normally without any arguments and including my function into REPL and then executing it. However I noticed that julia was not using the full potential of my CPU (only about 8 cores are used) and I looked into the getsamples function where threads are beeing used. Thats why I thought I could speed up the sampling process by starting julia with more threads i.e
julia -t 15
could help. With that change, I was still only observing one cpu beeing utilized during the DMRG sweeps (but this is maybe another issue?) The sampling part of the code (example below) was using all 15 cores successfully. However for some Hamiltonians I obtained the following error:I then computed the normalization constants before and after the sampling process and printed them. The norm was always 1.000000 for the normal MPS and the dense one. So this error does not make sense to me. Could you please help me to find the bug?
Minimal working example
This is a minimal example to reproduce the bug and here are the files needed for that: https://cloud.ml.jku.at/s/FS6fj9oTpzGSfHx. The MPS state was obtained during a simulation whose code I will post below. This small script will produce the above error when starting julia in multithread mode (with -t 15 I'll see 22 sub-processes) and will just work fine when starting julia with (-t 1 but weirdly I still see 8 processes in htop)
original code
The following is some adapted code which was given to me by Hsing-Yuan Huang which was probably also code written by you? It generates the groundstates of different random Hamiltonians and samples from them, which are then stored. The problem occurs eventough I played with different values of
minsweep
, cutoffΛ
, energy toleranceϵ
.Thank you in advance for your time and for providing this useful package!
PS.: Package info:
The packages ITensors and PastaQ are unmodified and are just installed in development mode to make code search with visual studio code more reliable