-
Notifications
You must be signed in to change notification settings - Fork 121
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
feature: Add support for SerializableProgram abstraction to Device interface #976
Conversation
AutoQASM is an experimental module offering a new quantum-imperative programming experience embedded in Python for developing quantum programs. Co-authored-by: Lauren Capelluto <107005333+laurencap@users.noreply.github.com> Co-authored-by: Ryan Shaffer <3620100+rmshaffer@users.noreply.github.com> Co-authored-by: Tim (Yi-Ting) <yitchen@amazon.com>
… programs (#600) * Move mcm=True argument into device.run * Add comments explaining mcm=True kwarg
* Begin improving transpiler code coverage * Code coverage for transpiler to 100% * Remove unnecessary line * Improve exception handling and test cases
* Update local simulator commit * update simulator commit hash in tox --------- Co-authored-by: Tim <yitchen@amazon.com>
* Enable multiprocessing for aq.function calls * Add rx gate
* Change: update how num_qubits get supplied by autoqasm functions * Update README * Add test for mismatched num_qubits args
* Clean up user API
* add gates for notebook examples * autoqasm example notebooks * update example in readme * update notebooks and readme * minor change in mentioning qubit number * update text * update text for merge and for comments
* Handle unnamed return values properly * Combine retval variable names * Fix handling of recursive function return values * Fix handling of return values from non-recursive functions * Move new tests to test_types.py
* Raise error if the user puts a break in their autoqasm loop * Update src/braket/experimental/autoqasm/converters/break_statements.py Co-authored-by: Ryan Shaffer <3620100+rmshaffer@users.noreply.github.com> --------- Co-authored-by: Ryan Shaffer <3620100+rmshaffer@users.noreply.github.com>
… point function (#661) * Add error message for using 'return' from the main autoqasm function. * Respond to CR
* change: improving autoqasm api.py coverage to 100% * Update src/braket/experimental/autoqasm/api.py --------- Co-authored-by: Ryan Shaffer <3620100+rmshaffer@users.noreply.github.com>
* Improve error message for tuple parameters * Update src/braket/experimental/autoqasm/types/conversions.py Co-authored-by: Ryan Shaffer <3620100+rmshaffer@users.noreply.github.com>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #976 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 135 135
Lines 8903 8917 +14
Branches 1998 2002 +4
=========================================
+ Hits 8903 8917 +14 ☔ View full report in Codecov by Sentry. |
If the vision is to support any simulator that can execute OpenQASM, do you think it's worth creating a new result class instead of GateModelQuantumTaskResult? Currently, the MCM simulator writes results in the |
You're right, using the One possible option for now would be to define some kind of generic |
Issue #, if available:
Description of changes:
The scenario is that an external library like AutoQASM wants to create program objects which can be executed on Braket devices, including local simulators and AWS devices, but also wants the freedom to return (simulated) results in a format that does not necessarily match the Braket schema for gate model task results.
This change adds a minimal abstraction,
SerializableProgram
, which represents a program that can be serialized to OpenQASM. It adds support for this in the Device class so that these programs can be run on Braket, while also supporting a local simulator which wants to return aGateModelQuantumTaskResult
directly rather than being forced to match the schema ofGateModelTaskResult
.For example implementations of this abstraction, see:
Testing done:
Tests added to verify new code and maintain 100% code coverage.
Merge Checklist
Put an
x
in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your pull request.General
Tests
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.