"RuntimeError: Disconnected architecture graph" for some IBMQ backends
Closed this issue · 3 comments
chris-n-self commented
I am getting this error when trying to compile some circuits with some IBM backends, this code fails for me:
from pytket.extensions.qiskit import qiskit_to_tk, tk_to_qiskit, IBMQBackend
from pytket.qasm import circuit_from_qasm_str
pytket_backend = IBMQBackend('ibmq_16_melbourne',
hub='ibm-q',
group='open',
project='main',)
pytket_circuit = circuit_from_qasm_str(
'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg q[5];\ncreg c[5];\nu3(pi/2,0,pi) q[0];\nu3(pi/2,0,pi)'
+ ' q[1];\ncx q[1],q[0];\nu3(0,0,-pi/4) q[0];\nu3(pi/2,0,pi) q[2];\ncx q[2],q[0];\ncx q[1],q[0];\n'
+ 'u3(0,0,-pi/4) q[0];\nu3(pi/2,0,pi) q[3];\ncx q[3],q[0];\ncx q[1],q[0];\ncx q[2],q[0];\n'
+ 'cx q[1],q[0];\nu3(pi/2,0,pi) q[4];\ncx q[4],q[0];\ncx q[1],q[0];\ncx q[2],q[0];\ncx q[1],q[0];\n'
+ 'cx q[3],q[0];\nu3(0,0,pi/4) q[0];\ncx q[1],q[0];\ncx q[2],q[0];\nu3(0,0,pi/4) q[0];\ncx q[1],q[0];\n'
+ 'cx q[2],q[1];\nu3(0,0,-pi/4) q[1];\ncx q[3],q[1];\ncx q[2],q[1];\ncx q[4],q[0];\ncx q[4],q[1];\n'
+ 'cx q[2],q[1];\ncx q[3],q[1];\nu3(0,0,pi/4) q[1];\ncx q[2],q[1];\ncx q[3],q[2];\nu3(0,0,-pi/4) q[2];\n'
+ 'cx q[4],q[1];\ncx q[4],q[2];\nu3(0,0,pi/4) q[2];\ncx q[3],q[2];\ncx q[4],q[2];\ncx q[4],q[3];\n'
+ 'cx q[4],q[3];\nu3(pi/2,0,pi) q[4];\nbarrier q[0],q[1],q[2],q[3],q[4];\nbarrier q[0];\nbarrier q[1];\n'
+ 'barrier q[2];\nbarrier q[3];\nbarrier q[4];\nmeasure q[0] -> c[0];\nmeasure q[1] -> c[1];\n'
+ 'measure q[2] -> c[2];\nmeasure q[3] -> c[3];\nmeasure q[4] -> c[4];\n'
)
pytket_backend.compile_circuit(pytket_circuit, optimisation_level=2)
tk_to_qiskit(pytket_circuit).draw()
giving an error:
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-6-8590b7c732c1> in <module>
19 + 'measure q[2] -> c[2];\nmeasure q[3] -> c[3];\nmeasure q[4] -> c[4];\n'
20 )
---> 21 pytket_backend.compile_circuit(pytket_circuit, optimisation_level=2)
22 tk_to_qiskit(pytket_circuit).draw()
/opt/anaconda3/envs/qiskit0.25.2/lib/python3.8/site-packages/pytket/backends/backend.py in compile_circuit(self, circuit, optimisation_level)
141 :type optimisation_level: int, optional
142 """
--> 143 self.default_compilation_pass(optimisation_level).apply(circuit)
144
145 @property
RuntimeError: Disconnected architecture graph
Whereas if I try and run the same with ibmq_santiago
rather than ibmq_16_melbourne
it will work fine.
I have pytket v0.9.0 and pytket-qiskit v0.9.1 installed through pip.
cqc-alec commented
Thank you for the report. This is indeed a bug in pytket 0.9.0. The relevant code has since undergone some refactoring which appears to have fixed the issue (so it should be fixed in the upcoming release, hopefully later this week).
chris-n-self commented
Great, thank you! I will look out for the new version
chris-n-self commented
I have upgraded to 0.10.0 and this now works for me so I am closing the issue.