jcmgray / quimb

A python library for quantum information and many-body calculations including tensor networks.
http://quimb.readthedocs.io
Other
467 stars 107 forks source link

Rehearsing the Computation: A process in the process pool was terminated abruptly while the future was running or pending #96

Open RRadgohar opened 2 years ago

RRadgohar commented 2 years ago

I have installed quimb following the instruction in https://quimb.readthedocs.io/en/latest/installation.html. Running the codes in the section 11.2 leads to the following error: "concurrent.futures.process.BrokenProcessPool: A process in the process pool was terminated abruptly while the future was running or pending." That happens even for small networks. Would you please help me in solving the issue. Thanks

jcmgray commented 2 years ago

Hi @RRadgohar, not quite sure what's going on here - something to do with the loky process pool executor that cotengra uses by default.

Do you still get errors if you instantiate the optimizer without parallel:?

import cotengra as ctg

opt = ctg.ReusableHyperOptimizer(
    reconf_opts={},
    max_repeats=16,
    parallel=False,  # <-- change to this
)
jcmgray commented 2 years ago

Also, what version of joblib do you have installed in your environment?

RRadgohar commented 2 years ago

Thank you @jcmgray for the reply. I made the change that you mentioned. That led to the "core dumped" error after running the following commands:

import tqdm ZZ = qu.pauli('Z') & qu.pauli('Z') local_exp_rehs = [ circ_ex.local_expectation_rehearse(weight * ZZ, edge, optimize=opt) for edge, weight in tqdm.tqdm(list(terms.items())) ]

RRadgohar commented 2 years ago

Also, the version of joblib is 1.1.0.

jcmgray commented 2 years ago

Hmm, unfortunately the 'broken process' and 'core dumped' are very generic errors and its hard for me to tell what caused them. numba is one dependency that might be worth checking different versions for.

You might also want to try deleting all of the python compiled files in the quimb directory - any under __pycache__.

What OS and python distribution are you using?

RRadgohar commented 2 years ago

OS: ubuntu 20.04.2 python:Python 3.8.10

Thanks

RRadgohar commented 2 years ago

Hi @jcmgray. Thank you for your suggestions. I tried the both ideas of downgrading numb and deleting the files in pycashe. Unfortunately, the error still happens. I decided to try other examples in qumib. I tried the following commends, getting the following error

%config InlineBackend.figure_formats = ['svg']

import random import quimb as qu import quimb.tensor as qtn

N = 80 circ = qtn.Circuit(N)

randomly permute the order of qubits

regs = list(range(N)) random.shuffle(regs)

hamadard on one of the qubits

circ.apply_gate('H', regs[0])

chain of cnots to generate GHZ-state

for i in range(N - 1): circ.apply_gate('CNOT', regs[i], regs[i + 1])

sample it once

for b in circ.sample(1): print(b)

File "/home/user/cotengra/lib/python3.8/site-packages/quimb/tensor/circuit.py", line 2051, in sample p = self.compute_marginal( File "/home/user/cotengra/lib/python3.8/site-packages/quimb/tensor/circuit.py", line 1841, in compute_marginal p_marginal /= nfact