Comments (10)
def gen_snt_check():
from numba.core.config import NUMBA_NUM_THREADS
msg = "The number of threads must be between 1 and %s" % NUMBA_NUM_THREADS
def snt_check(n):
if n > NUMBA_NUM_THREADS or n < 1:
raise ValueError(msg)
return snt_check
snt_check = gen_snt_check()
So someone is setting NUMBA_NUM_THREADS
. I checked it is not available in my environment as an env var. Nor it is specified anywhere in qibotn
.
from qibojit.
And also, when inside IPython in the same environment, I get:
[ins] In [1]: import numba
[ins] In [2]: numba.config
Out[2]: <module 'numba.core.config' from '/media/alessandro/moneybin/Projects/Qibo/qibotn/env/lib/python3.10/site-packages/numba/core/config.py'>
[ins] In [3]: numba.config.NUMBA_NUM_THREADS
Out[3]: 12
while clearly Numba is resolving it to 6 during pytest
run...
from qibojit.
Did you check quimb import call?
from qibojit.
The quimb
import in qibotn
is trivial:
import quimb as qu
import quimb.tensor as qtn
I'm going to check immediately inside quimb
package itself.
from qibojit.
You were right, culprit found:
https://github.com/jcmgray/quimb/blob/8ecf9d6ef7d2055ebbae5f7dbb5aeb0e65c0d422/quimb/core.py#L37-L51
import psutil
_NUM_THREAD_WORKERS = psutil.cpu_count(logical=False)
if "NUMBA_NUM_THREADS" in os.environ:
if int(os.environ["NUMBA_NUM_THREADS"]) != _NUM_THREAD_WORKERS:
import warnings
warnings.warn(
"'NUMBA_NUM_THREADS' has been set elsewhere and doesn't match the "
"value 'quimb' has tried to set - "
f"{os.environ['NUMBA_NUM_THREADS']} vs {_NUM_THREAD_WORKERS}."
)
else:
os.environ["NUMBA_NUM_THREADS"] = str(_NUM_THREAD_WORKERS)
from qibojit.
Indeed, this is working:
❯ QUIMB_NUM_PROCS=12 pytest
===================================================================== test session starts =====================================================================
platform linux -- Python 3.10.7, pytest-7.2.1, pluggy-1.0.0
rootdir: /media/alessandro/moneybin/Projects/Qibo/qibotn, configfile: pyproject.toml, testpaths: tests/
plugins: env-0.8.1, cov-4.0.0
collected 4 items
tests/test_qasm_quimb_backend.py .... [100%]
The explanation is a few lines above those cited in the previous comment.
from qibojit.
@scarrazza then I guess I shoul move this issue to qibotn
, and set the correct variable there.
If you agree, I will "transfer" the issue there (i.e. open a new one, since being a private repo I can't actually transfer).
from qibojit.
Sure, please go ahead.
from qibojit.
Related Issues (20)
- porting workflows repo
- Inverse of singular matrix in a quantum-to-classical channel in `numba` HOT 1
- Port poetry HOT 3
- Improvements for cuQuantum backend HOT 3
- Cannot run pytest when cuquantum is installed HOT 1
- Tests in Qibo repository fail with AMD ROCm HOT 4
- Dry run overhead is inconsistent between different environments HOT 5
- CPU fallback for probabilities is not working
- Probabilities do not sum to 1 HOT 2
- Kernel calls and thread synchronization HOT 1
- Multiqubit ops CPU performance HOT 4
- Single precision vs double precision performance HOT 19
- Multiqubit ops GPU performance HOT 1
- Error when installing from source HOT 6
- Wrong result when applying unitary matrix using cuquantum HOT 3
- Module not found during installation HOT 10
- FSWAP operator
- Cuquantum fails using the latest release HOT 2
- Add cuQuantum version in documentation HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from qibojit.