+2 votes
asked by (190 points)

Dear ITensors Team ,
I follow the the "code formula" in https://itensor.github.io/ITensors.jl/stable/Multithreading.html
Everything works well in my 0.1.41 Julia Itensor. However, a bug was reprted after updating the Julia Itensor from 0.1.41 to 0.2.6, I also try downgrading to the version 0.2.0, the same bug appears.
To be more specific, we start julia via julia -t N with N>1, code will be stopped at H = MPO(ampo, sites)
And the bug messages read

ERROR: LoadError: TaskFailedException

nested task error: UndefVarError: block1 not defined
Stacktrace:
 [1] macro expansion
   @ C:\Users\Xin-Chi Zhou\.julia\packages\ITensors\XnM47\src\NDTensors\blocksparse\blocksparsetensor.jl:1035 [inlined]
 [2] (::ITensors.NDTensors.var"#150#151"{Float64, Tuple{Int64, Int64}, Tuple{Int64, Int64}, Tuple{Int64, Int64}, Tuple{Index{Vector{Pair{QN, Int64}}}, Index{Vector{Pair{QN, Int64}}}}, Tuple{Index{Vector{Pair{QN, Int64}}}, Index{Vector{Pair{QN, Int64}}}}, Tuple{Index{Vector{Pair{QN, Int64}}}, Index{Vector{Pair{QN, Int64}}}}, Vector{Tuple{ITensors.NDTensors.Tensor, ITensors.NDTensors.Tensor, ITensors.NDTensors.Tensor}}, SubArray{UnitRange{Int64}, 1, Vector{UnitRange{Int64}}, Tuple{UnitRange{Int64}}, true}})()
   @ ITensors.NDTensors .\threadingconstructs.jl:169

The minimal code is the following:

ITensors.Strided.set_num_threads(1)
BLAS.set_num_threads(1)
ITensors.enable_threaded_blocksparse()

Nx = 4
Ny = 4
N = Nx * Ny
Npart = Int(Nx * Ny / 2)
t = 1.0
D = 80

Nsweep = 2
sweeps = Sweeps(Nsweep)
maxdim!(sweeps, D)
cutoff!(sweeps, 1E-10)

sites = siteinds("Electron", N; conserve_qns=true)
lattice = square_lattice(Nx, Ny; yperiodic=true)


ampo = AutoMPO()
for b in lattice
    ampo .+= -t, "Cdagup", b.s1, "Cup", b.s2
    ampo .+= -t, "Cdagup", b.s2, "Cup", b.s1
    ampo .+= -t, "Cdagdn", b.s1, "Cdn", b.s2
    ampo .+= -t, "Cdagdn", b.s2, "Cdn", b.s1
end

H = MPO(ampo, sites)

By the way, my julia version is 1.6.2 and I am using a AMD CPU if that matters.

Probably i'm missing something, i'm grateful with any help ! Thanks !
XinChi

commented by (13.6k points)
Thanks for the report, I'm seeing the same thing. It should be a very simple fix, I'll work on it as soon as I have some time.
commented by (190 points)
Thank you Matthew :)

1 Answer

+1 vote
answered by (13.6k points)

This should be fixed on the latest version (0.2.7).

Welcome to ITensor Support Q&A, where you can ask questions and receive answers from other members of the community.

Formatting Tips:
  • To format code, indent by four spaces
  • To format inline LaTeX, surround it by @@ on both sides
  • To format LaTeX on its own line, surround it by $$ above and below
  • For LaTeX, it may be necessary to backslash-escape underscore characters to obtain proper formatting. So for example writing \sum\_i to represent a sum over i.
If you cannot register due to firewall issues (e.g. you cannot see the capcha box) please email Miles Stoudenmire to ask for an account.

To report ITensor bugs, please use the issue tracker.

Categories

...