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

InstructionDurations.from_backend(...) does not support BackendV2 #12760

Closed
1ucian0 opened this issue Jul 11, 2024 · 3 comments · Fixed by #12941
Closed

InstructionDurations.from_backend(...) does not support BackendV2 #12760

1ucian0 opened this issue Jul 11, 2024 · 3 comments · Fixed by #12941
Labels
bug Something isn't working
Milestone

Comments

@1ucian0
Copy link
Member

1ucian0 commented Jul 11, 2024

Environment

  • Qiskit version: 1.2.0.dev0+8f6714d
  • Python version: 3.8.19
  • Operating system: MacOs

What is happening?

While migrating test/python/transpiler/test_instruction_durations.py to BackendV2 (see #12660 for context), I realized that InstructionDurations.from_backend does not support BackendV2 instances.

How can we reproduce the issue?

from qiskit.providers.fake_provider import GenericBackendV2
from qiskit.transpiler import InstructionDurations

backend = GenericBackendV2(num_qubits=2, calibrate_instructions=True, seed=42)
InstructionDurations.from_backend(backend)
AttributeError: 'GenericBackendV2' object has no attribute 'properties'

What should happen?

Either this method (preferred option) or a potential InstructionDurations.from_backendV2 should support creating an InstructionDurations from a BackendV2, the current preferred way.

Any suggestions?

No response

@1ucian0 1ucian0 added the bug Something isn't working label Jul 11, 2024
@1ucian0 1ucian0 added this to the 1.3.0 milestone Jul 19, 2024
@shravanpatel30
Copy link
Contributor

Hi @1ucian0, I was looking into this issue and had a question. I looked at the BackendV1 fake backends and they are using old IBM device data for the properties and so I was wondering what date and time should be used to create the properties dictionary for GenericBackendV2?

@1ucian0
Copy link
Member Author

1ucian0 commented Aug 5, 2024

I looked at the BackendV1 fake backends and they are using old IBM device data for the properties and so I was wondering what date and time should be used to create the properties dictionary for GenericBackendV2?

Thanks for explaining this in #12901 . The PR to understand this question. The point is to construct InstructionDuration from a BackendV2 without extending BackendV2. This might not be an easy issue.

@Cryoris
Copy link
Contributor

Cryoris commented Aug 15, 2024

You should be able to just do

instruction_durations = backend.target.durations()   # where backend is a BackendV2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants