Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Perform fractional gate filtering on raw API dicts #2044

Merged
merged 17 commits into from
Nov 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"backend_name": "fake_fractional", "backend_version": "1.0.5", "n_qubits": 5, "basis_gates": ["id", "rz", "sx", "x", "cx", "reset", "rx", "rzx", "rzz"], "gates": [{"name": "id", "parameters": [], "qasm_def": "gate id q { U(0, 0, 0) q; }", "coupling_map": [[0], [1], [2], [3], [4]]}, {"name": "rz", "parameters": ["theta"], "qasm_def": "gate rz(theta) q { U(0, 0, theta) q; }", "coupling_map": [[0], [1], [2], [3], [4]]}, {"name": "sx", "parameters": [], "qasm_def": "gate sx q { U(pi/2, 3*pi/2, pi/2) q; }", "coupling_map": [[0], [1], [2], [3], [4]]}, {"name": "x", "parameters": [], "qasm_def": "gate x q { U(pi, 0, pi) q; }", "coupling_map": [[0], [1], [2], [3], [4]]}, {"name": "cx", "parameters": [], "qasm_def": "gate cx q0, q1 { CX q0, q1; }", "coupling_map": [[0, 1], [1, 0], [1, 2], [1, 3], [2, 1], [3, 1], [3, 4], [4, 3]]}, {"name": "reset", "parameters": null, "qasm_def": null}], "local": false, "simulator": false, "conditional": false, "open_pulse": true, "memory": true, "max_shots": 8192, "coupling_map": [[0, 1], [1, 0], [1, 2], [1, 3], [2, 1], [3, 1], [3, 4], [4, 3]], "dynamic_reprate_enabled": true, "supported_instructions": ["measure", "u3", "setf", "x", "delay", "id", "acquire", "sx", "u2", "u1", "cx", "shiftf", "play", "rz", "reset", "rx", "rzx", "if_else", "while_loop"], "rep_delay_range": [0.0, 500.0], "default_rep_delay": 250.0, "max_experiments": 900, "sample_name": "family: Falcon, revision: 4, segment: T", "n_registers": 1, "credits_required": true, "online_date": "2021-01-08T05:00:00+00:00", "description": "5 qubit device fractional tester", "dt": 0.2222222222222222, "dtm": 0.2222222222222222, "processor_type": {"family": "Falcon", "revision": 4, "segment": "T"}, "parametric_pulses": ["gaussian", "gaussian_square", "drag", "constant"], "allow_q_object": true, "multi_meas_enabled": true, "quantum_volume": 8, "qubit_channel_mapping": [["u0", "m0", "d0", "u1"], ["u4", "u3", "u0", "u2", "m1", "u1", "d1", "u5"], ["d2", "u4", "u2", "m2"], ["u3", "u7", "m3", "d3", "u6", "u5"], ["d4", "u6", "m4", "u7"]], "uchannels_enabled": true, "url": "None", "allow_object_storage": true, "n_uchannels": 8, "u_channel_lo": [[{"q": 1, "scale": [1.0, 0.0]}], [{"q": 0, "scale": [1.0, 0.0]}], [{"q": 2, "scale": [1.0, 0.0]}], [{"q": 3, "scale": [1.0, 0.0]}], [{"q": 1, "scale": [1.0, 0.0]}], [{"q": 1, "scale": [1.0, 0.0]}], [{"q": 4, "scale": [1.0, 0.0]}], [{"q": 3, "scale": [1.0, 0.0]}]], "meas_levels": [1, 2], "qubit_lo_range": [[4.52968554992376, 5.52968554992376], [4.628321697435369, 5.628321697435369], [4.74749131011471, 5.74749131011471], [4.803339662601714, 5.803339662601714], [4.591790567452984, 5.5917905674529855]], "meas_lo_range": [[6.925143125000002, 7.925143125000002], [6.721646720000002, 7.721646720000002], [6.971842939, 7.971842939], [6.8653172320000015, 7.8653172320000015], [6.919067567000002, 7.919067567000002]], "meas_kernels": ["hw_boxcar"], "discriminators": ["hw_centroid", "linear_discriminator", "quadratic_discriminator"], "rep_times": [1000.0], "meas_map": [[0, 1, 2, 3, 4]], "acquisition_latency": [], "conditional_latency": [], "hamiltonian": {"description": "Qubits are modeled as Duffing oscillators. In this case, the system includes higher energy states, i.e. not just |0> and |1>. The Pauli operators are generalized via the following set of transformations:\n\n$(\\mathbb{I}-\\sigma_{i}^z)/2 \\rightarrow O_i \\equiv b^\\dagger_{i} b_{i}$,\n\n$\\sigma_{+} \\rightarrow b^\\dagger$,\n\n$\\sigma_{-} \\rightarrow b$,\n\n$\\sigma_{i}^X \\rightarrow b^\\dagger_{i} + b_{i}$.\n\nQubits are coupled through resonator buses. The provided Hamiltonian has been projected into the zero excitation subspace of the resonator buses leading to an effective qubit-qubit flip-flop interaction. The qubit resonance frequencies in the Hamiltonian are the cavity dressed frequencies and not exactly what is returned by the backend defaults, which also includes the dressing due to the qubit-qubit interactions.\n\nQuantities are returned in angular frequencies, with units 2*pi*GHz.\n\nWARNING: Currently not all system Hamiltonian information is available to the public, missing values have been replaced with 0.\n", "h_latex": "\\begin{align} \\mathcal{H}/\\hbar = & \\sum_{i=0}^{4}\\left(\\frac{\\omega_{q,i}}{2}(\\mathbb{I}-\\sigma_i^{z})+\\frac{\\Delta_{i}}{2}(O_i^2-O_i)+\\Omega_{d,i}D_i(t)\\sigma_i^{X}\\right) \\\\ & + J_{0,1}(\\sigma_{0}^{+}\\sigma_{1}^{-}+\\sigma_{0}^{-}\\sigma_{1}^{+}) + J_{1,3}(\\sigma_{1}^{+}\\sigma_{3}^{-}+\\sigma_{1}^{-}\\sigma_{3}^{+}) + J_{3,4}(\\sigma_{3}^{+}\\sigma_{4}^{-}+\\sigma_{3}^{-}\\sigma_{4}^{+}) + J_{1,2}(\\sigma_{1}^{+}\\sigma_{2}^{-}+\\sigma_{1}^{-}\\sigma_{2}^{+}) \\\\ & + \\Omega_{d,0}(U_{0}^{(0,1)}(t))\\sigma_{0}^{X} + \\Omega_{d,1}(U_{1}^{(1,0)}(t)+U_{3}^{(1,3)}(t)+U_{2}^{(1,2)}(t))\\sigma_{1}^{X} \\\\ & + \\Omega_{d,2}(U_{4}^{(2,1)}(t))\\sigma_{2}^{X} + \\Omega_{d,3}(U_{5}^{(3,1)}(t)+U_{6}^{(3,4)}(t))\\sigma_{3}^{X} \\\\ & + \\Omega_{d,4}(U_{7}^{(4,3)}(t))\\sigma_{4}^{X} \\\\ \\end{align}", "h_str": ["_SUM[i,0,4,wq{i}/2*(I{i}-Z{i})]", "_SUM[i,0,4,delta{i}/2*O{i}*O{i}]", "_SUM[i,0,4,-delta{i}/2*O{i}]", "_SUM[i,0,4,omegad{i}*X{i}||D{i}]", "jq0q1*Sp0*Sm1", "jq0q1*Sm0*Sp1", "jq1q3*Sp1*Sm3", "jq1q3*Sm1*Sp3", "jq3q4*Sp3*Sm4", "jq3q4*Sm3*Sp4", "jq1q2*Sp1*Sm2", "jq1q2*Sm1*Sp2", "omegad1*X0||U0", "omegad0*X1||U1", "omegad3*X1||U3", "omegad2*X1||U2", "omegad1*X2||U4", "omegad1*X3||U5", "omegad4*X3||U6", "omegad3*X4||U7"], "osc": {}, "qub": {"0": 3, "1": 3, "2": 3, "3": 3, "4": 3}, "vars": {"delta0": -2.109526390232452, "delta1": -2.0002465324219205, "delta2": -2.0960936199138844, "delta3": -2.0812544393432897, "delta4": -2.1015348325639516, "jq0q1": 0.011088625669671271, "jq1q2": 0.011792549393436344, "jq1q3": 0.011913891984976948, "jq3q4": 0.01165632975311803, "omegad0": 1.5262727915514445, "omegad1": 1.2641690419030664, "omegad2": 1.3397127967877365, "omegad3": 1.509152095855826, "omegad4": 1.497387831726462, "wq0": 31.602446347014453, "wq1": 32.222195539816184, "wq2": 32.9709602992653, "wq3": 33.321865847041835, "wq4": 31.992663680656207}}, "channels": {"acquire0": {"operates": {"qubits": [0]}, "purpose": "acquire", "type": "acquire"}, "acquire1": {"operates": {"qubits": [1]}, "purpose": "acquire", "type": "acquire"}, "acquire2": {"operates": {"qubits": [2]}, "purpose": "acquire", "type": "acquire"}, "acquire3": {"operates": {"qubits": [3]}, "purpose": "acquire", "type": "acquire"}, "acquire4": {"operates": {"qubits": [4]}, "purpose": "acquire", "type": "acquire"}, "d0": {"operates": {"qubits": [0]}, "purpose": "drive", "type": "drive"}, "d1": {"operates": {"qubits": [1]}, "purpose": "drive", "type": "drive"}, "d2": {"operates": {"qubits": [2]}, "purpose": "drive", "type": "drive"}, "d3": {"operates": {"qubits": [3]}, "purpose": "drive", "type": "drive"}, "d4": {"operates": {"qubits": [4]}, "purpose": "drive", "type": "drive"}, "m0": {"operates": {"qubits": [0]}, "purpose": "measure", "type": "measure"}, "m1": {"operates": {"qubits": [1]}, "purpose": "measure", "type": "measure"}, "m2": {"operates": {"qubits": [2]}, "purpose": "measure", "type": "measure"}, "m3": {"operates": {"qubits": [3]}, "purpose": "measure", "type": "measure"}, "m4": {"operates": {"qubits": [4]}, "purpose": "measure", "type": "measure"}, "u0": {"operates": {"qubits": [0, 1]}, "purpose": "cross-resonance", "type": "control"}, "u1": {"operates": {"qubits": [1, 0]}, "purpose": "cross-resonance", "type": "control"}, "u2": {"operates": {"qubits": [1, 2]}, "purpose": "cross-resonance", "type": "control"}, "u3": {"operates": {"qubits": [1, 3]}, "purpose": "cross-resonance", "type": "control"}, "u4": {"operates": {"qubits": [2, 1]}, "purpose": "cross-resonance", "type": "control"}, "u5": {"operates": {"qubits": [3, 1]}, "purpose": "cross-resonance", "type": "control"}, "u6": {"operates": {"qubits": [3, 4]}, "purpose": "cross-resonance", "type": "control"}, "u7": {"operates": {"qubits": [4, 3]}, "purpose": "cross-resonance", "type": "control"}}}
{"backend_name": "fake_fractional", "backend_version": "1.0.5", "n_qubits": 5, "basis_gates": ["id", "rz", "sx", "x", "cx", "reset", "rx", "rzz"], "gates": [{"name": "id", "parameters": [], "qasm_def": "gate id q { U(0, 0, 0) q; }", "coupling_map": [[0], [1], [2], [3], [4]]}, {"name": "rz", "parameters": ["theta"], "qasm_def": "gate rz(theta) q { U(0, 0, theta) q; }", "coupling_map": [[0], [1], [2], [3], [4]]}, {"name": "sx", "parameters": [], "qasm_def": "gate sx q { U(pi/2, 3*pi/2, pi/2) q; }", "coupling_map": [[0], [1], [2], [3], [4]]}, {"name": "x", "parameters": [], "qasm_def": "gate x q { U(pi, 0, pi) q; }", "coupling_map": [[0], [1], [2], [3], [4]]}, {"name": "cx", "parameters": [], "qasm_def": "gate cx q0, q1 { CX q0, q1; }", "coupling_map": [[0, 1], [1, 0], [1, 2], [1, 3], [2, 1], [3, 1], [3, 4], [4, 3]]}, {"name": "reset", "parameters": null, "qasm_def": null}], "local": false, "simulator": false, "conditional": false, "open_pulse": true, "memory": true, "max_shots": 8192, "coupling_map": [[0, 1], [1, 0], [1, 2], [1, 3], [2, 1], [3, 1], [3, 4], [4, 3]], "dynamic_reprate_enabled": true, "supported_instructions": ["measure", "u3", "setf", "x", "delay", "id", "acquire", "sx", "u2", "u1", "cx", "shiftf", "play", "rz", "reset", "rx", "rzz", "if_else", "while_loop"], "rep_delay_range": [0.0, 500.0], "default_rep_delay": 250.0, "max_experiments": 900, "sample_name": "family: Falcon, revision: 4, segment: T", "n_registers": 1, "credits_required": true, "online_date": "2021-01-08T05:00:00+00:00", "description": "5 qubit device fractional tester", "dt": 0.2222222222222222, "dtm": 0.2222222222222222, "processor_type": {"family": "Falcon", "revision": 4, "segment": "T"}, "parametric_pulses": ["gaussian", "gaussian_square", "drag", "constant"], "allow_q_object": true, "multi_meas_enabled": true, "quantum_volume": 8, "qubit_channel_mapping": [["u0", "m0", "d0", "u1"], ["u4", "u3", "u0", "u2", "m1", "u1", "d1", "u5"], ["d2", "u4", "u2", "m2"], ["u3", "u7", "m3", "d3", "u6", "u5"], ["d4", "u6", "m4", "u7"]], "uchannels_enabled": true, "url": "None", "allow_object_storage": true, "n_uchannels": 8, "u_channel_lo": [[{"q": 1, "scale": [1.0, 0.0]}], [{"q": 0, "scale": [1.0, 0.0]}], [{"q": 2, "scale": [1.0, 0.0]}], [{"q": 3, "scale": [1.0, 0.0]}], [{"q": 1, "scale": [1.0, 0.0]}], [{"q": 1, "scale": [1.0, 0.0]}], [{"q": 4, "scale": [1.0, 0.0]}], [{"q": 3, "scale": [1.0, 0.0]}]], "meas_levels": [1, 2], "qubit_lo_range": [[4.52968554992376, 5.52968554992376], [4.628321697435369, 5.628321697435369], [4.74749131011471, 5.74749131011471], [4.803339662601714, 5.803339662601714], [4.591790567452984, 5.5917905674529855]], "meas_lo_range": [[6.925143125000002, 7.925143125000002], [6.721646720000002, 7.721646720000002], [6.971842939, 7.971842939], [6.8653172320000015, 7.8653172320000015], [6.919067567000002, 7.919067567000002]], "meas_kernels": ["hw_boxcar"], "discriminators": ["hw_centroid", "linear_discriminator", "quadratic_discriminator"], "rep_times": [1000.0], "meas_map": [[0, 1, 2, 3, 4]], "acquisition_latency": [], "conditional_latency": [], "hamiltonian": {"description": "Qubits are modeled as Duffing oscillators. In this case, the system includes higher energy states, i.e. not just |0> and |1>. The Pauli operators are generalized via the following set of transformations:\n\n$(\\mathbb{I}-\\sigma_{i}^z)/2 \\rightarrow O_i \\equiv b^\\dagger_{i} b_{i}$,\n\n$\\sigma_{+} \\rightarrow b^\\dagger$,\n\n$\\sigma_{-} \\rightarrow b$,\n\n$\\sigma_{i}^X \\rightarrow b^\\dagger_{i} + b_{i}$.\n\nQubits are coupled through resonator buses. The provided Hamiltonian has been projected into the zero excitation subspace of the resonator buses leading to an effective qubit-qubit flip-flop interaction. The qubit resonance frequencies in the Hamiltonian are the cavity dressed frequencies and not exactly what is returned by the backend defaults, which also includes the dressing due to the qubit-qubit interactions.\n\nQuantities are returned in angular frequencies, with units 2*pi*GHz.\n\nWARNING: Currently not all system Hamiltonian information is available to the public, missing values have been replaced with 0.\n", "h_latex": "\\begin{align} \\mathcal{H}/\\hbar = & \\sum_{i=0}^{4}\\left(\\frac{\\omega_{q,i}}{2}(\\mathbb{I}-\\sigma_i^{z})+\\frac{\\Delta_{i}}{2}(O_i^2-O_i)+\\Omega_{d,i}D_i(t)\\sigma_i^{X}\\right) \\\\ & + J_{0,1}(\\sigma_{0}^{+}\\sigma_{1}^{-}+\\sigma_{0}^{-}\\sigma_{1}^{+}) + J_{1,3}(\\sigma_{1}^{+}\\sigma_{3}^{-}+\\sigma_{1}^{-}\\sigma_{3}^{+}) + J_{3,4}(\\sigma_{3}^{+}\\sigma_{4}^{-}+\\sigma_{3}^{-}\\sigma_{4}^{+}) + J_{1,2}(\\sigma_{1}^{+}\\sigma_{2}^{-}+\\sigma_{1}^{-}\\sigma_{2}^{+}) \\\\ & + \\Omega_{d,0}(U_{0}^{(0,1)}(t))\\sigma_{0}^{X} + \\Omega_{d,1}(U_{1}^{(1,0)}(t)+U_{3}^{(1,3)}(t)+U_{2}^{(1,2)}(t))\\sigma_{1}^{X} \\\\ & + \\Omega_{d,2}(U_{4}^{(2,1)}(t))\\sigma_{2}^{X} + \\Omega_{d,3}(U_{5}^{(3,1)}(t)+U_{6}^{(3,4)}(t))\\sigma_{3}^{X} \\\\ & + \\Omega_{d,4}(U_{7}^{(4,3)}(t))\\sigma_{4}^{X} \\\\ \\end{align}", "h_str": ["_SUM[i,0,4,wq{i}/2*(I{i}-Z{i})]", "_SUM[i,0,4,delta{i}/2*O{i}*O{i}]", "_SUM[i,0,4,-delta{i}/2*O{i}]", "_SUM[i,0,4,omegad{i}*X{i}||D{i}]", "jq0q1*Sp0*Sm1", "jq0q1*Sm0*Sp1", "jq1q3*Sp1*Sm3", "jq1q3*Sm1*Sp3", "jq3q4*Sp3*Sm4", "jq3q4*Sm3*Sp4", "jq1q2*Sp1*Sm2", "jq1q2*Sm1*Sp2", "omegad1*X0||U0", "omegad0*X1||U1", "omegad3*X1||U3", "omegad2*X1||U2", "omegad1*X2||U4", "omegad1*X3||U5", "omegad4*X3||U6", "omegad3*X4||U7"], "osc": {}, "qub": {"0": 3, "1": 3, "2": 3, "3": 3, "4": 3}, "vars": {"delta0": -2.109526390232452, "delta1": -2.0002465324219205, "delta2": -2.0960936199138844, "delta3": -2.0812544393432897, "delta4": -2.1015348325639516, "jq0q1": 0.011088625669671271, "jq1q2": 0.011792549393436344, "jq1q3": 0.011913891984976948, "jq3q4": 0.01165632975311803, "omegad0": 1.5262727915514445, "omegad1": 1.2641690419030664, "omegad2": 1.3397127967877365, "omegad3": 1.509152095855826, "omegad4": 1.497387831726462, "wq0": 31.602446347014453, "wq1": 32.222195539816184, "wq2": 32.9709602992653, "wq3": 33.321865847041835, "wq4": 31.992663680656207}}, "channels": {"acquire0": {"operates": {"qubits": [0]}, "purpose": "acquire", "type": "acquire"}, "acquire1": {"operates": {"qubits": [1]}, "purpose": "acquire", "type": "acquire"}, "acquire2": {"operates": {"qubits": [2]}, "purpose": "acquire", "type": "acquire"}, "acquire3": {"operates": {"qubits": [3]}, "purpose": "acquire", "type": "acquire"}, "acquire4": {"operates": {"qubits": [4]}, "purpose": "acquire", "type": "acquire"}, "d0": {"operates": {"qubits": [0]}, "purpose": "drive", "type": "drive"}, "d1": {"operates": {"qubits": [1]}, "purpose": "drive", "type": "drive"}, "d2": {"operates": {"qubits": [2]}, "purpose": "drive", "type": "drive"}, "d3": {"operates": {"qubits": [3]}, "purpose": "drive", "type": "drive"}, "d4": {"operates": {"qubits": [4]}, "purpose": "drive", "type": "drive"}, "m0": {"operates": {"qubits": [0]}, "purpose": "measure", "type": "measure"}, "m1": {"operates": {"qubits": [1]}, "purpose": "measure", "type": "measure"}, "m2": {"operates": {"qubits": [2]}, "purpose": "measure", "type": "measure"}, "m3": {"operates": {"qubits": [3]}, "purpose": "measure", "type": "measure"}, "m4": {"operates": {"qubits": [4]}, "purpose": "measure", "type": "measure"}, "u0": {"operates": {"qubits": [0, 1]}, "purpose": "cross-resonance", "type": "control"}, "u1": {"operates": {"qubits": [1, 0]}, "purpose": "cross-resonance", "type": "control"}, "u2": {"operates": {"qubits": [1, 2]}, "purpose": "cross-resonance", "type": "control"}, "u3": {"operates": {"qubits": [1, 3]}, "purpose": "cross-resonance", "type": "control"}, "u4": {"operates": {"qubits": [2, 1]}, "purpose": "cross-resonance", "type": "control"}, "u5": {"operates": {"qubits": [3, 1]}, "purpose": "cross-resonance", "type": "control"}, "u6": {"operates": {"qubits": [3, 4]}, "purpose": "cross-resonance", "type": "control"}, "u7": {"operates": {"qubits": [4, 3]}, "purpose": "cross-resonance", "type": "control"}}}
yaelbh marked this conversation as resolved.
Show resolved Hide resolved

Large diffs are not rendered by default.

18 changes: 5 additions & 13 deletions qiskit_ibm_runtime/ibm_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,12 +246,6 @@ def _convert_to_target(self, refresh: bool = False) -> None:
configuration=self._configuration, # type: ignore[arg-type]
properties=self._properties,
defaults=self._defaults,
# In IBM backend architecture as of today
# these features can be only exclusively supported.
include_control_flow=self.options.use_fractional_gates is None
or not self.options.use_fractional_gates,
include_fractional_gates=self.options.use_fractional_gates is None
or self.options.use_fractional_gates,
)

@classmethod
Expand Down Expand Up @@ -337,19 +331,14 @@ def target_history(self, datetime: Optional[python_datetime] = None) -> Target:
configuration=self._configuration, # type: ignore[arg-type]
properties=self.properties(datetime=datetime), # pylint: disable=unexpected-keyword-arg
defaults=self._defaults,
# In IBM backend architecture as of today
# these features can be only exclusively supported.
include_control_flow=self.options.use_fractional_gates is None
or not self.options.use_fractional_gates,
include_fractional_gates=self.options.use_fractional_gates
or self.options.use_fractional_gates,
)

def refresh(self) -> None:
"""Retrieve the newest backend configuration and refresh the current backend target."""
if config := configuration_from_server_data(
raw_config=self._service._api_client.backend_configuration(self.name, refresh=True),
instance=self._instance,
use_fractional_gates=self.options.use_fractional_gates,
):
self._configuration = config
self.properties(refresh=True) # pylint: disable=unexpected-keyword-arg
Expand Down Expand Up @@ -402,7 +391,10 @@ def properties(
api_properties = self._api_client.backend_properties(self.name, datetime=datetime)
if not api_properties:
return None
backend_properties = properties_from_server_data(api_properties)
backend_properties = properties_from_server_data(
api_properties,
use_fractional_gates=self.options.use_fractional_gates,
)
if datetime: # Don't cache result.
return backend_properties
self._properties = backend_properties
Expand Down
Loading