quimb
quimb copied to clipboard
contraction_compressed method
Hello, I accidentally found the TensorNetwork.contract_compressed
method and I tried to use it. However, I get this weird error message regarding Numba
File "/home/maxime/Documents/procus/examples/decoding.py", line 105, in <module>
solution = decoder.optimize(noise)
File "/home/maxime/.miniconda/envs/procus-env/lib/python3.9/site-packages/procus/optimizer.py", line 89, in optimize
distribution = self._update_solution_distribution(network, distribution)
File "/home/maxime/.miniconda/envs/procus-env/lib/python3.9/site-packages/procus/optimizer.py", line 99, in _update_solution_distribution
contraction = self.contraction.contract(
File "/home/maxime/.miniconda/envs/procus-env/lib/python3.9/site-packages/procus/optimizer.py", line 68, in contract
return network.contract_compressed(
File "/home/maxime/.miniconda/envs/procus-env/lib/python3.9/site-packages/quimb/tensor/tensor_core.py", line 5407, in contract_compressed
return tn._contract_compressed_tid_sequence(
File "/home/maxime/.miniconda/envs/procus-env/lib/python3.9/site-packages/quimb/tensor/tensor_core.py", line 5267, in _contract_compressed_tid_sequence
_compress_neighbors(tid_new, t_new, d)
File "/home/maxime/.miniconda/envs/procus-env/lib/python3.9/site-packages/quimb/tensor/tensor_core.py", line 5215, in _compress_neighbors
self._compress_between_tids(
File "/home/maxime/.miniconda/envs/procus-env/lib/python3.9/site-packages/quimb/tensor/tensor_core.py", line 4197, in _compress_between_tids
tensor_compress_bond(ta, tb, **compress_opts)
File "/home/maxime/.miniconda/envs/procus-env/lib/python3.9/site-packages/quimb/tensor/tensor_core.py", line 922, in tensor_compress_bond
T1_L, T1_R = T1.split(left_inds=left_env_ix, right_inds=shared_ix,
File "/home/maxime/.miniconda/envs/procus-env/lib/python3.9/site-packages/quimb/tensor/tensor_core.py", line 2098, in split
return tensor_split(self, *args, **kwargs)
File "/home/maxime/.miniconda/envs/procus-env/lib/python3.9/site-packages/quimb/tensor/tensor_core.py", line 792, in tensor_split
left, s, right = split_fn(array, **opts)
File "/home/maxime/.miniconda/envs/procus-env/lib/python3.9/site-packages/quimb/tensor/decomp.py", line 435, in qr
return _qr_numba(x)
File "/home/maxime/.miniconda/envs/procus-env/lib/python3.9/site-packages/numba/core/dispatcher.py", line 439, in _compile_for_args
raise e
File "/home/maxime/.miniconda/envs/procus-env/lib/python3.9/site-packages/numba/core/dispatcher.py", line 372, in _compile_for_args
return_val = self.compile(tuple(argtypes))
File "/home/maxime/.miniconda/envs/procus-env/lib/python3.9/site-packages/numba/core/dispatcher.py", line 909, in compile
cres = self._compiler.compile(args, return_type)
File "/home/maxime/.miniconda/envs/procus-env/lib/python3.9/site-packages/numba/core/dispatcher.py", line 79, in compile
status, retval = self._compile_cached(args, return_type)
File "/home/maxime/.miniconda/envs/procus-env/lib/python3.9/site-packages/numba/core/dispatcher.py", line 93, in _compile_cached
retval = self._compile_core(args, return_type)
File "/home/maxime/.miniconda/envs/procus-env/lib/python3.9/site-packages/numba/core/dispatcher.py", line 106, in _compile_core
cres = compiler.compile_extra(self.targetdescr.typing_context,
File "/home/maxime/.miniconda/envs/procus-env/lib/python3.9/site-packages/numba/core/compiler.py", line 604, in compile_extra
pipeline = pipeline_class(typingctx, targetctx, library,
File "/home/maxime/.miniconda/envs/procus-env/lib/python3.9/site-packages/numba/core/compiler.py", line 308, in __init__
config.reload_config()
File "/home/maxime/.miniconda/envs/procus-env/lib/python3.9/site-packages/numba/core/config.py", line 414, in reload_config
_env_reloader.update()
File "/home/maxime/.miniconda/envs/procus-env/lib/python3.9/site-packages/numba/core/config.py", line 107, in update
self.process_environ(new_environ)
File "/home/maxime/.miniconda/envs/procus-env/lib/python3.9/site-packages/numba/core/config.py", line 353, in process_environ
raise RuntimeError("Cannot set NUMBA_NUM_THREADS to a "
RuntimeError: Cannot set NUMBA_NUM_THREADS to a different value once the threads have been launched (currently have 4, trying to set 8)
I tried to fix the number of threads using numba.set_num_threads(8)
unsuccessfully. I don't know if this is more a numba issue or a quimb issue.
Also, should I consider this method production-ready? I am asking since it is not documented.
Hi @maxtremblay.
Firstly, no - this is very much not production or supported in any way yet! its some experimental infrastructure but several other things are needed to use it accurately and it will undergo lots of changes / improvements.
Regarding the bug however, this seems unrelated to contract_compressed
. I suppose NUMBA_NUM_THREADS
is being set somewhere else but not via an environment variable, meaning quimb
needs some way of finding that out before exporting the env var itself. Do you know which/if any other packages you are importing also interact with numba
?