diff --git a/cirq-google/cirq_google/__init__.py b/cirq-google/cirq_google/__init__.py index 4c66402529a..1a45c9fdb4c 100644 --- a/cirq-google/cirq_google/__init__.py +++ b/cirq-google/cirq_google/__init__.py @@ -120,9 +120,16 @@ from cirq_google.workflow import ( ExecutableSpec, + KeyValueExecutableSpec, QuantumExecutable, QuantumExecutableGroup, BitstringsMeasurement, + SharedRuntimeInfo, + RuntimeInfo, + ExecutableResult, + ExecutableGroupResult, + QuantumRuntimeConfiguration, + execute, ) from cirq_google import experimental diff --git a/cirq-google/cirq_google/json_resolver_cache.py b/cirq-google/cirq_google/json_resolver_cache.py index 4f165d750bb..f50cbe73eba 100644 --- a/cirq-google/cirq_google/json_resolver_cache.py +++ b/cirq-google/cirq_google/json_resolver_cache.py @@ -44,4 +44,10 @@ def _class_resolver_dictionary() -> Dict[str, ObjectFactory]: 'cirq.google.BitstringsMeasurement': cirq_google.BitstringsMeasurement, 'cirq.google.QuantumExecutable': cirq_google.QuantumExecutable, 'cirq.google.QuantumExecutableGroup': cirq_google.QuantumExecutableGroup, + 'cirq.google.KeyValueExecutableSpec': cirq_google.KeyValueExecutableSpec, + 'cirq.google.SharedRuntimeInfo': cirq_google.SharedRuntimeInfo, + 'cirq.google.RuntimeInfo': cirq_google.RuntimeInfo, + 'cirq.google.ExecutableResult': cirq_google.ExecutableResult, + 'cirq.google.ExecutableGroupResult': cirq_google.ExecutableGroupResult, + 'cirq.google.QuantumRuntimeConfiguration': cirq_google.QuantumRuntimeConfiguration, } diff --git a/cirq-google/cirq_google/json_test_data/cirq.google.ExecutableResult.json b/cirq-google/cirq_google/json_test_data/cirq.google.ExecutableResult.json new file mode 100644 index 00000000000..af6283c8fbe --- /dev/null +++ b/cirq-google/cirq_google/json_test_data/cirq.google.ExecutableResult.json @@ -0,0 +1,35 @@ +{ + "cirq_type": "cirq.google.ExecutableResult", + "spec": { + "cirq_type": "cirq.google.KeyValueExecutableSpec", + "executable_family": "cirq_google.algo_benchmarks.example", + "key_value_pairs": [ + [ + "name", + "test-spec" + ] + ] + }, + "runtime_info": { + "cirq_type": "cirq.google.RuntimeInfo", + "execution_index": 5 + }, + "raw_data": { + "cirq_type": "Result", + "params": { + "cirq_type": "ParamResolver", + "param_dict": [] + }, + "measurements": { + "z": { + "packed_digits": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", + "binary": true, + "dtype": "float64", + "shape": [ + 1000, + 4 + ] + } + } + } +} \ No newline at end of file diff --git a/cirq-google/cirq_google/json_test_data/cirq.google.ExecutableResult.repr b/cirq-google/cirq_google/json_test_data/cirq.google.ExecutableResult.repr new file mode 100644 index 00000000000..3ed67bb4880 --- /dev/null +++ b/cirq-google/cirq_google/json_test_data/cirq.google.ExecutableResult.repr @@ -0,0 +1 @@ +cirq_google.ExecutableResult(spec=cirq_google.KeyValueExecutableSpec(executable_family='cirq_google.algo_benchmarks.example', key_value_pairs=(('name', 'test-spec'),)), runtime_info=cirq_google.RuntimeInfo(execution_index=5), raw_data=cirq.Result(params=cirq.ParamResolver({}), measurements={'z': np.array([[1.0, 1.0, 1.0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0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1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0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1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0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1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0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1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 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]], dtype=np.float64)})) diff --git a/cirq-google/cirq_google/json_test_data/cirq.google.KeyValueExecutableSpec.json b/cirq-google/cirq_google/json_test_data/cirq.google.KeyValueExecutableSpec.json new file mode 100644 index 00000000000..8a735016311 --- /dev/null +++ b/cirq-google/cirq_google/json_test_data/cirq.google.KeyValueExecutableSpec.json @@ -0,0 +1,10 @@ +{ + "cirq_type": "cirq.google.KeyValueExecutableSpec", + "executable_family": "cirq_google.algo_benchmarks.example", + "key_value_pairs": [ + [ + "name", + "example-program" + ] + ] +} \ No newline at end of file diff --git a/cirq-google/cirq_google/json_test_data/cirq.google.KeyValueExecutableSpec.repr b/cirq-google/cirq_google/json_test_data/cirq.google.KeyValueExecutableSpec.repr new file mode 100644 index 00000000000..8a7220f6d6a --- /dev/null +++ b/cirq-google/cirq_google/json_test_data/cirq.google.KeyValueExecutableSpec.repr @@ -0,0 +1 @@ +cirq_google.KeyValueExecutableSpec(executable_family='cirq_google.algo_benchmarks.example', key_value_pairs=(('name', 'example-program'),)) diff --git a/cirq-google/cirq_google/json_test_data/cirq.google.QuantumExecutable.json b/cirq-google/cirq_google/json_test_data/cirq.google.QuantumExecutable.json new file mode 100644 index 00000000000..5710d73d654 --- /dev/null +++ b/cirq-google/cirq_google/json_test_data/cirq.google.QuantumExecutable.json @@ -0,0 +1,873 @@ +{ + "cirq_type": "_ContextualSerialization", + "object_dag": [ + { + "cirq_type": "_SerializedContext", + "key": 1, + "obj": { + "cirq_type": "FrozenCircuit", + "moments": [ + { + "cirq_type": "Moment", + "operations": [ + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "SwapPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 8 + }, + { + "cirq_type": "LineQubit", + "x": 1 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ISwapPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 7 + }, + { + "cirq_type": "LineQubit", + "x": 3 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ZPowGate", + "exponent": 0.5, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 6 + } + ] + } + ] + }, + { + "cirq_type": "Moment", + "operations": [ + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "CXPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 3 + }, + { + "cirq_type": "LineQubit", + "x": 0 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "CXPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 6 + }, + { + "cirq_type": "LineQubit", + "x": 5 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "CXPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 1 + }, + { + "cirq_type": "LineQubit", + "x": 8 + } + ] + }, + { + "cirq_type": "SingleQubitPauliStringGateOperation", + "pauli": { + "cirq_type": "_PauliZ", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubit": { + "cirq_type": "LineQubit", + "x": 7 + } + } + ] + }, + { + "cirq_type": "Moment", + "operations": [ + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ZPowGate", + "exponent": 0.25, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 2 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "CZPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 6 + }, + { + "cirq_type": "LineQubit", + "x": 9 + } + ] + }, + { + "cirq_type": "SingleQubitPauliStringGateOperation", + "pauli": { + "cirq_type": "_PauliX", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubit": { + "cirq_type": "LineQubit", + "x": 1 + } + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "HPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 4 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "CXPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 0 + }, + { + "cirq_type": "LineQubit", + "x": 5 + } + ] + } + ] + }, + { + "cirq_type": "Moment", + "operations": [ + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "SwapPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 3 + }, + { + "cirq_type": "LineQubit", + "x": 8 + } + ] + }, + { + "cirq_type": "SingleQubitPauliStringGateOperation", + "pauli": { + "cirq_type": "_PauliZ", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubit": { + "cirq_type": "LineQubit", + "x": 7 + } + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ZPowGate", + "exponent": 0.25, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 4 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "CXPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 5 + }, + { + "cirq_type": "LineQubit", + "x": 6 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ZPowGate", + "exponent": 0.25, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 1 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "CXPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 9 + }, + { + "cirq_type": "LineQubit", + "x": 0 + } + ] + } + ] + }, + { + "cirq_type": "Moment", + "operations": [ + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "CXPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 7 + }, + { + "cirq_type": "LineQubit", + "x": 3 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ZPowGate", + "exponent": 0.25, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 6 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "CXPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 4 + }, + { + "cirq_type": "LineQubit", + "x": 1 + } + ] + }, + { + "cirq_type": "SingleQubitPauliStringGateOperation", + "pauli": { + "cirq_type": "_PauliZ", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubit": { + "cirq_type": "LineQubit", + "x": 8 + } + } + ] + }, + { + "cirq_type": "Moment", + "operations": [ + { + "cirq_type": "SingleQubitPauliStringGateOperation", + "pauli": { + "cirq_type": "_PauliY", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubit": { + "cirq_type": "LineQubit", + "x": 6 + } + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "SwapPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 5 + }, + { + "cirq_type": "LineQubit", + "x": 0 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "HPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 9 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ZPowGate", + "exponent": 0.5, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 4 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ZPowGate", + "exponent": 0.5, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 8 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "SwapPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 3 + }, + { + "cirq_type": "LineQubit", + "x": 2 + } + ] + }, + { + "cirq_type": "SingleQubitPauliStringGateOperation", + "pauli": { + "cirq_type": "_PauliY", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubit": { + "cirq_type": "LineQubit", + "x": 1 + } + } + ] + }, + { + "cirq_type": "Moment", + "operations": [ + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ISwapPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 3 + }, + { + "cirq_type": "LineQubit", + "x": 5 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ISwapPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 6 + }, + { + "cirq_type": "LineQubit", + "x": 2 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "SwapPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 4 + }, + { + "cirq_type": "LineQubit", + "x": 0 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ZPowGate", + "exponent": 0.25, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 8 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "CXPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 1 + }, + { + "cirq_type": "LineQubit", + "x": 9 + } + ] + } + ] + }, + { + "cirq_type": "Moment", + "operations": [ + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "HPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 5 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "SwapPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 0 + }, + { + "cirq_type": "LineQubit", + "x": 3 + } + ] + }, + { + "cirq_type": "SingleQubitPauliStringGateOperation", + "pauli": { + "cirq_type": "_PauliZ", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubit": { + "cirq_type": "LineQubit", + "x": 7 + } + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ISwapPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 6 + }, + { + "cirq_type": "LineQubit", + "x": 9 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "CXPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 1 + }, + { + "cirq_type": "LineQubit", + "x": 2 + } + ] + } + ] + }, + { + "cirq_type": "Moment", + "operations": [ + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "SwapPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 8 + }, + { + "cirq_type": "LineQubit", + "x": 2 + } + ] + }, + { + "cirq_type": "SingleQubitPauliStringGateOperation", + "pauli": { + "cirq_type": "_PauliY", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubit": { + "cirq_type": "LineQubit", + "x": 7 + } + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "CXPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 3 + }, + { + "cirq_type": "LineQubit", + "x": 0 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "CXPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 9 + }, + { + "cirq_type": "LineQubit", + "x": 6 + } + ] + } + ] + }, + { + "cirq_type": "Moment", + "operations": [ + { + "cirq_type": "SingleQubitPauliStringGateOperation", + "pauli": { + "cirq_type": "_PauliX", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubit": { + "cirq_type": "LineQubit", + "x": 9 + } + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ZPowGate", + "exponent": 0.25, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 1 + } + ] + }, + { + "cirq_type": "SingleQubitPauliStringGateOperation", + "pauli": { + "cirq_type": "_PauliX", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubit": { + "cirq_type": "LineQubit", + "x": 7 + } + }, + { + "cirq_type": "SingleQubitPauliStringGateOperation", + "pauli": { + "cirq_type": "_PauliZ", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubit": { + "cirq_type": "LineQubit", + "x": 0 + } + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ISwapPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 6 + }, + { + "cirq_type": "LineQubit", + "x": 8 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ISwapPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 3 + }, + { + "cirq_type": "LineQubit", + "x": 4 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ZPowGate", + "exponent": 0.25, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 2 + } + ] + } + ] + } + ], + "device": { + "cirq_type": "_UnconstrainedDevice" + } + } + }, + { + "cirq_type": "cirq.google.QuantumExecutable", + "circuit": { + "cirq_type": "_SerializedKey", + "key": 1 + }, + "measurement": { + "cirq_type": "cirq.google.BitstringsMeasurement", + "n_repetitions": 10 + }, + "params": [], + "spec": { + "cirq_type": "cirq.google.KeyValueExecutableSpec", + "executable_family": "cirq_google.algo_benchmarks.example", + "key_value_pairs": [ + [ + "name", + "example-program" + ] + ] + }, + "problem_topology": null, + "initial_state": null + } + ] +} \ No newline at end of file diff --git a/cirq-google/cirq_google/json_test_data/cirq.google.QuantumExecutable.repr b/cirq-google/cirq_google/json_test_data/cirq.google.QuantumExecutable.repr new file mode 100644 index 00000000000..74bb8e19f5b --- /dev/null +++ b/cirq-google/cirq_google/json_test_data/cirq.google.QuantumExecutable.repr @@ -0,0 +1,72 @@ +cirq_google.QuantumExecutable(circuit=cirq.FrozenCircuit([ + cirq.Moment( + cirq.SWAP(cirq.LineQubit(8), cirq.LineQubit(1)), + cirq.ISWAP(cirq.LineQubit(7), cirq.LineQubit(3)), + cirq.S(cirq.LineQubit(6)), + ), + cirq.Moment( + cirq.CNOT(cirq.LineQubit(3), cirq.LineQubit(0)), + cirq.CNOT(cirq.LineQubit(6), cirq.LineQubit(5)), + cirq.CNOT(cirq.LineQubit(1), cirq.LineQubit(8)), + cirq.Z(cirq.LineQubit(7)), + ), + cirq.Moment( + cirq.T(cirq.LineQubit(2)), + cirq.CZ(cirq.LineQubit(6), cirq.LineQubit(9)), + cirq.X(cirq.LineQubit(1)), + cirq.H(cirq.LineQubit(4)), + cirq.CNOT(cirq.LineQubit(0), cirq.LineQubit(5)), + ), + cirq.Moment( + cirq.SWAP(cirq.LineQubit(3), cirq.LineQubit(8)), + cirq.Z(cirq.LineQubit(7)), + cirq.T(cirq.LineQubit(4)), + cirq.CNOT(cirq.LineQubit(5), cirq.LineQubit(6)), + cirq.T(cirq.LineQubit(1)), + cirq.CNOT(cirq.LineQubit(9), cirq.LineQubit(0)), + ), + cirq.Moment( + cirq.CNOT(cirq.LineQubit(7), cirq.LineQubit(3)), + cirq.T(cirq.LineQubit(6)), + cirq.CNOT(cirq.LineQubit(4), cirq.LineQubit(1)), + cirq.Z(cirq.LineQubit(8)), + ), + cirq.Moment( + cirq.Y(cirq.LineQubit(6)), + cirq.SWAP(cirq.LineQubit(5), cirq.LineQubit(0)), + cirq.H(cirq.LineQubit(9)), + cirq.S(cirq.LineQubit(4)), + cirq.S(cirq.LineQubit(8)), + cirq.SWAP(cirq.LineQubit(3), cirq.LineQubit(2)), + cirq.Y(cirq.LineQubit(1)), + ), + cirq.Moment( + cirq.ISWAP(cirq.LineQubit(3), cirq.LineQubit(5)), + cirq.ISWAP(cirq.LineQubit(6), cirq.LineQubit(2)), + cirq.SWAP(cirq.LineQubit(4), cirq.LineQubit(0)), + cirq.T(cirq.LineQubit(8)), + cirq.CNOT(cirq.LineQubit(1), cirq.LineQubit(9)), + ), + cirq.Moment( + cirq.H(cirq.LineQubit(5)), + cirq.SWAP(cirq.LineQubit(0), cirq.LineQubit(3)), + cirq.Z(cirq.LineQubit(7)), + cirq.ISWAP(cirq.LineQubit(6), cirq.LineQubit(9)), + cirq.CNOT(cirq.LineQubit(1), cirq.LineQubit(2)), + ), + cirq.Moment( + cirq.SWAP(cirq.LineQubit(8), cirq.LineQubit(2)), + cirq.Y(cirq.LineQubit(7)), + cirq.CNOT(cirq.LineQubit(3), cirq.LineQubit(0)), + cirq.CNOT(cirq.LineQubit(9), cirq.LineQubit(6)), + ), + cirq.Moment( + cirq.X(cirq.LineQubit(9)), + cirq.T(cirq.LineQubit(1)), + cirq.X(cirq.LineQubit(7)), + cirq.Z(cirq.LineQubit(0)), + cirq.ISWAP(cirq.LineQubit(6), cirq.LineQubit(8)), + cirq.ISWAP(cirq.LineQubit(3), cirq.LineQubit(4)), + cirq.T(cirq.LineQubit(2)), + ), +]), measurement=cirq_google.BitstringsMeasurement(n_repetitions=10), params=(), spec=cirq_google.KeyValueExecutableSpec(executable_family='cirq_google.algo_benchmarks.example', key_value_pairs=(('name', 'example-program'),)), problem_topology=None, initial_state=None) diff --git a/cirq-google/cirq_google/json_test_data/cirq.google.QuantumExecutableGroup.json b/cirq-google/cirq_google/json_test_data/cirq.google.QuantumExecutableGroup.json new file mode 100644 index 00000000000..7a01a7f9a47 --- /dev/null +++ b/cirq-google/cirq_google/json_test_data/cirq.google.QuantumExecutableGroup.json @@ -0,0 +1,2654 @@ +{ + "cirq_type": "_ContextualSerialization", + "object_dag": [ + { + "cirq_type": "_SerializedContext", + "key": 1, + "obj": { + "cirq_type": "FrozenCircuit", + "moments": [ + { + "cirq_type": "Moment", + "operations": [ + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "SwapPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 4 + }, + { + "cirq_type": "LineQubit", + "x": 9 + } + ] + }, + { + "cirq_type": "SingleQubitPauliStringGateOperation", + "pauli": { + "cirq_type": "_PauliY", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubit": { + "cirq_type": "LineQubit", + "x": 7 + } + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "CXPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 6 + }, + { + "cirq_type": "LineQubit", + "x": 8 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ISwapPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 5 + }, + { + "cirq_type": "LineQubit", + "x": 1 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "CXPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 0 + }, + { + "cirq_type": "LineQubit", + "x": 3 + } + ] + } + ] + }, + { + "cirq_type": "Moment", + "operations": [ + { + "cirq_type": "SingleQubitPauliStringGateOperation", + "pauli": { + "cirq_type": "_PauliX", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubit": { + "cirq_type": "LineQubit", + "x": 5 + } + }, + { + "cirq_type": "SingleQubitPauliStringGateOperation", + "pauli": { + "cirq_type": "_PauliY", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubit": { + "cirq_type": "LineQubit", + "x": 3 + } + }, + { + "cirq_type": "SingleQubitPauliStringGateOperation", + "pauli": { + "cirq_type": "_PauliZ", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubit": { + "cirq_type": "LineQubit", + "x": 9 + } + }, + { + "cirq_type": "SingleQubitPauliStringGateOperation", + "pauli": { + "cirq_type": "_PauliZ", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubit": { + "cirq_type": "LineQubit", + "x": 1 + } + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ZPowGate", + "exponent": 0.5, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 2 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ZPowGate", + "exponent": 0.5, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 0 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "CZPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 4 + }, + { + "cirq_type": "LineQubit", + "x": 7 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "SwapPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 8 + }, + { + "cirq_type": "LineQubit", + "x": 6 + } + ] + } + ] + }, + { + "cirq_type": "Moment", + "operations": [ + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "HPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 6 + } + ] + }, + { + "cirq_type": "SingleQubitPauliStringGateOperation", + "pauli": { + "cirq_type": "_PauliZ", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubit": { + "cirq_type": "LineQubit", + "x": 9 + } + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ISwapPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 5 + }, + { + "cirq_type": "LineQubit", + "x": 1 + } + ] + }, + { + "cirq_type": "SingleQubitPauliStringGateOperation", + "pauli": { + "cirq_type": "_PauliZ", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubit": { + "cirq_type": "LineQubit", + "x": 7 + } + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "HPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 2 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ISwapPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 0 + }, + { + "cirq_type": "LineQubit", + "x": 3 + } + ] + }, + { + "cirq_type": "SingleQubitPauliStringGateOperation", + "pauli": { + "cirq_type": "_PauliY", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubit": { + "cirq_type": "LineQubit", + "x": 4 + } + } + ] + }, + { + "cirq_type": "Moment", + "operations": [ + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "HPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 1 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ZPowGate", + "exponent": 0.5, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 7 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "CXPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 9 + }, + { + "cirq_type": "LineQubit", + "x": 3 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ZPowGate", + "exponent": 0.25, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 0 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ZPowGate", + "exponent": 0.25, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 5 + } + ] + } + ] + }, + { + "cirq_type": "Moment", + "operations": [ + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ZPowGate", + "exponent": 0.25, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 1 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "SwapPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 2 + }, + { + "cirq_type": "LineQubit", + "x": 4 + } + ] + }, + { + "cirq_type": "SingleQubitPauliStringGateOperation", + "pauli": { + "cirq_type": "_PauliX", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubit": { + "cirq_type": "LineQubit", + "x": 3 + } + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "HPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 9 + } + ] + } + ] + }, + { + "cirq_type": "Moment", + "operations": [ + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "SwapPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 6 + }, + { + "cirq_type": "LineQubit", + "x": 1 + } + ] + }, + { + "cirq_type": "SingleQubitPauliStringGateOperation", + "pauli": { + "cirq_type": "_PauliX", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubit": { + "cirq_type": "LineQubit", + "x": 0 + } + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "HPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 7 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "SwapPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 8 + }, + { + "cirq_type": "LineQubit", + "x": 5 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "SwapPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 4 + }, + { + "cirq_type": "LineQubit", + "x": 9 + } + ] + } + ] + }, + { + "cirq_type": "Moment", + "operations": [ + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ZPowGate", + "exponent": 0.25, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 0 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "SwapPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 8 + }, + { + "cirq_type": "LineQubit", + "x": 9 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ISwapPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 6 + }, + { + "cirq_type": "LineQubit", + "x": 4 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "CXPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 5 + }, + { + "cirq_type": "LineQubit", + "x": 3 + } + ] + } + ] + }, + { + "cirq_type": "Moment", + "operations": [ + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "CXPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 1 + }, + { + "cirq_type": "LineQubit", + "x": 3 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ZPowGate", + "exponent": 0.5, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 6 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ISwapPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 2 + }, + { + "cirq_type": "LineQubit", + "x": 9 + } + ] + }, + { + "cirq_type": "SingleQubitPauliStringGateOperation", + "pauli": { + "cirq_type": "_PauliX", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubit": { + "cirq_type": "LineQubit", + "x": 8 + } + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "CXPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 7 + }, + { + "cirq_type": "LineQubit", + "x": 0 + } + ] + } + ] + }, + { + "cirq_type": "Moment", + "operations": [ + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ISwapPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 9 + }, + { + "cirq_type": "LineQubit", + "x": 2 + } + ] + }, + { + "cirq_type": "SingleQubitPauliStringGateOperation", + "pauli": { + "cirq_type": "_PauliZ", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubit": { + "cirq_type": "LineQubit", + "x": 7 + } + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "HPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 3 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ZPowGate", + "exponent": 0.25, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 0 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "CZPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 8 + }, + { + "cirq_type": "LineQubit", + "x": 1 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "CZPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 6 + }, + { + "cirq_type": "LineQubit", + "x": 4 + } + ] + } + ] + }, + { + "cirq_type": "Moment", + "operations": [ + { + "cirq_type": "SingleQubitPauliStringGateOperation", + "pauli": { + "cirq_type": "_PauliY", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubit": { + "cirq_type": "LineQubit", + "x": 6 + } + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ZPowGate", + "exponent": 0.5, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 1 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ISwapPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 0 + }, + { + "cirq_type": "LineQubit", + "x": 8 + } + ] + }, + { + "cirq_type": "SingleQubitPauliStringGateOperation", + "pauli": { + "cirq_type": "_PauliY", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubit": { + "cirq_type": "LineQubit", + "x": 5 + } + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "CXPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 7 + }, + { + "cirq_type": "LineQubit", + "x": 4 + } + ] + } + ] + } + ], + "device": { + "cirq_type": "_UnconstrainedDevice" + } + } + }, + { + "cirq_type": "_SerializedContext", + "key": 2, + "obj": { + "cirq_type": "FrozenCircuit", + "moments": [ + { + "cirq_type": "Moment", + "operations": [ + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "SwapPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 2 + }, + { + "cirq_type": "LineQubit", + "x": 3 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "HPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 1 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "HPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 9 + } + ] + }, + { + "cirq_type": "SingleQubitPauliStringGateOperation", + "pauli": { + "cirq_type": "_PauliY", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubit": { + "cirq_type": "LineQubit", + "x": 0 + } + }, + { + "cirq_type": "SingleQubitPauliStringGateOperation", + "pauli": { + "cirq_type": "_PauliX", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubit": { + "cirq_type": "LineQubit", + "x": 4 + } + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ISwapPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 7 + }, + { + "cirq_type": "LineQubit", + "x": 8 + } + ] + } + ] + }, + { + "cirq_type": "Moment", + "operations": [ + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ZPowGate", + "exponent": 0.5, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 5 + } + ] + }, + { + "cirq_type": "SingleQubitPauliStringGateOperation", + "pauli": { + "cirq_type": "_PauliZ", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubit": { + "cirq_type": "LineQubit", + "x": 0 + } + }, + { + "cirq_type": "SingleQubitPauliStringGateOperation", + "pauli": { + "cirq_type": "_PauliY", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubit": { + "cirq_type": "LineQubit", + "x": 6 + } + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "CXPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 4 + }, + { + "cirq_type": "LineQubit", + "x": 3 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "SwapPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 7 + }, + { + "cirq_type": "LineQubit", + "x": 1 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ZPowGate", + "exponent": 0.5, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 9 + } + ] + } + ] + }, + { + "cirq_type": "Moment", + "operations": [ + { + "cirq_type": "SingleQubitPauliStringGateOperation", + "pauli": { + "cirq_type": "_PauliX", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubit": { + "cirq_type": "LineQubit", + "x": 7 + } + }, + { + "cirq_type": "SingleQubitPauliStringGateOperation", + "pauli": { + "cirq_type": "_PauliY", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubit": { + "cirq_type": "LineQubit", + "x": 3 + } + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "HPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 4 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ZPowGate", + "exponent": 0.25, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 6 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "SwapPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 0 + }, + { + "cirq_type": "LineQubit", + "x": 5 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "CXPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 8 + }, + { + "cirq_type": "LineQubit", + "x": 1 + } + ] + }, + { + "cirq_type": "SingleQubitPauliStringGateOperation", + "pauli": { + "cirq_type": "_PauliX", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubit": { + "cirq_type": "LineQubit", + "x": 9 + } + } + ] + }, + { + "cirq_type": "Moment", + "operations": [ + { + "cirq_type": "SingleQubitPauliStringGateOperation", + "pauli": { + "cirq_type": "_PauliZ", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubit": { + "cirq_type": "LineQubit", + "x": 2 + } + }, + { + "cirq_type": "SingleQubitPauliStringGateOperation", + "pauli": { + "cirq_type": "_PauliX", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubit": { + "cirq_type": "LineQubit", + "x": 3 + } + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "CZPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 5 + }, + { + "cirq_type": "LineQubit", + "x": 1 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ZPowGate", + "exponent": 0.5, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 4 + } + ] + }, + { + "cirq_type": "SingleQubitPauliStringGateOperation", + "pauli": { + "cirq_type": "_PauliX", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubit": { + "cirq_type": "LineQubit", + "x": 6 + } + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ISwapPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 7 + }, + { + "cirq_type": "LineQubit", + "x": 8 + } + ] + } + ] + }, + { + "cirq_type": "Moment", + "operations": [ + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "HPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 7 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ISwapPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 4 + }, + { + "cirq_type": "LineQubit", + "x": 0 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ZPowGate", + "exponent": 0.5, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 3 + } + ] + }, + { + "cirq_type": "SingleQubitPauliStringGateOperation", + "pauli": { + "cirq_type": "_PauliY", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubit": { + "cirq_type": "LineQubit", + "x": 6 + } + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ZPowGate", + "exponent": 0.5, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 1 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ZPowGate", + "exponent": 0.25, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 2 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ZPowGate", + "exponent": 0.25, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 5 + } + ] + } + ] + }, + { + "cirq_type": "Moment", + "operations": [ + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "CXPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 4 + }, + { + "cirq_type": "LineQubit", + "x": 9 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ZPowGate", + "exponent": 0.5, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 1 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ZPowGate", + "exponent": 0.25, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 3 + } + ] + }, + { + "cirq_type": "SingleQubitPauliStringGateOperation", + "pauli": { + "cirq_type": "_PauliY", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubit": { + "cirq_type": "LineQubit", + "x": 8 + } + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "CZPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 5 + }, + { + "cirq_type": "LineQubit", + "x": 2 + } + ] + } + ] + }, + { + "cirq_type": "Moment", + "operations": [ + { + "cirq_type": "SingleQubitPauliStringGateOperation", + "pauli": { + "cirq_type": "_PauliZ", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubit": { + "cirq_type": "LineQubit", + "x": 7 + } + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "HPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 8 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ISwapPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 5 + }, + { + "cirq_type": "LineQubit", + "x": 9 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "HPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 0 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "CXPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 1 + }, + { + "cirq_type": "LineQubit", + "x": 4 + } + ] + } + ] + }, + { + "cirq_type": "Moment", + "operations": [ + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "HPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 7 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "CXPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 1 + }, + { + "cirq_type": "LineQubit", + "x": 0 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "CXPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 5 + }, + { + "cirq_type": "LineQubit", + "x": 4 + } + ] + } + ] + }, + { + "cirq_type": "Moment", + "operations": [ + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "HPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 3 + } + ] + }, + { + "cirq_type": "SingleQubitPauliStringGateOperation", + "pauli": { + "cirq_type": "_PauliY", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubit": { + "cirq_type": "LineQubit", + "x": 6 + } + }, + { + "cirq_type": "SingleQubitPauliStringGateOperation", + "pauli": { + "cirq_type": "_PauliZ", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubit": { + "cirq_type": "LineQubit", + "x": 5 + } + }, + { + "cirq_type": "SingleQubitPauliStringGateOperation", + "pauli": { + "cirq_type": "_PauliX", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubit": { + "cirq_type": "LineQubit", + "x": 7 + } + }, + { + "cirq_type": "SingleQubitPauliStringGateOperation", + "pauli": { + "cirq_type": "_PauliZ", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubit": { + "cirq_type": "LineQubit", + "x": 1 + } + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ZPowGate", + "exponent": 0.5, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 2 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "CXPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 9 + }, + { + "cirq_type": "LineQubit", + "x": 8 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "HPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 4 + } + ] + } + ] + }, + { + "cirq_type": "Moment", + "operations": [ + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ISwapPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 1 + }, + { + "cirq_type": "LineQubit", + "x": 0 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "SwapPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 4 + }, + { + "cirq_type": "LineQubit", + "x": 5 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "CZPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 8 + }, + { + "cirq_type": "LineQubit", + "x": 9 + } + ] + } + ] + } + ], + "device": { + "cirq_type": "_UnconstrainedDevice" + } + } + }, + { + "cirq_type": "_SerializedContext", + "key": 3, + "obj": { + "cirq_type": "FrozenCircuit", + "moments": [ + { + "cirq_type": "Moment", + "operations": [ + { + "cirq_type": "SingleQubitPauliStringGateOperation", + "pauli": { + "cirq_type": "_PauliY", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubit": { + "cirq_type": "LineQubit", + "x": 4 + } + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "SwapPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 1 + }, + { + "cirq_type": "LineQubit", + "x": 7 + } + ] + }, + { + "cirq_type": "SingleQubitPauliStringGateOperation", + "pauli": { + "cirq_type": "_PauliX", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubit": { + "cirq_type": "LineQubit", + "x": 5 + } + }, + { + "cirq_type": "SingleQubitPauliStringGateOperation", + "pauli": { + "cirq_type": "_PauliY", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubit": { + "cirq_type": "LineQubit", + "x": 9 + } + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "HPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 0 + } + ] + }, + { + "cirq_type": "SingleQubitPauliStringGateOperation", + "pauli": { + "cirq_type": "_PauliY", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubit": { + "cirq_type": "LineQubit", + "x": 8 + } + }, + { + "cirq_type": "SingleQubitPauliStringGateOperation", + "pauli": { + "cirq_type": "_PauliY", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubit": { + "cirq_type": "LineQubit", + "x": 6 + } + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "SwapPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 2 + }, + { + "cirq_type": "LineQubit", + "x": 3 + } + ] + } + ] + }, + { + "cirq_type": "Moment", + "operations": [ + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ISwapPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 1 + }, + { + "cirq_type": "LineQubit", + "x": 5 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ZPowGate", + "exponent": 0.5, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 4 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "SwapPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 2 + }, + { + "cirq_type": "LineQubit", + "x": 8 + } + ] + } + ] + }, + { + "cirq_type": "Moment", + "operations": [ + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "SwapPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 0 + }, + { + "cirq_type": "LineQubit", + "x": 6 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "CXPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 8 + }, + { + "cirq_type": "LineQubit", + "x": 4 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "CZPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 3 + }, + { + "cirq_type": "LineQubit", + "x": 1 + } + ] + } + ] + }, + { + "cirq_type": "Moment", + "operations": [ + { + "cirq_type": "SingleQubitPauliStringGateOperation", + "pauli": { + "cirq_type": "_PauliX", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubit": { + "cirq_type": "LineQubit", + "x": 1 + } + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ISwapPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 6 + }, + { + "cirq_type": "LineQubit", + "x": 7 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "CZPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 0 + }, + { + "cirq_type": "LineQubit", + "x": 9 + } + ] + } + ] + }, + { + "cirq_type": "Moment", + "operations": [ + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ISwapPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 3 + }, + { + "cirq_type": "LineQubit", + "x": 1 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "CXPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 9 + }, + { + "cirq_type": "LineQubit", + "x": 8 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "SwapPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 7 + }, + { + "cirq_type": "LineQubit", + "x": 6 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "CZPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 0 + }, + { + "cirq_type": "LineQubit", + "x": 5 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ZPowGate", + "exponent": 0.5, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 4 + } + ] + } + ] + }, + { + "cirq_type": "Moment", + "operations": [ + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ZPowGate", + "exponent": 0.25, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 2 + } + ] + }, + { + "cirq_type": "SingleQubitPauliStringGateOperation", + "pauli": { + "cirq_type": "_PauliY", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubit": { + "cirq_type": "LineQubit", + "x": 9 + } + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ZPowGate", + "exponent": 0.5, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 3 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "SwapPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 5 + }, + { + "cirq_type": "LineQubit", + "x": 6 + } + ] + } + ] + }, + { + "cirq_type": "Moment", + "operations": [ + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "HPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 6 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "HPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 0 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "CXPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 5 + }, + { + "cirq_type": "LineQubit", + "x": 9 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "HPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 3 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ISwapPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 8 + }, + { + "cirq_type": "LineQubit", + "x": 1 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ISwapPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 7 + }, + { + "cirq_type": "LineQubit", + "x": 2 + } + ] + } + ] + }, + { + "cirq_type": "Moment", + "operations": [ + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ZPowGate", + "exponent": 0.25, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 0 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ISwapPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 7 + }, + { + "cirq_type": "LineQubit", + "x": 5 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "CZPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 3 + }, + { + "cirq_type": "LineQubit", + "x": 9 + } + ] + } + ] + }, + { + "cirq_type": "Moment", + "operations": [ + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "HPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 9 + } + ] + }, + { + "cirq_type": "SingleQubitPauliStringGateOperation", + "pauli": { + "cirq_type": "_PauliY", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubit": { + "cirq_type": "LineQubit", + "x": 1 + } + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ISwapPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 7 + }, + { + "cirq_type": "LineQubit", + "x": 6 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ISwapPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 4 + }, + { + "cirq_type": "LineQubit", + "x": 2 + } + ] + }, + { + "cirq_type": "SingleQubitPauliStringGateOperation", + "pauli": { + "cirq_type": "_PauliY", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubit": { + "cirq_type": "LineQubit", + "x": 5 + } + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "SwapPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 0 + }, + { + "cirq_type": "LineQubit", + "x": 8 + } + ] + } + ] + }, + { + "cirq_type": "Moment", + "operations": [ + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "CXPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 9 + }, + { + "cirq_type": "LineQubit", + "x": 5 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "ISwapPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 1 + }, + { + "cirq_type": "LineQubit", + "x": 6 + } + ] + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "CZPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 4 + }, + { + "cirq_type": "LineQubit", + "x": 7 + } + ] + }, + { + "cirq_type": "SingleQubitPauliStringGateOperation", + "pauli": { + "cirq_type": "_PauliZ", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubit": { + "cirq_type": "LineQubit", + "x": 2 + } + }, + { + "cirq_type": "SingleQubitPauliStringGateOperation", + "pauli": { + "cirq_type": "_PauliZ", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubit": { + "cirq_type": "LineQubit", + "x": 0 + } + }, + { + "cirq_type": "GateOperation", + "gate": { + "cirq_type": "HPowGate", + "exponent": 1.0, + "global_shift": 0.0 + }, + "qubits": [ + { + "cirq_type": "LineQubit", + "x": 8 + } + ] + } + ] + } + ], + "device": { + "cirq_type": "_UnconstrainedDevice" + } + } + }, + { + "cirq_type": "cirq.google.QuantumExecutableGroup", + "executables": [ + { + "cirq_type": "cirq.google.QuantumExecutable", + "circuit": { + "cirq_type": "_SerializedKey", + "key": 1 + }, + "measurement": { + "cirq_type": "cirq.google.BitstringsMeasurement", + "n_repetitions": 10 + }, + "params": [], + "spec": { + "cirq_type": "cirq.google.KeyValueExecutableSpec", + "executable_family": "cirq_google.algo_benchmarks.example", + "key_value_pairs": [ + [ + "name", + "example-program-0" + ] + ] + }, + "problem_topology": null, + "initial_state": null + }, + { + "cirq_type": "cirq.google.QuantumExecutable", + "circuit": { + "cirq_type": "_SerializedKey", + "key": 2 + }, + "measurement": { + "cirq_type": "cirq.google.BitstringsMeasurement", + "n_repetitions": 10 + }, + "params": [], + "spec": { + "cirq_type": "cirq.google.KeyValueExecutableSpec", + "executable_family": "cirq_google.algo_benchmarks.example", + "key_value_pairs": [ + [ + "name", + "example-program-1" + ] + ] + }, + "problem_topology": null, + "initial_state": null + }, + { + "cirq_type": "cirq.google.QuantumExecutable", + "circuit": { + "cirq_type": "_SerializedKey", + "key": 3 + }, + "measurement": { + "cirq_type": "cirq.google.BitstringsMeasurement", + "n_repetitions": 10 + }, + "params": [], + "spec": { + "cirq_type": "cirq.google.KeyValueExecutableSpec", + "executable_family": "cirq_google.algo_benchmarks.example", + "key_value_pairs": [ + [ + "name", + "example-program-2" + ] + ] + }, + "problem_topology": null, + "initial_state": null + } + ] + } + ] +} \ No newline at end of file diff --git a/cirq-google/cirq_google/json_test_data/cirq.google.QuantumExecutableGroup.repr b/cirq-google/cirq_google/json_test_data/cirq.google.QuantumExecutableGroup.repr new file mode 100644 index 00000000000..6038a348d18 --- /dev/null +++ b/cirq-google/cirq_google/json_test_data/cirq.google.QuantumExecutableGroup.repr @@ -0,0 +1,221 @@ +cirq_google.QuantumExecutableGroup(executables=(cirq_google.QuantumExecutable(circuit=cirq.FrozenCircuit([ + cirq.Moment( + cirq.SWAP(cirq.LineQubit(4), cirq.LineQubit(9)), + cirq.Y(cirq.LineQubit(7)), + cirq.CNOT(cirq.LineQubit(6), cirq.LineQubit(8)), + cirq.ISWAP(cirq.LineQubit(5), cirq.LineQubit(1)), + cirq.CNOT(cirq.LineQubit(0), cirq.LineQubit(3)), + ), + cirq.Moment( + cirq.X(cirq.LineQubit(5)), + cirq.Y(cirq.LineQubit(3)), + cirq.Z(cirq.LineQubit(9)), + cirq.Z(cirq.LineQubit(1)), + cirq.S(cirq.LineQubit(2)), + cirq.S(cirq.LineQubit(0)), + cirq.CZ(cirq.LineQubit(4), cirq.LineQubit(7)), + cirq.SWAP(cirq.LineQubit(8), cirq.LineQubit(6)), + ), + cirq.Moment( + cirq.H(cirq.LineQubit(6)), + cirq.Z(cirq.LineQubit(9)), + cirq.ISWAP(cirq.LineQubit(5), cirq.LineQubit(1)), + cirq.Z(cirq.LineQubit(7)), + cirq.H(cirq.LineQubit(2)), + cirq.ISWAP(cirq.LineQubit(0), cirq.LineQubit(3)), + cirq.Y(cirq.LineQubit(4)), + ), + cirq.Moment( + cirq.H(cirq.LineQubit(1)), + cirq.S(cirq.LineQubit(7)), + cirq.CNOT(cirq.LineQubit(9), cirq.LineQubit(3)), + cirq.T(cirq.LineQubit(0)), + cirq.T(cirq.LineQubit(5)), + ), + cirq.Moment( + cirq.T(cirq.LineQubit(1)), + cirq.SWAP(cirq.LineQubit(2), cirq.LineQubit(4)), + cirq.X(cirq.LineQubit(3)), + cirq.H(cirq.LineQubit(9)), + ), + cirq.Moment( + cirq.SWAP(cirq.LineQubit(6), cirq.LineQubit(1)), + cirq.X(cirq.LineQubit(0)), + cirq.H(cirq.LineQubit(7)), + cirq.SWAP(cirq.LineQubit(8), cirq.LineQubit(5)), + cirq.SWAP(cirq.LineQubit(4), cirq.LineQubit(9)), + ), + cirq.Moment( + cirq.T(cirq.LineQubit(0)), + cirq.SWAP(cirq.LineQubit(8), cirq.LineQubit(9)), + cirq.ISWAP(cirq.LineQubit(6), cirq.LineQubit(4)), + cirq.CNOT(cirq.LineQubit(5), cirq.LineQubit(3)), + ), + cirq.Moment( + cirq.CNOT(cirq.LineQubit(1), cirq.LineQubit(3)), + cirq.S(cirq.LineQubit(6)), + cirq.ISWAP(cirq.LineQubit(2), cirq.LineQubit(9)), + cirq.X(cirq.LineQubit(8)), + cirq.CNOT(cirq.LineQubit(7), cirq.LineQubit(0)), + ), + cirq.Moment( + cirq.ISWAP(cirq.LineQubit(9), cirq.LineQubit(2)), + cirq.Z(cirq.LineQubit(7)), + cirq.H(cirq.LineQubit(3)), + cirq.T(cirq.LineQubit(0)), + cirq.CZ(cirq.LineQubit(8), cirq.LineQubit(1)), + cirq.CZ(cirq.LineQubit(6), cirq.LineQubit(4)), + ), + cirq.Moment( + cirq.Y(cirq.LineQubit(6)), + cirq.S(cirq.LineQubit(1)), + cirq.ISWAP(cirq.LineQubit(0), cirq.LineQubit(8)), + cirq.Y(cirq.LineQubit(5)), + cirq.CNOT(cirq.LineQubit(7), cirq.LineQubit(4)), + ), +]), measurement=cirq_google.BitstringsMeasurement(n_repetitions=10), params=(), spec=cirq_google.KeyValueExecutableSpec(executable_family='cirq_google.algo_benchmarks.example', key_value_pairs=(('name', 'example-program-0'),)), problem_topology=None, initial_state=None), cirq_google.QuantumExecutable(circuit=cirq.FrozenCircuit([ + cirq.Moment( + cirq.SWAP(cirq.LineQubit(2), cirq.LineQubit(3)), + cirq.H(cirq.LineQubit(1)), + cirq.H(cirq.LineQubit(9)), + cirq.Y(cirq.LineQubit(0)), + cirq.X(cirq.LineQubit(4)), + cirq.ISWAP(cirq.LineQubit(7), cirq.LineQubit(8)), + ), + cirq.Moment( + cirq.S(cirq.LineQubit(5)), + cirq.Z(cirq.LineQubit(0)), + cirq.Y(cirq.LineQubit(6)), + cirq.CNOT(cirq.LineQubit(4), cirq.LineQubit(3)), + cirq.SWAP(cirq.LineQubit(7), cirq.LineQubit(1)), + cirq.S(cirq.LineQubit(9)), + ), + cirq.Moment( + cirq.X(cirq.LineQubit(7)), + cirq.Y(cirq.LineQubit(3)), + cirq.H(cirq.LineQubit(4)), + cirq.T(cirq.LineQubit(6)), + cirq.SWAP(cirq.LineQubit(0), cirq.LineQubit(5)), + cirq.CNOT(cirq.LineQubit(8), cirq.LineQubit(1)), + cirq.X(cirq.LineQubit(9)), + ), + cirq.Moment( + cirq.Z(cirq.LineQubit(2)), + cirq.X(cirq.LineQubit(3)), + cirq.CZ(cirq.LineQubit(5), cirq.LineQubit(1)), + cirq.S(cirq.LineQubit(4)), + cirq.X(cirq.LineQubit(6)), + cirq.ISWAP(cirq.LineQubit(7), cirq.LineQubit(8)), + ), + cirq.Moment( + cirq.H(cirq.LineQubit(7)), + cirq.ISWAP(cirq.LineQubit(4), cirq.LineQubit(0)), + cirq.S(cirq.LineQubit(3)), + cirq.Y(cirq.LineQubit(6)), + cirq.S(cirq.LineQubit(1)), + cirq.T(cirq.LineQubit(2)), + cirq.T(cirq.LineQubit(5)), + ), + cirq.Moment( + cirq.CNOT(cirq.LineQubit(4), cirq.LineQubit(9)), + cirq.S(cirq.LineQubit(1)), + cirq.T(cirq.LineQubit(3)), + cirq.Y(cirq.LineQubit(8)), + cirq.CZ(cirq.LineQubit(5), cirq.LineQubit(2)), + ), + cirq.Moment( + cirq.Z(cirq.LineQubit(7)), + cirq.H(cirq.LineQubit(8)), + cirq.ISWAP(cirq.LineQubit(5), cirq.LineQubit(9)), + cirq.H(cirq.LineQubit(0)), + cirq.CNOT(cirq.LineQubit(1), cirq.LineQubit(4)), + ), + cirq.Moment( + cirq.H(cirq.LineQubit(7)), + cirq.CNOT(cirq.LineQubit(1), cirq.LineQubit(0)), + cirq.CNOT(cirq.LineQubit(5), cirq.LineQubit(4)), + ), + cirq.Moment( + cirq.H(cirq.LineQubit(3)), + cirq.Y(cirq.LineQubit(6)), + cirq.Z(cirq.LineQubit(5)), + cirq.X(cirq.LineQubit(7)), + cirq.Z(cirq.LineQubit(1)), + cirq.S(cirq.LineQubit(2)), + cirq.CNOT(cirq.LineQubit(9), cirq.LineQubit(8)), + cirq.H(cirq.LineQubit(4)), + ), + cirq.Moment( + cirq.ISWAP(cirq.LineQubit(1), cirq.LineQubit(0)), + cirq.SWAP(cirq.LineQubit(4), cirq.LineQubit(5)), + cirq.CZ(cirq.LineQubit(8), cirq.LineQubit(9)), + ), +]), measurement=cirq_google.BitstringsMeasurement(n_repetitions=10), params=(), spec=cirq_google.KeyValueExecutableSpec(executable_family='cirq_google.algo_benchmarks.example', key_value_pairs=(('name', 'example-program-1'),)), problem_topology=None, initial_state=None), cirq_google.QuantumExecutable(circuit=cirq.FrozenCircuit([ + cirq.Moment( + cirq.Y(cirq.LineQubit(4)), + cirq.SWAP(cirq.LineQubit(1), cirq.LineQubit(7)), + cirq.X(cirq.LineQubit(5)), + cirq.Y(cirq.LineQubit(9)), + cirq.H(cirq.LineQubit(0)), + cirq.Y(cirq.LineQubit(8)), + cirq.Y(cirq.LineQubit(6)), + cirq.SWAP(cirq.LineQubit(2), cirq.LineQubit(3)), + ), + cirq.Moment( + cirq.ISWAP(cirq.LineQubit(1), cirq.LineQubit(5)), + cirq.S(cirq.LineQubit(4)), + cirq.SWAP(cirq.LineQubit(2), cirq.LineQubit(8)), + ), + cirq.Moment( + cirq.SWAP(cirq.LineQubit(0), cirq.LineQubit(6)), + cirq.CNOT(cirq.LineQubit(8), cirq.LineQubit(4)), + cirq.CZ(cirq.LineQubit(3), cirq.LineQubit(1)), + ), + cirq.Moment( + cirq.X(cirq.LineQubit(1)), + cirq.ISWAP(cirq.LineQubit(6), cirq.LineQubit(7)), + cirq.CZ(cirq.LineQubit(0), cirq.LineQubit(9)), + ), + cirq.Moment( + cirq.ISWAP(cirq.LineQubit(3), cirq.LineQubit(1)), + cirq.CNOT(cirq.LineQubit(9), cirq.LineQubit(8)), + cirq.SWAP(cirq.LineQubit(7), cirq.LineQubit(6)), + cirq.CZ(cirq.LineQubit(0), cirq.LineQubit(5)), + cirq.S(cirq.LineQubit(4)), + ), + cirq.Moment( + cirq.T(cirq.LineQubit(2)), + cirq.Y(cirq.LineQubit(9)), + cirq.S(cirq.LineQubit(3)), + cirq.SWAP(cirq.LineQubit(5), cirq.LineQubit(6)), + ), + cirq.Moment( + cirq.H(cirq.LineQubit(6)), + cirq.H(cirq.LineQubit(0)), + cirq.CNOT(cirq.LineQubit(5), cirq.LineQubit(9)), + cirq.H(cirq.LineQubit(3)), + cirq.ISWAP(cirq.LineQubit(8), cirq.LineQubit(1)), + cirq.ISWAP(cirq.LineQubit(7), cirq.LineQubit(2)), + ), + cirq.Moment( + cirq.T(cirq.LineQubit(0)), + cirq.ISWAP(cirq.LineQubit(7), cirq.LineQubit(5)), + cirq.CZ(cirq.LineQubit(3), cirq.LineQubit(9)), + ), + cirq.Moment( + cirq.H(cirq.LineQubit(9)), + cirq.Y(cirq.LineQubit(1)), + cirq.ISWAP(cirq.LineQubit(7), cirq.LineQubit(6)), + cirq.ISWAP(cirq.LineQubit(4), cirq.LineQubit(2)), + cirq.Y(cirq.LineQubit(5)), + cirq.SWAP(cirq.LineQubit(0), cirq.LineQubit(8)), + ), + cirq.Moment( + cirq.CNOT(cirq.LineQubit(9), cirq.LineQubit(5)), + cirq.ISWAP(cirq.LineQubit(1), cirq.LineQubit(6)), + cirq.CZ(cirq.LineQubit(4), cirq.LineQubit(7)), + cirq.Z(cirq.LineQubit(2)), + cirq.Z(cirq.LineQubit(0)), + cirq.H(cirq.LineQubit(8)), + ), +]), measurement=cirq_google.BitstringsMeasurement(n_repetitions=10), params=(), spec=cirq_google.KeyValueExecutableSpec(executable_family='cirq_google.algo_benchmarks.example', key_value_pairs=(('name', 'example-program-2'),)), problem_topology=None, initial_state=None))) diff --git a/cirq-google/cirq_google/json_test_data/cirq.google.RuntimeInfo.json b/cirq-google/cirq_google/json_test_data/cirq.google.RuntimeInfo.json new file mode 100644 index 00000000000..4e46eb3fbe0 --- /dev/null +++ b/cirq-google/cirq_google/json_test_data/cirq.google.RuntimeInfo.json @@ -0,0 +1,4 @@ +{ + "cirq_type": "cirq.google.RuntimeInfo", + "execution_index": 5 +} \ No newline at end of file diff --git a/cirq-google/cirq_google/json_test_data/cirq.google.RuntimeInfo.repr b/cirq-google/cirq_google/json_test_data/cirq.google.RuntimeInfo.repr new file mode 100644 index 00000000000..47fe6663793 --- /dev/null +++ b/cirq-google/cirq_google/json_test_data/cirq.google.RuntimeInfo.repr @@ -0,0 +1 @@ +cirq_google.RuntimeInfo(execution_index=5) diff --git a/cirq-google/cirq_google/json_test_data/cirq.google.SharedRuntimeInfo.json b/cirq-google/cirq_google/json_test_data/cirq.google.SharedRuntimeInfo.json new file mode 100644 index 00000000000..ecad202f88a --- /dev/null +++ b/cirq-google/cirq_google/json_test_data/cirq.google.SharedRuntimeInfo.json @@ -0,0 +1,4 @@ +{ + "cirq_type": "cirq.google.SharedRuntimeInfo", + "run_id": "my run" +} \ No newline at end of file diff --git a/cirq-google/cirq_google/json_test_data/cirq.google.SharedRuntimeInfo.repr b/cirq-google/cirq_google/json_test_data/cirq.google.SharedRuntimeInfo.repr new file mode 100644 index 00000000000..1a56b3b2280 --- /dev/null +++ b/cirq-google/cirq_google/json_test_data/cirq.google.SharedRuntimeInfo.repr @@ -0,0 +1 @@ +cirq_google.SharedRuntimeInfo(run_id='my run') diff --git a/cirq-google/cirq_google/json_test_data/spec.py b/cirq-google/cirq_google/json_test_data/spec.py index f644efe3ea6..915ad990306 100644 --- a/cirq-google/cirq_google/json_test_data/spec.py +++ b/cirq-google/cirq_google/json_test_data/spec.py @@ -58,13 +58,21 @@ 'BitstringsMeasurement', 'QuantumExecutable', 'QuantumExecutableGroup', + 'KeyValueExecutableSpec', + 'ExecutableResult', + 'ExecutableGroupResult', + 'QuantumRuntimeConfiguration', + 'RuntimeInfo', + 'SharedRuntimeInfo', ] }, tested_elsewhere=[ - # Requires a concrete ExecutableSpec, - # serialization tested in cirq_google/workflow/quantum_executable_test - 'cirq.google.QuantumExecutable', - 'cirq.google.QuantumExecutableGroup', + # Until `AbstractEngineProcessor` is implemented, we are using + # `AbstractEngineProcessorShim` and a mocked implementation for the `processor` argument + # in tests for `QuantumRuntimeConfiguration` (which is copied into `ExecutableGroupResult`). + # Therefore, we test json roundtrippability for these two classes in quantum_runtime_test.py + 'cirq.google.QuantumRuntimeConfiguration', + 'cirq.google.ExecutableGroupResult', ], resolver_cache=_class_resolver_dictionary(), deprecated={}, diff --git a/cirq-google/cirq_google/workflow/__init__.py b/cirq-google/cirq_google/workflow/__init__.py index 3579946d7c7..b09b02d69c8 100644 --- a/cirq-google/cirq_google/workflow/__init__.py +++ b/cirq-google/cirq_google/workflow/__init__.py @@ -1,6 +1,16 @@ from cirq_google.workflow.quantum_executable import ( ExecutableSpec, + KeyValueExecutableSpec, QuantumExecutable, QuantumExecutableGroup, BitstringsMeasurement, ) + +from cirq_google.workflow.quantum_runtime import ( + SharedRuntimeInfo, + RuntimeInfo, + ExecutableResult, + ExecutableGroupResult, + QuantumRuntimeConfiguration, + execute, +) diff --git a/cirq-google/cirq_google/workflow/_abstract_engine_processor_shim.py b/cirq-google/cirq_google/workflow/_abstract_engine_processor_shim.py new file mode 100644 index 00000000000..9a636914255 --- /dev/null +++ b/cirq-google/cirq_google/workflow/_abstract_engine_processor_shim.py @@ -0,0 +1,28 @@ +# Copyright 2021 The Cirq Developers +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +import abc + +import cirq.work + + +class AbstractEngineProcessorShim(metaclass=abc.ABCMeta): + @abc.abstractmethod + def get_device(self) -> cirq.Device: + pass + + @abc.abstractmethod + def get_sampler(self) -> cirq.Sampler: + pass diff --git a/cirq-google/cirq_google/workflow/quantum_executable.py b/cirq-google/cirq_google/workflow/quantum_executable.py index a5b46b41ee3..d1d4a52d1bb 100644 --- a/cirq-google/cirq_google/workflow/quantum_executable.py +++ b/cirq-google/cirq_google/workflow/quantum_executable.py @@ -17,10 +17,10 @@ import abc import dataclasses from dataclasses import dataclass -from typing import Union, Tuple, Optional, Sequence, cast, Iterable, Dict, Any +from typing import Union, Tuple, Optional, Sequence, cast, Dict, Any, List, Iterator -from cirq import _compat, study import cirq +from cirq import _compat, study class ExecutableSpec(metaclass=abc.ABCMeta): @@ -33,6 +33,49 @@ class ExecutableSpec(metaclass=abc.ABCMeta): """A unique name to group executables.""" +@dataclass(frozen=True) +class KeyValueExecutableSpec(ExecutableSpec): + """A generic executable spec whose metadata is a list of key-value pairs. + + The key-value pairs define an implicit data schema. Consider defining a problem-specific + subclass of `ExecutableSpec` instead of using this class to realize the benefits of having + an explicit schema. + + See Also: + `KeyValueExecutableSpec.from_dict` will use a dictionary to populate `key_value_pairs`. + + Args: + executable_family: A unique name to group executables. + key_value_pairs: A tuple of key-value pairs. The keys should be strings but the values + can be any immutable object. + """ + + executable_family: str + key_value_pairs: Tuple[Tuple[str, Any], ...] = () + + def _json_dict_(self) -> Dict[str, Any]: + return cirq.dataclass_json_dict(self, namespace='cirq.google') + + @classmethod + def from_dict(cls, d: Dict[str, Any], *, executable_family: str) -> 'KeyValueExecutableSpec': + return cls( + executable_family=executable_family, + key_value_pairs=tuple((k, v) for k, v in d.items()), + ) + + @classmethod + def _from_json_dict_( + cls, executable_family: str, key_value_pairs: List[List[Union[str, Any]]], **kwargs + ) -> 'KeyValueExecutableSpec': + return cls( + executable_family=executable_family, + key_value_pairs=tuple((k, v) for k, v in key_value_pairs), + ) + + def __repr__(self) -> str: + return cirq._compat.dataclass_repr(self, namespace='cirq_google') + + @dataclass(frozen=True) class BitstringsMeasurement: """Use in-circuit MeasurementGate to collect many repetitions of strings of bits. @@ -189,7 +232,7 @@ def __init__( def __len__(self) -> int: return len(self.executables) - def __iter__(self) -> Iterable[QuantumExecutable]: + def __iter__(self) -> Iterator[QuantumExecutable]: yield from self.executables def __str__(self) -> str: @@ -197,7 +240,7 @@ def __str__(self) -> str: if len(self.executables) > 2: exe_str += ', ...' - return f'QuantumExecutable(executables=[{exe_str}])' + return f'QuantumExecutableGroup(executables=[{exe_str}])' def __repr__(self) -> str: return _compat.dataclass_repr(self, namespace='cirq_google') diff --git a/cirq-google/cirq_google/workflow/quantum_executable_test.py b/cirq-google/cirq_google/workflow/quantum_executable_test.py index d24e8f5102d..9e424fc5d5e 100644 --- a/cirq-google/cirq_google/workflow/quantum_executable_test.py +++ b/cirq-google/cirq_google/workflow/quantum_executable_test.py @@ -20,7 +20,7 @@ from cirq_google import ( QuantumExecutable, BitstringsMeasurement, - ExecutableSpec, + KeyValueExecutableSpec, QuantumExecutableGroup, ) @@ -36,24 +36,36 @@ def _get_random_circuit(qubits, n_moments=10, op_density=0.8, random_state=52): ) -@dataclasses.dataclass(frozen=True) -class ExampleSpec(ExecutableSpec): - name: str - executable_family: str = 'cirq_google.algo_benchmarks.example' +def _get_example_spec(name='example-program'): + return KeyValueExecutableSpec.from_dict( + dict(name=name), executable_family='cirq_google.algo_benchmarks.example' + ) + + +def test_kv_executable_spec(): + kv1 = KeyValueExecutableSpec.from_dict( + dict(name='test', idx=5), executable_family='cirq_google.algo_benchmarks.example' + ) + kv2 = KeyValueExecutableSpec( + executable_family='cirq_google.algo_benchmarks.example', + key_value_pairs=(('name', 'test'), ('idx', 5)), + ) + assert kv1 == kv2 + assert hash(kv1) == hash(kv2) - def _json_dict_(self): - return cirq.dataclass_json_dict(self, namespace='cirq.google.testing') + with pytest.raises(TypeError, match='unhashable.*'): + hash(KeyValueExecutableSpec(executable_family='', key_value_pairs=[('name', 'test')])) -def _testing_resolver(cirq_type: str): - if cirq_type == 'cirq.google.testing.ExampleSpec': - return ExampleSpec +def test_kv_repr(): + kv = _get_example_spec() + cirq.testing.assert_equivalent_repr(kv, global_vals={'cirq_google': cirq_google}) def test_quantum_executable(tmpdir): qubits = cirq.LineQubit.range(10) exe = QuantumExecutable( - spec=ExampleSpec(name='example-program'), + spec=_get_example_spec(name='example-program'), circuit=_get_random_circuit(qubits), measurement=BitstringsMeasurement(n_repetitions=10), ) @@ -66,7 +78,7 @@ def test_quantum_executable(tmpdir): assert hash(dataclasses.astuple(exe)) == exe._hash prog2 = QuantumExecutable( - spec=ExampleSpec(name='example-program'), + spec=_get_example_spec(name='example-program'), circuit=_get_random_circuit(qubits), measurement=BitstringsMeasurement(n_repetitions=10), ) @@ -74,7 +86,7 @@ def test_quantum_executable(tmpdir): assert hash(exe) == hash(prog2) prog3 = QuantumExecutable( - spec=ExampleSpec(name='example-program'), + spec=_get_example_spec(name='example-program'), circuit=_get_random_circuit(qubits), measurement=BitstringsMeasurement(n_repetitions=20), # note: changed n_repetitions ) @@ -85,23 +97,20 @@ def test_quantum_executable(tmpdir): prog3.measurement.n_repetitions = 10 cirq.to_json(exe, f'{tmpdir}/exe.json') - exe_reconstructed = cirq.read_json( - f'{tmpdir}/exe.json', resolvers=[_testing_resolver] + cirq.DEFAULT_RESOLVERS - ) + exe_reconstructed = cirq.read_json(f'{tmpdir}/exe.json') assert exe == exe_reconstructed assert ( - str(exe) == "QuantumExecutable(spec=ExampleSpec(name='example-program', " - "executable_family='cirq_google.algo_benchmarks.example'))" - ) - cirq.testing.assert_equivalent_repr( - exe, global_vals={'ExampleSpec': ExampleSpec, 'cirq_google': cirq_google} + str(exe) == "QuantumExecutable(spec=cirq_google.KeyValueExecutableSpec(" + "executable_family='cirq_google.algo_benchmarks.example', " + "key_value_pairs=(('name', 'example-program'),)))" ) + cirq.testing.assert_equivalent_repr(exe, global_vals={'cirq_google': cirq_google}) def test_quantum_executable_inputs(): qubits = cirq.LineQubit.range(10) - spec = ExampleSpec(name='example-program') + spec = _get_example_spec(name='example-program') circuit = _get_random_circuit(qubits) measurement = BitstringsMeasurement(n_repetitions=10) @@ -128,7 +137,7 @@ def _get_quantum_executables(): qubits = cirq.LineQubit.range(10) return [ QuantumExecutable( - spec=ExampleSpec(name=f'example-program-{i}'), + spec=_get_example_spec(name=f'example-program-{i}'), circuit=_get_random_circuit(qubits, random_state=i), measurement=BitstringsMeasurement(n_repetitions=10), ) @@ -152,9 +161,9 @@ def test_quantum_executable_group_methods(): # pylint: disable=line-too-long assert str(eg) == ( - "QuantumExecutable(executables=[" - "QuantumExecutable(spec=ExampleSpec(name='example-program-0', executable_family='cirq_google.algo_benchmarks.example')), " - "QuantumExecutable(spec=ExampleSpec(name='example-program-1', executable_family='cirq_google.algo_benchmarks.example')), ...])" + "QuantumExecutableGroup(executables=[" + "QuantumExecutable(spec=cirq_google.KeyValueExecutableSpec(executable_family='cirq_google.algo_benchmarks.example', key_value_pairs=(('name', 'example-program-0'),))), " + "QuantumExecutable(spec=cirq_google.KeyValueExecutableSpec(executable_family='cirq_google.algo_benchmarks.example', key_value_pairs=(('name', 'example-program-1'),))), ...])" ) # pylint: enable=line-too-long @@ -166,12 +175,8 @@ def test_quantum_executable_group_serialization(tmpdir): exes = _get_quantum_executables() eg = QuantumExecutableGroup(exes) - cirq.testing.assert_equivalent_repr( - eg, global_vals={'ExampleSpec': ExampleSpec, 'cirq_google': cirq_google} - ) + cirq.testing.assert_equivalent_repr(eg, global_vals={'cirq_google': cirq_google}) cirq.to_json(eg, f'{tmpdir}/eg.json') - eg_reconstructed = cirq.read_json( - f'{tmpdir}/eg.json', resolvers=[_testing_resolver] + cirq.DEFAULT_RESOLVERS - ) + eg_reconstructed = cirq.read_json(f'{tmpdir}/eg.json') assert eg == eg_reconstructed diff --git a/cirq-google/cirq_google/workflow/quantum_runtime.py b/cirq-google/cirq_google/workflow/quantum_runtime.py new file mode 100644 index 00000000000..3c532b19d65 --- /dev/null +++ b/cirq-google/cirq_google/workflow/quantum_runtime.py @@ -0,0 +1,221 @@ +# Copyright 2021 The Cirq Developers +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Infrastructure for running quantum executables.""" + +import os +import uuid +from dataclasses import dataclass +from typing import Set, Any, Dict, Optional + +import cirq +from cirq import _compat +from cirq.protocols import dataclass_json_dict +from cirq_google.workflow._abstract_engine_processor_shim import AbstractEngineProcessorShim +from cirq_google.workflow.quantum_executable import ( + ExecutableSpec, + QuantumExecutableGroup, + BitstringsMeasurement, +) + + +@dataclass +class SharedRuntimeInfo: + """Runtime information common to all `QuantumExecutable`s in an execution of a + `QuantumExecutableGroup`. + + There is one `SharedRuntimeInfo` per `ExecutableGroupResult`. + + Args: + run_id: A unique `str` identifier for this run. + """ + + run_id: str + + def _json_dict_(self): + return dataclass_json_dict(self, namespace='cirq.google') + + def __repr__(self): + return _compat.dataclass_repr(self, namespace='cirq_google') + + +@dataclass +class RuntimeInfo: + """Runtime information relevant to a particular `QuantumExecutable`. + + There is one `RuntimeInfo` per `ExecutableResult` + + Args: + execution_index: What order (in its `QuantumExecutableGroup`) this `QuantumExecutable` was + executed. + """ + + execution_index: int + + def _json_dict_(self): + return dataclass_json_dict(self, namespace='cirq.google') + + def __repr__(self): + return _compat.dataclass_repr(self, namespace='cirq_google') + + +@dataclass +class ExecutableResult: + """Results for a `QuantumExecutable`. + + Args: + spec: The `ExecutableSpec` typifying the `QuantumExecutable`. + runtime_info: A `RuntimeInfo` dataclass containing information gathered during execution + of the `QuantumExecutable`. + raw_data: The `cirq.Result` containing the data from the run. + """ + + spec: Optional[ExecutableSpec] + runtime_info: RuntimeInfo + raw_data: cirq.Result + + def _json_dict_(self) -> Dict[str, Any]: + return dataclass_json_dict(self, namespace='cirq.google') + + def __repr__(self) -> str: + return _compat.dataclass_repr(self, namespace='cirq_google') + + def __hash__(self) -> int: + return hash(self.spec) + + +@dataclass +class ExecutableGroupResult: + """Results for a `QuantumExecutableGroup`. + + Args: + runtime_configuration: The `QuantumRuntimeConfiguration` describing how the + `QuantumExecutableGroup` was requested to be executed. + shared_runtime_info: A `SharedRuntimeInfo` dataclass containing information gathered + during execution of the `QuantumExecutableGroup` which is relevant to all + `executable_results`. + executable_results: A set of `ExecutableResult`. Each contains results and raw data + for an individual `QuantumExecutable`. + """ + + runtime_configuration: 'QuantumRuntimeConfiguration' + shared_runtime_info: SharedRuntimeInfo + executable_results: Set[ExecutableResult] + + def _json_dict_(self) -> Dict[str, Any]: + d = dataclass_json_dict(self, namespace='cirq.google') + # `set` is not JSON-serializable + d['executable_results'] = list(d['executable_results']) + return d + + @classmethod + def _from_json_dict_(cls, **kwargs) -> 'ExecutableGroupResult': + kwargs.pop('cirq_type') + kwargs['executable_results'] = set(kwargs['executable_results']) + return cls(**kwargs) + + def __repr__(self): + return _compat.dataclass_repr(self, namespace='cirq_google') + + +@dataclass +class QuantumRuntimeConfiguration: + """User-requested configuration of how to execute a given `QuantumExecutableGroup`. + + Args: + processor: The `AbstractEngineProcessor` responsible for running circuits and providing + device information. + run_id: A unique `str` identifier for a run. If data already exists for the specified + `run_id`, an exception will be raised. If not specified, we will generate a UUID4 + run identifier. + """ + + processor: AbstractEngineProcessorShim + run_id: Optional[str] = None + + def _json_dict_(self): + return dataclass_json_dict(self, namespace='cirq.google') + + def __repr__(self): + return _compat.dataclass_repr(self, namespace='cirq_google') + + +def execute( + rt_config: QuantumRuntimeConfiguration, + executable_group: QuantumExecutableGroup, + base_data_dir: str = ".", +) -> ExecutableGroupResult: + """Execute a `QuantumExecutableGroup` according to a `QuantumRuntimeConfiguration`. + + Args: + rt_config: The `QuantumRuntimeConfiguration` specifying how to execute `executable_group`. + executable_group: The `QuantumExecutableGroup` containing the executables to execute. + base_data_dir: A filesystem path to write data. We write + "{base_data_dir}/{run_id}/ExecutableGroupResult.json.gz" + containing the `ExecutableGroupResult` as well as one file + "{base_data_dir}/{run_id}/ExecutableResult.{i}.json.gz" per `ExecutableResult` as + each executable result becomes available. + + Returns: + The `ExecutableGroupResult` containing all data and metadata for an execution. + """ + # run_id defaults logic. + if rt_config.run_id is None: + run_id = str(uuid.uuid4()) + else: + run_id = rt_config.run_id + + # base_data_dir handling. + if not base_data_dir: + # coverage: ignore + raise ValueError("Please provide a non-empty `base_data_dir`.") + + os.makedirs(f'{base_data_dir}/{run_id}', exist_ok=False) + + # Results object that we will fill in in the main loop. + exegroup_result = ExecutableGroupResult( + runtime_configuration=rt_config, + shared_runtime_info=SharedRuntimeInfo(run_id=run_id), + executable_results=set(), + ) + cirq.to_json_gzip(exegroup_result, f'{base_data_dir}/{run_id}/ExecutableGroupResult.json.gz') + + # Loop over executables. + sampler = rt_config.processor.get_sampler() + n_executables = len(executable_group) + print() + for i, exe in enumerate(executable_group): + runtime_info = RuntimeInfo(execution_index=i) + + if exe.params != tuple(): + raise NotImplementedError("Circuit params are not yet supported.") + + circuit = exe.circuit + + if not isinstance(exe.measurement, BitstringsMeasurement): + raise NotImplementedError("Only `BitstringsMeasurement` are supported.") + + sampler_run_result = sampler.run(circuit, repetitions=exe.measurement.n_repetitions) + + exe_result = ExecutableResult( + spec=exe.spec, + runtime_info=runtime_info, + raw_data=sampler_run_result, + ) + cirq.to_json_gzip(exe_result, f'{base_data_dir}/{run_id}/ExecutableResult.{i}.json.gz') + exegroup_result.executable_results.add(exe_result) + print(f'\r{i+1} / {n_executables}', end='', flush=True) + print() + + return exegroup_result diff --git a/cirq-google/cirq_google/workflow/quantum_runtime_test.py b/cirq-google/cirq_google/workflow/quantum_runtime_test.py new file mode 100644 index 00000000000..1903b1d2517 --- /dev/null +++ b/cirq-google/cirq_google/workflow/quantum_runtime_test.py @@ -0,0 +1,135 @@ +# Copyright 2021 The Cirq Developers +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import glob +import uuid +from dataclasses import dataclass +from typing import List, Set + +import cirq +import cirq_google as cg +import numpy as np +import pytest +from cirq_google.workflow._abstract_engine_processor_shim import AbstractEngineProcessorShim +from cirq_google.workflow.quantum_executable_test import _get_quantum_executables, _get_example_spec + + +@dataclass +class _MockEngineProcessor(AbstractEngineProcessorShim): + def get_device(self) -> cirq.Device: + return cg.Sycamore23 + + def get_sampler(self) -> cirq.Sampler: + return cirq.ZerosSampler() + + def _json_dict_(self): + return cirq.obj_to_dict_helper(self, attribute_names=[], namespace='cirq.google.testing') + + +def cg_assert_equivalent_repr(value): + """cirq.testing.assert_equivalent_repr with cirq_google.workflow imported.""" + return cirq.testing.assert_equivalent_repr( + value, + global_vals={ + 'cirq_google': cg, + '_MockEngineProcessor': _MockEngineProcessor, + }, + ) + + +def test_shared_runtime_info(): + shared_rtinfo = cg.SharedRuntimeInfo(run_id='my run') + cg_assert_equivalent_repr(shared_rtinfo) + + +def test_runtime_info(): + rtinfo = cg.RuntimeInfo(execution_index=5) + cg_assert_equivalent_repr(rtinfo) + + +def test_executable_result(): + rtinfo = cg.RuntimeInfo(execution_index=5) + er = cg.ExecutableResult( + spec=_get_example_spec(name='test-spec'), + runtime_info=rtinfo, + raw_data=cirq.Result(params=cirq.ParamResolver(), measurements={'z': np.ones((1_000, 4))}), + ) + cg_assert_equivalent_repr(er) + + +def test_quantum_runtime_configuration(): + rt_config = cg.QuantumRuntimeConfiguration( + processor=_MockEngineProcessor(), + run_id='unit-test', + ) + cg_assert_equivalent_repr(rt_config) + + sampler = rt_config.processor.get_sampler() + result = sampler.run(cirq.Circuit(cirq.measure(cirq.LineQubit(0), key='z'))) + assert isinstance(result, cirq.Result) + + assert isinstance(rt_config.processor.get_device(), cirq.Device) + + +def test_executable_group_result(): + egr = cg.ExecutableGroupResult( + runtime_configuration=cg.QuantumRuntimeConfiguration( + processor=_MockEngineProcessor(), + run_id='unit-test', + ), + shared_runtime_info=cg.SharedRuntimeInfo(run_id='my run'), + executable_results=[ + cg.ExecutableResult( + spec=_get_example_spec(name=f'test-spec-{i}'), + runtime_info=cg.RuntimeInfo(execution_index=i), + raw_data=cirq.Result( + params=cirq.ParamResolver(), measurements={'z': np.ones((1_000, 4))} + ), + ) + for i in range(3) + ], + ) + cg_assert_equivalent_repr(egr) + assert len(egr.executable_results) == 3 + + +def _cg_read_json_gzip(fn): + def _testing_resolver(cirq_type: str): + if cirq_type == 'cirq.google.testing._MockEngineProcessor': + return _MockEngineProcessor + + return cirq.read_json_gzip(fn, resolvers=[_testing_resolver] + cirq.DEFAULT_RESOLVERS) + + +@pytest.mark.parametrize('run_id', ['unit_test_runid', None]) +def test_execute(tmpdir, run_id): + rt_config = cg.QuantumRuntimeConfiguration(processor=_MockEngineProcessor(), run_id=run_id) + executable_group = cg.QuantumExecutableGroup(_get_quantum_executables()) + returned_exegroup_result = cg.execute( + rt_config=rt_config, executable_group=executable_group, base_data_dir=tmpdir + ) + actual_run_id = returned_exegroup_result.shared_runtime_info.run_id + if run_id is not None: + assert run_id == actual_run_id + else: + assert isinstance(uuid.UUID(actual_run_id), uuid.UUID) + fns = glob.glob(f'{tmpdir}/{actual_run_id}/ExecutableGroupResult.json.gz') + assert len(fns) == 1 + exegroup_result: cg.ExecutableGroupResult = _cg_read_json_gzip(fns[0]) + + fns = glob.glob(f'{tmpdir}/{actual_run_id}/ExecutableResult.*.json.gz') + assert len(fns) == 3 + exe_results: Set[cg.ExecutableResult] = set(_cg_read_json_gzip(fn) for fn in fns) + + exegroup_result.executable_results = exe_results + assert returned_exegroup_result == exegroup_result