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

Setting instruction duration in transpile seems to do nothing. #6667

Closed
nonhermitian opened this issue Jun 30, 2021 · 3 comments · Fixed by #6799
Closed

Setting instruction duration in transpile seems to do nothing. #6667

nonhermitian opened this issue Jun 30, 2021 · 3 comments · Fixed by #6799
Assignees
Labels
bug Something isn't working good first issue Good for newcomers
Milestone

Comments

@nonhermitian
Copy link
Contributor

nonhermitian commented Jun 30, 2021

Information

  • Qiskit Terra version: latest
  • Python version:
  • Operating system:

What is the current behavior?

qc = QuantumCircuit(1)
qc.x(0)
qc.measure_all()

trans_qc = transpile(qc, backend, instruction_durations=[('x', [0], 100000000000000)] )

should take forever to run but it does not.

Steps to reproduce the problem

What is the expected behavior?

I have not seen this feature before, but if it does what it says,

https://qiskit.org/documentation/stubs/qiskit.compiler.transpile.html#qiskit-compiler-transpile

I should be able to modify the duration of instructions. Perhaps this is for pulses only, and the documentation just does not spell this out?

Suggested solutions

@nonhermitian nonhermitian added the bug Something isn't working label Jun 30, 2021
@ajavadia
Copy link
Member

ajavadia commented Jul 1, 2021

This will be used if you specify a scheduling_method. I agree the docs should say this.

Alternatively we make the passmanager take this info to mean scheduling is required. This is how e.g. coupling_map and basis_gates are used, even if you don't specify routing_method or translation_method. I think we should go with this.

@ajavadia ajavadia added the good first issue Good for newcomers label Jul 1, 2021
@ajavadia ajavadia mentioned this issue Jul 2, 2021
2 tasks
@Kovi11Day
Copy link
Contributor

Hello, I am new here, can I look into this issue?

@javabster
Copy link
Contributor

Sure go ahead @Kovi11Day I'll assign to you! Please make sure to refer to the contributing guidelines while working on it. Let us know if you have any questions 😄

Kovi11Day added a commit to Kovi11Day/qiskit-terra that referenced this issue Jul 24, 2021
Add condition in `qiskit.compiler.transpiler`: if `scheduling_method` is not provided and `instruction_durations` argument specified, set `scheduling_method=as_late_as_possible`.
Note that the `as_late_as_possible` scheduling method was chosen as it is the one applied by default by the scheduler when no method is specified. This scheduling method improves the outcome fidelity over the `as_soon_as_possible` scheduling method.

When the `transpile()` function is provided with the `instruction_durations` argument and no `scheduling_method` argument is specified, the behaviour before update is to ignore the `instruction_durations` argument and not apply any scheduling pass.

After the update, the behaviour is to apply scheduling pass with the default scheduling method: `as_late_as_possible`.

Fixes: Qiskit#6667
Kovi11Day added a commit to Kovi11Day/qiskit-terra that referenced this issue Aug 17, 2021
Update docstring to indicate that the argument `instruction_durations` provided to the `transpile()` function is only applicable if the argument `scheduling_method` is also provided.

Fixes: Qiskit#6667
@mergify mergify bot closed this as completed in #6799 Sep 13, 2021
mergify bot added a commit that referenced this issue Sep 13, 2021
* Fix issue 6667 by updating transpiler

Add condition in `qiskit.compiler.transpiler`: if `scheduling_method` is not provided and `instruction_durations` argument specified, set `scheduling_method=as_late_as_possible`.
Note that the `as_late_as_possible` scheduling method was chosen as it is the one applied by default by the scheduler when no method is specified. This scheduling method improves the outcome fidelity over the `as_soon_as_possible` scheduling method.

When the `transpile()` function is provided with the `instruction_durations` argument and no `scheduling_method` argument is specified, the behaviour before update is to ignore the `instruction_durations` argument and not apply any scheduling pass.

After the update, the behaviour is to apply scheduling pass with the default scheduling method: `as_late_as_possible`.

Fixes: #6667

* Fix issue 6667 by updating docstring in transpiler

Update docstring to indicate that the argument `instruction_durations` provided to the `transpile()` function is only applicable if the argument `scheduling_method` is also provided.

Fixes: #6667

Co-authored-by: Kevin Krsulich <kevin.krsulich@ibm.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
@kdk kdk added this to the 0.19 milestone Nov 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants