Closed kmlau closed 5 months ago
cc @dstrain115
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 97.81%. Comparing base (
6709046
) to head (8e79f46
).
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
How will users interact with this new proto? IIUC, the internal diff proto has an abstraction layer that clients can easily interact with for creating a Diff which can then be easily packaged into its proto form. Can a similar well defined abstraction layer e.g
class DeviceParameterDiff
exist for this proto as well? It doesn't have to include all the APIs as the one linked, but a clear abstraction layer will help me see how this proto will later get integrated into a Job's run context. WDYT?
thanks for the comment.
the PR includes a helper function to construct a DeviceParametersDiff proto out of a list of DeviceParameter and their values. please see the module run_context.py in this PR. Suppose you want to override some readout parameters on 2 qubits, and build a RunContext proto with such overrides, you may use the following code
import run_context
device_params_override = run_context.to_device_parameters_diff([
(
run_context_pb2.DeviceParameter(
path=["q1_2", "readout_default", "readoutDemodDelay"], units="ns"
),
program_pb2.ArgValue(float_value=5.0),
),
(
run_context_pb2.DeviceParameter(
path=["q3_4", "readout_default", "readoutFidelities"]),
program_pb2.ArgValue(
double_values=program_pb2.RepeatedDouble(values=[0.991, 0.993])
),
),
])
my_rc = run_context_pb2.RunContext(
device_parameters_override=device_params_override)
friendly ping @senecameeks and @dstrain115
The new proto
DeviceParametersDiff
is for a user to compose a RunJobRequest for invoking RunJob rpc on a Cirq server, in particular to populate theRunJobRequest.run_context
field with device parameters overrides to customize the circuit(s) execution with some control on the device's samples data.This is based on a design reviews to add "device parameters overrides" before executing circuits sweeping.
I renamed some proto type names from similar internal data structure to prevent reference to internal infrastructures.