Is it possible to do the transpilation with "any" device in qiskit? I would be interested in doing this with already retired devices.
1 Answer
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')
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()
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')
-
$\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