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

Enable lo frequencies to be passed in circuits #6167

Merged
merged 39 commits into from
Jun 1, 2021

Conversation

zachschoenfeld33
Copy link
Contributor

@zachschoenfeld33 zachschoenfeld33 commented Apr 6, 2021

Summary

Closes #5874. This PR allows users to provide drive and measure lo frequencies from execute/assemble in qasm jobs. It also provides support for returning qubit_lo_range and meas_lo_range from qasm backends so that users know the allowed values of the lo frequencies.

Details and comments

  • Set default_qubit_los/default_meas_los in execute to set job level lo freqs
  • Set qubit_lo_freq/meas_lo_freq in assemble to set job level lo freqs
  • Set schedule_los in execute/assemble to set expt level (circuit or schedule level) lo freqs
  • Return qubit_lo_range and meas_lo_range via backend.configuration().qubit_lo_range/backend.configuration().meas_lo_range
  • Fix bug where lo ranges were not being checked
  • Add additional checks on length of the lo freq and range lists (must be equal to # of qubits in the system)
  • Tests to verify new behavior

A schema update was provided at Qiskit/ibm-quantum-schemas#9

@zachschoenfeld33
Copy link
Contributor Author

@eggerdj

if 'qubit_lo_range' in out_dict:
out_dict['qubit_lo_range'] = [
[min_range * 1e9, max_range * 1e9] for
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This matches the pulse case

qiskit/test/mock/backends/yorktown/conf_yorktown.json Outdated Show resolved Hide resolved
qiskit/execute_function.py Outdated Show resolved Hide resolved
qiskit/compiler/assembler.py Outdated Show resolved Hide resolved
qiskit/compiler/assembler.py Outdated Show resolved Hide resolved
releasenotes/notes/lo-freqs-circuit-c2ec161873eb4a68.yaml Outdated Show resolved Hide resolved
releasenotes/notes/lo-freqs-circuit-c2ec161873eb4a68.yaml Outdated Show resolved Hide resolved
Copy link
Contributor

@eggerdj eggerdj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will allow the user to set the LO once for all circuits in the job or can the user set this on a per-circuit basis?

qiskit/assembler/assemble_circuits.py Outdated Show resolved Hide resolved
qiskit/compiler/assembler.py Outdated Show resolved Hide resolved
qiskit/compiler/assembler.py Outdated Show resolved Hide resolved
@zachschoenfeld33
Copy link
Contributor Author

Updated--can now set los both at the job level, as well as the individual circuit/schedule level (via schedule_los).

@1ucian0 1ucian0 removed the automerge label May 18, 2021
@1ucian0
Copy link
Member

1ucian0 commented May 18, 2021

It seems like this one was "almost there" and got hit by the black-conflict tsunami . Any chance to have a look at them @zachschoenfeld33 ?

@zachschoenfeld33
Copy link
Contributor Author

Updated @1ucian0

@1ucian0
Copy link
Member

1ucian0 commented Jun 1, 2021

I had to simplify the schedule_los type (from (Optional[Union[List[Union[Dict[PulseChannel, float], LoConfig]], Union[Dict[PulseChannel, float], LoConfig]]]) to list) to make it digestible for sphinx. I would really recommend simplifying that type.

Copy link
Member

@1ucian0 1ucian0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on the previews review from @taalexander, I'm approving this PR.

@1ucian0 1ucian0 added automerge Changelog: API Change Include in the "Changed" section of the changelog labels Jun 1, 2021
@mergify mergify bot merged commit a17594a into Qiskit:main Jun 1, 2021
mtreinish added a commit to mtreinish/qiskit-core that referenced this pull request Sep 20, 2021
This commit addresses a performance regression in assemble() introduced
in Qiskit#6167. That PR added the ability for users to configure pulse
properties via assemble kwargs (such as lo frequencies). While this
should really only be exposed via a Backend's options object and terra
shouldn't have to deal with it, for legacy/backwards compat reasons we
need to expose these options via assemble(). However, that PR was a bit
aggressive in when it needed to parse the pulse defaults and properties
to determine if input was valid. The intent there was for circuits jobs
that users were configuring pulse configuration we'd be providing the
same checks as with pulse jobs. However for circuits jobs this
additional validation is only needed if the user has specified a pulse
configuration options and we need to check that they're valid. If a user
doesn't we shouldn't be touching anything pulse, especially as just
loading pulse defaults can result in a large performance regression
(roughly 2 orders of magnitude over assembly without it). To fix this is
commit adjusts the logic when we parse the pulse defaults (and all the
subsequent logic that uses them) to be if it's a pulse job, or if it's a
circuit job and one of the named pulse paramters has been set. This
returns the performance for pure circuits job to what it was prior to
PR Qiskit#6167 but still retains the functionality that Qiskit#6167 provided when
it's needed.
mtreinish added a commit that referenced this pull request Sep 20, 2021
…7047)

* Avoid configuring pulse defaults in circuit assembly unless needed

This commit addresses a performance regression in assemble() introduced
in #6167. That PR added the ability for users to configure pulse
properties via assemble kwargs (such as lo frequencies). While this
should really only be exposed via a Backend's options object and terra
shouldn't have to deal with it, for legacy/backwards compat reasons we
need to expose these options via assemble(). However, that PR was a bit
aggressive in when it needed to parse the pulse defaults and properties
to determine if input was valid. The intent there was for circuits jobs
that users were configuring pulse configuration we'd be providing the
same checks as with pulse jobs. However for circuits jobs this
additional validation is only needed if the user has specified a pulse
configuration options and we need to check that they're valid. If a user
doesn't we shouldn't be touching anything pulse, especially as just
loading pulse defaults can result in a large performance regression
(roughly 2 orders of magnitude over assembly without it). To fix this is
commit adjusts the logic when we parse the pulse defaults (and all the
subsequent logic that uses them) to be if it's a pulse job, or if it's a
circuit job and one of the named pulse paramters has been set. This
returns the performance for pure circuits job to what it was prior to
PR #6167 but still retains the functionality that #6167 provided when
it's needed.

* Make expected logic more explicit
mergify bot pushed a commit that referenced this pull request Sep 20, 2021
…7047)

* Avoid configuring pulse defaults in circuit assembly unless needed

This commit addresses a performance regression in assemble() introduced
in #6167. That PR added the ability for users to configure pulse
properties via assemble kwargs (such as lo frequencies). While this
should really only be exposed via a Backend's options object and terra
shouldn't have to deal with it, for legacy/backwards compat reasons we
need to expose these options via assemble(). However, that PR was a bit
aggressive in when it needed to parse the pulse defaults and properties
to determine if input was valid. The intent there was for circuits jobs
that users were configuring pulse configuration we'd be providing the
same checks as with pulse jobs. However for circuits jobs this
additional validation is only needed if the user has specified a pulse
configuration options and we need to check that they're valid. If a user
doesn't we shouldn't be touching anything pulse, especially as just
loading pulse defaults can result in a large performance regression
(roughly 2 orders of magnitude over assembly without it). To fix this is
commit adjusts the logic when we parse the pulse defaults (and all the
subsequent logic that uses them) to be if it's a pulse job, or if it's a
circuit job and one of the named pulse paramters has been set. This
returns the performance for pure circuits job to what it was prior to
PR #6167 but still retains the functionality that #6167 provided when
it's needed.

* Make expected logic more explicit

(cherry picked from commit 9ffd69b)
mergify bot added a commit that referenced this pull request Sep 21, 2021
…7047) (#7049)

* Avoid configuring pulse defaults in circuit assembly unless needed

This commit addresses a performance regression in assemble() introduced
in #6167. That PR added the ability for users to configure pulse
properties via assemble kwargs (such as lo frequencies). While this
should really only be exposed via a Backend's options object and terra
shouldn't have to deal with it, for legacy/backwards compat reasons we
need to expose these options via assemble(). However, that PR was a bit
aggressive in when it needed to parse the pulse defaults and properties
to determine if input was valid. The intent there was for circuits jobs
that users were configuring pulse configuration we'd be providing the
same checks as with pulse jobs. However for circuits jobs this
additional validation is only needed if the user has specified a pulse
configuration options and we need to check that they're valid. If a user
doesn't we shouldn't be touching anything pulse, especially as just
loading pulse defaults can result in a large performance regression
(roughly 2 orders of magnitude over assembly without it). To fix this is
commit adjusts the logic when we parse the pulse defaults (and all the
subsequent logic that uses them) to be if it's a pulse job, or if it's a
circuit job and one of the named pulse paramters has been set. This
returns the performance for pure circuits job to what it was prior to
PR #6167 but still retains the functionality that #6167 provided when
it's needed.

* Make expected logic more explicit

(cherry picked from commit 9ffd69b)

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: API Change Include in the "Changed" section of the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow users to set qubit frequencies in execute
4 participants