Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Commit

Permalink
Fix issues in IBMBackend
Browse files Browse the repository at this point in the history
This commit fixes some issues in the IBMBackend class, specifically
around the parsing of the configuration data and gaps in the migration.
The two issues are first a unit conversion issue between the BackendV2
abstract interface expecations. BackendV2 and Target are explicitly in
seconds for all duration fields and the api payloads are in nanoseconds.
The second issue is that for BackendV1 the delay operation is a built-in
directive for all backends but in BackendV2 it must be defined in the
target if the backend supports it. To ensure that uses can still compile
to an IBM backend target the delay instruction is added to the target to
indicate it's a valid operation on all qubits.
  • Loading branch information
mtreinish committed May 3, 2022
1 parent 38e8ee1 commit 579c6e0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion qiskit_ibm_provider/ibm_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ def dtm(self) -> float:
Returns:
dtm: The output signal timestep in seconds.
"""
return self._configuration.dtm
return self._configuration.dtm * 1e-9

@property
def max_circuits(self) -> int:
Expand Down
6 changes: 5 additions & 1 deletion qiskit_ibm_provider/utils/backend_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from qiskit.circuit.library.standard_gates import IGate, SXGate, XGate, CXGate, RZGate
from qiskit.circuit.parameter import Parameter
from qiskit.circuit.gate import Gate
from qiskit.circuit.delay import Delay
from qiskit.circuit.measure import Measure
from qiskit.circuit.reset import Reset
from qiskit.providers.models import (
Expand Down Expand Up @@ -107,7 +108,7 @@ def convert_to_target(
target.add_instruction(Measure())
# parse global configuration properties
if hasattr(configuration, "dt"):
target.dt = configuration.dt
target.dt = configuration.dt * 1e-9
if hasattr(configuration, "timing_constraints"):
target.granularity = configuration.timing_constraints.get("granularity")
target.min_length = configuration.timing_constraints.get("min_length")
Expand All @@ -131,6 +132,9 @@ def convert_to_target(
target[inst][(qubit,)].calibration = sched
else:
target[inst][qarg].calibration = sched
target.add_instruction(
Delay(Parameter("t")), {(bit,): None for bit in range(target.num_qubits)}
)
return target


Expand Down

0 comments on commit 579c6e0

Please sign in to comment.