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 longer support create_calibration_program and create_batch_program #6442

Merged
merged 33 commits into from
Feb 21, 2024

Conversation

senecameeks
Copy link
Collaborator

This change removes support for engine type jobs FocusedCalibration and BatchProgram, but keeps the interface for backwards compatibility

@CirqBot CirqBot added the size: L 250< lines changed <1000 label Feb 5, 2024
cirq-google/cirq_google/api/v2/calibration.proto Outdated Show resolved Hide resolved
cirq-google/cirq_google/api/v2/batch.proto Outdated Show resolved Hide resolved
cirq-google/cirq_google/engine/engine.py Outdated Show resolved Hide resolved
Copy link

codecov bot commented Feb 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (33eea01) 97.82% compared to head (e440b57) 97.75%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6442      +/-   ##
==========================================
- Coverage   97.82%   97.75%   -0.07%     
==========================================
  Files        1115     1105      -10     
  Lines       97390    94897    -2493     
==========================================
- Hits        95267    92771    -2496     
- Misses       2123     2126       +3     

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

@senecameeks
Copy link
Collaborator Author

Apologies, this PR kind of ballooned after tracing down all the dependencies for batch.proto and calibration.proto . This PR removes the interfaces for running calibrations and running batch programs. Consequently it removes some data objects related to calibration that are no longer used, although the main objective of this particular PR is removing the interfaces.

@senecameeks
Copy link
Collaborator Author

For more context: There are some idiosyncrasies that were done to remove all dependencies on removed code (e.g calibration_pb2.*) without further ballooning the PR (already 75 files changed), for example in class CalibrationResult I chose to only remove the field code whose object type was removed 'calibration_pb2.CalibrationLayerCode' instead of deleting the CalibrationResult. A followup CL will remove classes CalibrationResult, CalibrationLayer and Calibration from cirq-google/cirq_google/engine/ and the APIs which interface with those classes.

@senecameeks
Copy link
Collaborator Author

Ended up removing the idiosyncrasy noted above by changing the code field type in CalibrationResult to Any, which is a much cleaner handling, IMHO.

@wcourtney PTAL :)

cirq-google/cirq_google/engine/engine_job.py Outdated Show resolved Hide resolved
cirq-google/cirq_google/engine/engine_program.py Outdated Show resolved Hide resolved
cirq-google/cirq_google/engine/engine_program.py Outdated Show resolved Hide resolved
@@ -83,30 +81,18 @@ def validate_program(
repetitions: Number of repetitions to run with each sweep.
serializer: Serializer to use to serialize the circuits and sweeps.
max_size: proto size limit to check against.

Raises:
RuntimeError: if compiled proto is above the maximum size.
"""
Copy link
Collaborator

Choose a reason for hiding this comment

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

It looks like validation was removed entirely. I think we still want to serialize and validate the resulting size.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added back!

@@ -36,7 +36,7 @@ def _test_processor(processor: cg.engine.abstract_processor.AbstractProcessor):
with pytest.raises(ValueError, match='Qubit not on device'):
_ = processor.run(circuit, repetitions=100)
circuit = cirq.Circuit(cirq.H(good_qubit), cirq.measure(good_qubit))
with pytest.raises(ValueError, match='Cannot serialize op'):
with pytest.raises(ValueError, match='gate which is not supported'):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why should this message have changed as part of this PR?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah this broke after removing validation-- after adding validation back I was able to revert this change.

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.

So much deleted dead code!! Thanks for the cleanup 🧹

cirq-google/cirq_google/engine/engine_validator.py Outdated Show resolved Hide resolved
@senecameeks senecameeks enabled auto-merge (squash) February 21, 2024 19:48
@senecameeks senecameeks merged commit e76702f into quantumlib:main Feb 21, 2024
34 checks passed
pavoljuhas added a commit that referenced this pull request Sep 27, 2024
Restore proto files that are still used by internal code.
This reverts small part of #6442.
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.

3 participants