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