Yes, as Miles said, please refer to those docs and let us know if it is still unclear.
For the sake of completeness, here is what we recommend:
(a) For non-QN conserving code, just start Julia serially (julia
or equivalently julia -t 1
), and you don't have to set any more commands. By default, Julia will use multi-threaded BLAS/LAPACK, which is not controlled by setting the number of Julia threads. Instead, the number of BLAS/LAPACK threads can be controlled at runtime with: https://docs.julialang.org/en/v1/stdlib/LinearAlgebra/#LinearAlgebra.BLAS.set_num_threads and will be set to the number of threads your system has available (https://docs.julialang.org/en/v1/base/constants/#Base.Sys.CPU_THREADS ) by default.
(b) For QN conserving code, start Julia with julia -t N
for N > 1
threads and use:
BLAS.set_num_threads(1)
ITensors.Strided.set_num_threads(1)
ITensors.enable_threaded_blocksparse()
The caveat is that in certain cases like Z2 symmetry where there are relatively few blocks, if the blocks are large enough it may be better to use BLAS/LAPACK multithreading instead of block sparse multithreading, so you should benchmark the two approaches (a) and (b) for your own problem and see which one is best.