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

Remove circuit_duration_check from RunRequest, add max_circuit_duration_over_t2 #114

Merged
merged 3 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
Changelog
=========

Version 16.0
============

* Remove ``circuit_duration_check`` parameter from ``RunRequest``. `#114 <https://github.com/iqm-finland/iqm-client/pull/114>`_
* Add ``max_circuit_duration_over_t2`` parameter to ``RunRequest`` to control circuit disqualification threshold. `#114 <https://github.com/iqm-finland/iqm-client/pull/114>`_

Version 15.4
============

Expand Down
8 changes: 5 additions & 3 deletions INTEGRATION_GUIDE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,11 @@ Note on circuit duration
------------------------

Before performing circuit execution, IQM server checks how long it would take to run each circuit.
If any circuit in a job would take too long to execute compared to the coherence time of the QPU, the server will disqualify the job, not execute any circuits, and return a detailed error message.
In some special cases, it makes sense to disable this check by changing the default value of parameter ``circuit_duration_check`` of :meth:`IQMClient.submit_circuits` to ``False``.
Disabling the circuit duration check may be limited to certain users or groups, depending on the server settings. In normal use, the circuit duration check should always remain enabled.
If any circuit in a job would take too long to execute compared to the T2 time of the qubits,
the server will disqualify the job, not execute any circuits, and return a detailed error message.
In some special cases, it makes sense to disable this check by changing the default value of parameter
``max_circuit_duration_over_t2`` of :meth:`IQMClient.submit_circuits` to ``0.0`` or by making it large
enough for the job to pass the check. If the value is not set at all, the server default value will be used.

Note on environment variables
-----------------------------
Expand Down
15 changes: 9 additions & 6 deletions src/iqm/iqm_client/iqm_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,9 +433,10 @@ class RunRequest(BaseModel):
"""mapping of logical qubit names to physical qubit names, or None if using physical qubit names"""
shots: int = Field(..., gt=0)
"""how many times to execute each circuit in the batch, must be greater than zero"""
circuit_duration_check: bool = Field(True)
"""If True (default), circuits are disqualified on the server if they are too long compared to the
T2 decoherence times of the QPU. Setting it to False disables the check, which should not be done in normal use."""
max_circuit_duration_over_t2: Optional[float] = Field(None)
"""Circuits are disqualified on the server if they are longer than this ratio
of the T2 time of the qubits.
If set to 0.0, no circuits are disqualified. If set to None the server default value is used."""
heralding_mode: HeraldingMode = Field(HeraldingMode.NONE)
"""which heralding mode to use during the execution of circuits in this request."""

Expand Down Expand Up @@ -790,7 +791,7 @@ def submit_circuits(
custom_settings: Optional[dict[str, Any]] = None,
calibration_set_id: Optional[UUID] = None,
shots: int = 1,
circuit_duration_check: bool = True,
max_circuit_duration_over_t2: Optional[float] = None,
heralding_mode: HeraldingMode = HeraldingMode.NONE,
) -> UUID:
"""Submits a batch of quantum circuits for execution on a quantum computer.
Expand All @@ -804,7 +805,9 @@ def submit_circuits(
Note: This field should always be ``None`` in normal use.
calibration_set_id: ID of the calibration set to use, or ``None`` to use the latest one
shots: number of times ``circuits`` are executed, value must be greater than zero
circuit_duration_check: whether to enable max circuit duration criteria for disqualification
max_circuit_duration_over_t2: Circuits are disqualified on the server if they are longer than this ratio
of the T2 time of the qubits. Setting this value to ``0.0`` turns off circuit duration checking.
The defaul value ``None`` instructs server to use server's default value in the checking.
heralding_mode: Heralding mode to use during the execution.

Returns:
Expand Down Expand Up @@ -849,7 +852,7 @@ def submit_circuits(
custom_settings=custom_settings,
calibration_set_id=calibration_set_id,
shots=shots,
circuit_duration_check=circuit_duration_check,
max_circuit_duration_over_t2=max_circuit_duration_over_t2,
heralding_mode=heralding_mode,
)

Expand Down
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ def run_request_with_duration_check_disabled(sample_circuit) -> RunRequest:
SingleQubitMapping(logical_name='Qubit A', physical_name='QB1'),
SingleQubitMapping(logical_name='Qubit B', physical_name='QB2'),
],
circuit_duration_check=False,
max_circuit_duration_over_t2=0.0,
heralding_mode=HeraldingMode.NONE,
)

Expand Down Expand Up @@ -583,6 +583,6 @@ def submit_circuits_args(run_request: RunRequest) -> dict[str, Any]:
'custom_settings': run_request.custom_settings,
'calibration_set_id': run_request.calibration_set_id,
'shots': run_request.shots,
'circuit_duration_check': run_request.circuit_duration_check,
'max_circuit_duration_over_t2': run_request.max_circuit_duration_over_t2,
'heralding_mode': run_request.heralding_mode,
}
Loading