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

No support for transpiling Schedule #12447

Closed
jccalvojackson opened this issue May 20, 2024 · 7 comments · Fixed by #12448
Closed

No support for transpiling Schedule #12447

jccalvojackson opened this issue May 20, 2024 · 7 comments · Fixed by #12448
Labels
bug Something isn't working

Comments

@jccalvojackson
Copy link

jccalvojackson commented May 20, 2024

Environment

  • Qiskit version: 1.1.0
  • Python version: 3.11
  • Operating system: macos

What is happening?

Documentation says that is possible to run a pulse level program by calling backend.run(transpile(pulse_prog, backend)). However, that is not yet supported.

How can we reproduce the issue?

Just run the example in the documentation

from qiskit import pulse, transpile
 
d0 = pulse.DriveChannel(0)
 
with pulse.build() as pulse_prog:
    pulse.play(pulse.Constant(100, 1.0), d0)

transpile(pulse_prog, backend)

What should happen?

transpile successfully

Any suggestions?

No response

@jccalvojackson jccalvojackson added the bug Something isn't working label May 20, 2024
@jakelishman
Copy link
Member

Thanks - this is a documentation mistake stemming from the removal of execute in #11565. Schedules cannot be transpiled. There was (a long time ago) support planned, but it never materialised.

That documentation originally said that Schedules can be executed the same as circuits, where execute was (for circuits) a wrapper around backend.run and transpile. For Schedule, however, it never did any transpilation, it just submitted it to the backend.

If there are still pulse-enabled backends (I'm not 100% certain on the states of what's allowed for submission), then you would be able to do backend.run(pulse_prog).

@jccalvojackson
Copy link
Author

Thanks for the prompt reply!

I just tried backend.run(pulse_prog) with ibm_kyoto for example (open_pulse=True) and it fails with

Screenshot 2024-05-20 at 17 11 53

@jccalvojackson
Copy link
Author

I've tried the hack of adding a schedule to a custom gate with add_calibration and run the corresponding circuit instead. But when I try to control the measurement pulse, the job gets submitted and then fails with Unknown Error

@wshanks
Copy link
Contributor

wshanks commented May 20, 2024

I've tried the hack of adding a schedule to a custom gate with add_calibration and run the corresponding circuit instead.

Attaching pulse schedules as gate calibrations is the only supported method of submitting pulse instructions to IBM backends now.

when I try to control the measurement pulse, the job gets submitted and then fails with Unknown Error

It is possible to customize the measurement pulse. I have only done it by providing a pulse gate calibration for the measure instruction personally. If you want to share more of what you tried, we can try to debug what is happening. If you are not testing custom measurement, the easiest option is to use a pulse gate calibration for your control pulses and use the default measure gate.

We can also discuss in the #open-pulse channel in Qiskit Slack.

@jccalvojackson
Copy link
Author

jccalvojackson commented May 20, 2024

Thank you! I've put an example code of what im trying to do here Qiskit/qiskit-ibm-runtime#1693

If you are not testing custom measurement, the easiest option is to use a pulse gate calibration for your control pulses and use the default measure gate.

I'm trying custom measurements.

How did you provide a gate calibration for the measure instruction?

@wshanks
Copy link
Contributor

wshanks commented May 20, 2024

I can try running your code and see if I understand the error. Compared to what you have there what I usually do is ground_circuit.measure(0, 0) and then ground_circuit.add_calibration("measure", ...). I am not sure if measure is handled specially in the backend or just there is something else wrong with what you tried.

@jccalvojackson
Copy link
Author

ofc, makes sense! I thought measure was handled differently from the rest of the gates. Will give that a try although now the queue is 9hrs xd. So if you have priority access would appreciate to hear if it worked for you 😅

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
Development

Successfully merging a pull request may close this issue.

3 participants