qtn.Circuit.sample uses multiple CPU cores #242
Replies: 4 comments 5 replies
-
It appears that setting group_size=1 solves the problem, and the problem shows up if setting group_size>=8. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the quick reply! I was able to reproduce the problem on my desktop using the example below. For this specific case, the problem goes away if I set group_size=13...
Please let me know if you need further information! |
Beta Was this translation helpful? Give feedback.
-
I couldn't really pin down where the over-threading was taking place (wasn't very consistent), my guess is something to do with the I've actually just added much more efficient MPS-specific sampling that side steps the issue here : #244. But would still be good to work out exactly which bit of code is using the threads. |
Beta Was this translation helpful? Give feedback.
-
Hi Johnnie, thanks for the quick update! The problem seems not to be tied with sampling specifically as the following example also invokes the multi-threading behavior.
Multi-threading seems to come from |
Beta Was this translation helpful? Give feedback.
-
Hi Johnnie, while trying to sample several times from a very simple quantum circuit, I noticed that qtn.Circuit.sample uses all the CPU cores in my computer. I simply wonder is there a way to force qtn.Circuit.sample to be single-threaded? I am doing
import os
os.environ['OPENBLAS_NUM_THREADS'] = '1'
os.environ['OMP_NUM_THREADS'] = '1'
os.environ['MKL_NUM_THREADS'] = '1'
os.environ["NUMEXPR_NUM_THREADS"] = "1"
before importing numpy, so the multi-threading behavior probably doesn't come from numpy. I also tried setting
quimb.core._NUM_THREAD_WORKERS=1
which didn't seem to solve the problem.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions