Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for BackendV2 #53

Open
kevinsung opened this issue Nov 23, 2022 · 2 comments
Open

Add support for BackendV2 #53

kevinsung opened this issue Nov 23, 2022 · 2 comments

Comments

@kevinsung
Copy link

import mapomatic
from qiskit import QuantumCircuit, transpile
from qiskit.providers.fake_provider import FakeBelemV2

qc = QuantumCircuit(5)
qc.h(0)
qc.cx(0, 1)
qc.cx(0, 2)
qc.cx(0, 3)
qc.cx(0, 4)
qc.measure_all()

backend = FakeBelemV2()
trans_qc = transpile(qc, backend)

print(mapomatic.best_overall_layout(trans_qc, [backend]))
Traceback (most recent call last):
  File "/home/kevinsung/projects/scratch/mapomatic-backendv2.py", line 16, in <module>
    print(mapomatic.best_overall_layout(trans_qc, [backend]))
  File "/home/kevinsung/projects/mapomatic/mapomatic/layouts.py", line 190, in best_overall_layout
    config = backend.configuration()
AttributeError: 'FakeBelemV2' object has no attribute 'configuration'
@kevinsung
Copy link
Author

I think the proper way to go about this is to rewrite the codebase assuming the input is a BackendV2. If the input is not a BackendV2, first convert it using BackendV2Converter.

@kevinsung
Copy link
Author

kevinsung commented Jan 6, 2023

I made an attempt at this and started to run into some difficulties. It appears that mapomatic makes some assumptions about the backend that are not satisfied by BackendV2. In particular I had trouble translating the following expressions:

  • backend.configuration().simulator
  • backend.configuration().processor_type.get('segment', '')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant