+1 vote
asked by (170 points)


I'd like to compile ITensor so I can use multithreading to speed up my code. I see the same timings of my code whether I use a single thread or multiple threads (for example by changing the option: export OMPNUMTHREADS=32) when the code is compiled using the default Makefile and options.mk file given on the ITensor website. I have tried to make appropriate modifications to these files to allow for multi-threading, but I can't seem to get it to work. Would you have any suggestions?


1 Answer

0 votes
answered by (51.6k points)

Hi Josh,
So currently the only part of ITensor that uses multithreading is when ITensor makes calls to BLAS dgemm (and in some cases zgemm) for performing tensor contractions. When the contracted tensors are sufficiently large, BLAS libraries like MKL will automatically use multi-threading to speed them up.

So if you are using a good BLAS library such as MKL and you do calculations involving large tensors, you should see a speedup when you leave OMPNUMTHREADS or set it to a larger value versus setting OMPNUMTHREADS=1.

If you aren't seeing a speedup, it could be because the tensors involved in your code are not quite large enough, or your code's running time isn't dominated by tensor contractions.

In the future we plan to exploit multithreading more within ITensor itself.

Best regards,

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.