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

Add new processor selector parameters in cirq-google/engine run methods #6267

Merged
merged 9 commits into from
Aug 30, 2023

Conversation

jurruti
Copy link
Contributor

@jurruti jurruti commented Aug 28, 2023

This pull request (PR) adds two new parameters to the run methods of EngineProgram, Engine, and EngineProcessor: run_name and device_configuration_name. These parameters allow users to select a specific configuration for the processor when running the circuit. They are also added to the init function of ProcessorSampler (and the get_sampler methods within Engine and EngineProcessor).

Additionally, the run methods of EngineProgram and Engine now include a parameter called processor_id. This parameter can be used to specify a specific processor for the run, and will substitute the deprecated parameter processor_ids , because allowing multiple candidate processors was not useful in practice.

@jurruti jurruti requested review from wcourtney, vtomole, cduck, verult and a team as code owners August 28, 2023 23:53
@CirqBot CirqBot added the size: L 250< lines changed <1000 label Aug 28, 2023
@jurruti jurruti changed the title Add new processor selector parameters in Quantum Engine Add new processor selector parameters in cirq-google/engine run methods Aug 28, 2023
@codecov
Copy link

codecov bot commented Aug 29, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (c7048f5) 97.87% compared to head (e185bfe) 97.87%.
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #6267   +/-   ##
=======================================
  Coverage   97.87%   97.87%           
=======================================
  Files        1106     1106           
  Lines       95589    95624   +35     
=======================================
+ Hits        93561    93596   +35     
  Misses       2028     2028           
Files Changed Coverage Δ
cirq-google/cirq_google/engine/engine_client.py 100.00% <ø> (ø)
cirq-google/cirq_google/engine/engine_test.py 100.00% <ø> (ø)
cirq-core/cirq/value/duration.py 98.80% <100.00%> (+0.15%) ⬆️
cirq-core/cirq/value/duration_test.py 100.00% <100.00%> (ø)
...rq-google/cirq_google/engine/abstract_processor.py 93.54% <100.00%> (ø)
cirq-google/cirq_google/engine/engine.py 98.15% <100.00%> (ø)
cirq-google/cirq_google/engine/engine_processor.py 98.05% <100.00%> (ø)
cirq-google/cirq_google/engine/engine_program.py 99.29% <100.00%> (ø)
...irq-google/cirq_google/engine/processor_sampler.py 96.15% <100.00%> (+0.69%) ⬆️
...oogle/cirq_google/engine/processor_sampler_test.py 100.00% <100.00%> (ø)
... and 1 more

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@verult verult left a comment

Choose a reason for hiding this comment

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

The user-facing docstrings look great!

Should there be test changes for Engine, EngineProcessor, and EngineProgram?

cirq-google/cirq_google/engine/engine_processor.py Outdated Show resolved Hide resolved
cirq-google/cirq_google/engine/engine_client.py Outdated Show resolved Hide resolved
cirq-google/cirq_google/engine/processor_sampler_test.py Outdated Show resolved Hide resolved
cirq-google/cirq_google/engine/engine.py Show resolved Hide resolved
cirq-google/cirq_google/engine/engine.py Outdated Show resolved Hide resolved
@@ -237,6 +263,8 @@ async def run_sweep_async(
program_labels: Optional[Dict[str, str]] = None,
job_description: Optional[str] = None,
job_labels: Optional[Dict[str, str]] = None,
run_name: str = "",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we want to update calibration methods?

Copy link
Contributor Author

@jurruti jurruti Aug 30, 2023

Choose a reason for hiding this comment

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

We don't (at least not in this PR). Note that these arguments are for run_sweep, not run_calibration (github view is a bit confusing).

@jurruti jurruti requested a review from verult August 30, 2023 17:44
Copy link
Collaborator

@wcourtney wcourtney left a comment

Choose a reason for hiding this comment

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

LGTM % a couple of comments. Will defer to @verult to approve.

@@ -64,6 +64,8 @@ async def run_async(
program_labels: Optional[Dict[str, str]] = None,
job_description: Optional[str] = None,
job_labels: Optional[Dict[str, str]] = None,
run_name: str = "",
Copy link
Collaborator

Choose a reason for hiding this comment

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

It seems more consistent with the other params to use Optional[str]; why the difference?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I followed the decision we made in EngineClient to keep it as a String field instead of Optional[String] because there is no semantic difference between "" and None.

However, I do think it would be good to make them all Optional to have more consistency. I can do it in a different PR if that is ok.

@@ -64,6 +64,8 @@ async def run_async(
program_labels: Optional[Dict[str, str]] = None,
job_description: Optional[str] = None,
job_labels: Optional[Dict[str, str]] = None,
run_name: str = "",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can't add a comment below, but should these be passed to self.run_sweep_async on line 99?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whoops, thank you for the catch.

Copy link
Collaborator

@verult verult left a comment

Choose a reason for hiding this comment

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

Congrats on wrapping up the project!!!

@verult verult merged commit b70b2fc into quantumlib:master Aug 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: L 250< lines changed <1000
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants