2
$\begingroup$

Is it possible to do the transpilation with "any" device in qiskit? I would be interested in doing this with already retired devices.

$\endgroup$

1 Answer 1

1
$\begingroup$

Yes, you have two options.

Option 1 - If the backend is part of qiskit.providers.fake_provider you can just load it and transpile for it:

from qiskit.providers.fake_provider import FakeLima
from qiskit import transpile
from qiskit.circuit.library import EfficientSU2

backend = FakeLima()

circuit = EfficientSU2(backend.configuration().num_qubits)
transpile(circuit, FakeLima()).draw('mpl')

transpiled EfficientSU2

or

Option 2 - You can define a coupling map by hand. For example:

from qiskit.transpiler import CouplingMap
coupling_map = CouplingMap([(0,1), (0,2), (2,1), (3,2), (2,3), (4,1)])
coupling_map.draw()

coupling map graph

And then transpile in for that custom-defined coupling map:

from qiskit import transpile
from qiskit.circuit.library import EfficientSU2

circuit = EfficientSU2(backend.configuration().num_qubits)
transpile(circuit, coupling_map=coupling_map).draw('mpl')

result of transpiling in the previously defined coupling map

$\endgroup$
1
  • $\begingroup$ Thanks a lot for the answer. Sorry for the late reply, but another tiny question if I may. I'm noticing that e.g. fakelima returns a little bit different circuit than the retired lima. Is there a way to match both transpilation procedures? $\endgroup$ Oct 31 at 16:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.