qiskit
qiskit copied to clipboard
Round durations in `GenericBackendV2`
Summary
This PR makes sure that the conversion of GenericBackendV2 instruction durations to dt is exact to avoid user warnings during scheduling of type:
UserWarning: Duration is rounded to 616 [dt] = 1.367520e-07 [s] from 1.366887e-07 [s]
Given that the durations are sampled randomly, and the rounded duration is the one used in the scheduling passes, we might as well make sure in advance that the conversion from seconds to dt will be exact and doesn't raise warnings.
Details and comments
I am not sure this qualifies as a bugfix but I think it improves the readability of the test logs. For example, for test_scheduling_backend_v2 in test/python/compiler/test_transpiler.py. Before:
/Users/ept/qiskit_workspace/qiskit/qiskit/circuit/duration.py:37: UserWarning: Duration is rounded to 986 [dt] = 2.188920e-07 [s] from 2.189841e-07 [s]
warnings.warn(
/Users/ept/qiskit_workspace/qiskit/qiskit/circuit/duration.py:37: UserWarning: Duration is rounded to 2740 [dt] = 6.082800e-07 [s] from 6.083383e-07 [s]
warnings.warn(
/Users/ept/qiskit_workspace/qiskit/qiskit/circuit/duration.py:37: UserWarning: Duration is rounded to 2697 [dt] = 5.987340e-07 [s] from 5.988312e-07 [s]
warnings.warn(
/Users/ept/qiskit_workspace/qiskit/qiskit/circuit/duration.py:37: UserWarning: Duration is rounded to 178 [dt] = 3.951600e-08 [s] from 3.956636e-08 [s]
warnings.warn(
.
----------------------------------------------------------------------
Ran 1 test in 0.548s
OK
After:
.
----------------------------------------------------------------------
Ran 1 test in 0.506s
OK
One or more of the the following people are requested to review this:
@Qiskit/terra-core
Pull Request Test Coverage Report for Build 8392874457
Details
- 4 of 4 (100.0%) changed or added relevant lines in 1 file are covered.
- 3 unchanged lines in 1 file lost coverage.
- Overall coverage increased (+0.02%) to 89.321%
| Files with Coverage Reduction | New Missed Lines | % |
|---|---|---|
| crates/qasm2/src/lex.rs | 3 | 91.86% |
| <!-- | Total: | 3 |
| Totals | |
|---|---|
| Change from base Build 8391327735: | 0.02% |
| Covered Lines: | 59794 |
| Relevant Lines: | 66943 |