defining function for toffoli gate:
def toffoli(qc,i1,i2,i3):
qc.h(i3)
qc.cx(i2,i3)
qc.tdg(i3)
qc.cx(i1,i3)
qc.t(i3)
qc.cx(i2,i3)
qc.tdg(i3)
qc.cx(i1,i3)
qc.t(i3)
qc.tdg(i2)
qc.cx(i1,i2)
qc.h(i3)
qc.tdg(i2)
qc.cx(i1,i2)
qc.t(i1)
qc.s(i2)
Defining the registers:
qr=QuantumRegister(5)
cr=ClassicalRegister(5)
qc=QuantumCircuit(qr,cr)
to run the code:
qc.x(qr[0])
qc.x(qr[1])
toffoli(qc,qr[0],qr[1],qr[2])
qc.measure(qr[0],cr[0])
qc.measure(qr[1],cr[1])
qc.measure(qr[2],cr[2])
circuits=[qc]
job=execute(circuits,backend="local_qasm_simulator")
result=job.result()
error:
BrokenProcessPool Traceback (most recent call last)
<ipython-input-10-47786bf8d782> in <module>()
1 circuits=[qc]
----> 2 job=execute(circuits,backend)
3 job.status
4 result=job.result()
~\Anaconda3\envs\QISKitenv\lib\site-packages\qiskit\wrapper\_wrapper.py in execute(circuits, backend, config, basis_gates, coupling_map,initial_layout, shots, max_credits, seed, qobj_id, hpc, skip_translation)
202 q_job = QuantumJob(qobj, backend=backend, preformatted=True,
resources={
203 'max_credits': qobj['config']['max_credits']})
--> 204 return backend.run(q_job)
~\Anaconda3\envs\QISKitenv\lib\site-
packages\qiskit\backends\local\qasm_simulator_cpp.py in run(self, q_job)
83 def run(self, q_job):
84 """Run a QuantumJob on the the backend."""
---> 85 return LocalJob(self._run_job, q_job)
86
87 def _run_job(self, q_job):
~\Anaconda3\envs\QISKitenv\lib\site-packages\qiskit\backends\local\localjob.py in __init__(self, fn, q_job)
44 self._q_job = q_job
45 self._backend_name = q_job.backend.name
---> 46 self._future = self._executor.submit(fn, q_job)
47
48 def result(self, timeout=None):
~\Anaconda3\envs\QISKitenv\lib\concurrent\futures\process.py in submit(self,
fn, *args, **kwargs)
450 with self._shutdown_lock:
451 if self._broken:
--> 452 raise BrokenProcessPool('A child process terminated
'
453 'abruptly, the process pool is not usable
anymore')
454 if self._shutdown_thread:
BrokenProcessPool: A child process terminated abruptly, the process pool is
not usable anymore
I executed this code earlier and it worked. now whichever code I run in Jupyter notebook, I get brokenprocesspool error in the line
job=execute(circuits,backend)
I am not able to understand how to remove this error. Any code i run in my Jupyter Notebook I get the same error in this line. I sent this code to a friend and it executed in his jupyter notebook. Please help.
matplotlib
in your code, that might be part of what is causing this error: github.com/Qiskit/qiskit-ignis/issues/419 – Blinding